GetUserInfo 获取用户信息
账号授权模式下的信息查询入口:用用户名 + 密码查询该账号的详细信息(设备、IP、到期时间、激活状态)。
| 项目 | 值 |
|---|---|
| action | GetUserInfo |
| 入口 | Handle POST https://www.a7p.cn/api/verify/{ApiPassword} |
| 是否计入验证统计 | 否 |
调用步骤
- 完成 Init 握手,拿到
ApiPassword。 - 拼接明文:
action=GetUserInfo&UserName=账号&Password=密码。 - RC4 加密 + MD5 签名,POST 到 Handle 接口。
code == 200→ 读取data中的账号信息。
请求参数
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
action | string | 是 | 固定值 GetUserInfo |
UserName | string | 是 | 用户名。等价别名:username |
Password | string | 是 | 密码。等价别名:pwd、Pwd |
明文示例:
text
action=GetUserInfo&UserName=testuser01&Password=123456业务规则
- 两个字段缺一不可,缺失返回
1013。 - 用户名不存在返回
1016;密码不匹配返回1003。 - 返回的
expire_at取该账号最近一条激活记录的到期时间;无激活记录时返回注册当下时间,status为inactive。
请求示例
python
# 复用 /api/handle 页面中的 handle() 与 rc4() 函数
API_PW = "A1B2C3D4E5F6G7H8I9J0K1L2M3N4O5P6"
plain = "action=GetUserInfo&UserName=testuser01&Password=123456"
result = handle(API_PW, plain)
code = result["code"]
if code == 200:
d = result["data"]
print(f"到期: {d['expire_at']} 状态: {d['status']} 设备: {d.get('device_id','')}")
elif code == 1016:
print("用户未注册")
elif code == 1003:
print("密码错误")
else:
print(f"查询失败 {code}: {result['message']}")csharp
// 复用 /api/handle 页面中的 A7Client
var client = new A7Client(apiPassword);
string plain = "action=GetUserInfo&UserName=testuser01&Password=123456";
JsonElement result = await client.HandleAsync(plain);
int code = result.GetProperty("code").GetInt32();
switch (code)
{
case 200:
JsonElement d = result.GetProperty("data");
Console.WriteLine($"到期: {d.GetProperty("expire_at").GetString()} 状态: {d.GetProperty("status").GetString()}");
break;
case 1016:
Console.WriteLine("用户未注册");
break;
case 1003:
Console.WriteLine("密码错误");
break;
default:
Console.WriteLine($"查询失败 {code}: {result.GetProperty("message").GetString()}");
break;
}javascript
// 复用 /sdk/nodejs 中的 A7Client
const client = new A7Client({ appId: '150018', appKey: 'YOUR_APP_KEY' })
await client.init()
const result = await client.call('GetUserInfo', {
UserName: 'testuser01',
Password: '123456',
})
if (result.code === 200) {
console.log('到期:', result.data.expire_at, '状态:', result.data.status)
} else if (result.code === 1003) {
console.log('密码错误')
} else {
console.error(`查询失败 ${result.code}: ${result.message}`)
}text
.版本 2
.子程序 A7_获取用户信息, 逻辑型
.参数 ApiPassword, 文本型
.参数 账号, 文本型
.参数 密码, 文本型
.局部变量 TimeStamp, 文本型
.局部变量 加密参数, 文本型
.局部变量 Sign, 文本型
.局部变量 返回文本, 文本型
.局部变量 状态码, 文本型
TimeStamp = 到文本 (时间_取现行时间戳 ())
加密参数 = RC4加密 (ApiPassword, "action=GetUserInfo&UserName=" + 账号 + "&Password=" + 密码)
Sign = 取数据摘要 (到字节集 (ApiPassword + TimeStamp + 加密参数))
返回文本 = 到文本 (网页_访问 ("https://www.a7p.cn/api/verify/" + ApiPassword, 1, "TimeStamp=" + TimeStamp + "&Sign=" + Sign + "&Data=" + 加密参数))
状态码 = JSON_解析 (返回文本, "code")
.判断开始 (状态码 = "200")
信息框 ("到期:" + JSON_解析 (返回文本, "data.expire_at"), 0, )
.判断 (状态码 = "1003")
信息框 ("密码错误", 0, )
.默认
信息框 ("查询失败:" + JSON_解析 (返回文本, "message"), 0, )
.判断结束
返回 (假)成功响应
json
{
"code": 200,
"message": "success",
"data": {
"user_id": 1024,
"username": "testuser01",
"device_id": "MAC001",
"device_name": "WIN-PC",
"ip": "1.2.3.4",
"expire_at": "2026-09-01 12:00:00",
"status": "active"
}
}| 字段 | 类型 | 说明 |
|---|---|---|
user_id | int | 账号 ID |
username | string | 用户名 |
device_id | string | 绑定的机器码,未绑定时为空字符串 |
device_name | string | 设备名称,无则空字符串 |
ip | string | 注册/最近登录 IP |
expire_at | string | 最近一条激活记录的到期时间;无激活时为注册当下时间 |
status | string | 激活状态:active = 正常,inactive = 未激活 |
失败响应
json
{ "code": 1013, "message": "参数不完整: UserName, Password 必填", "data": null }json
{ "code": 1016, "message": "用户未注册", "data": null }json
{ "code": 1003, "message": "密码错误", "data": null }错误码
| 错误码 | 含义 | 解决方案 |
|---|---|---|
1013 | 参数不完整 | UserName 与 Password 必填 |
1016 | 用户未注册 | 引导先调用 UserRegin |
1003 | 密码错误 | 提示用户重新输入密码 |
完整列表见错误码对照表。
相关文档
- UserRegin 用户注册
- UserLogin 用户登录
- SDK 实现:易语言 · C# · Python · Node.js