QQ凭证心跳验证 POST
通过已绑定的 QQ 凭证(openid + access_token)+ statecode 定期上报心跳,用于在线检测和顶号防同时登录。请求方法: POST Content-Type: application/x-www-form-urlencoded
SDK 调用示例
PythonNode.jsJavaC#PHPpython
result = verify.heartbeat_by_qq('openid', 'access_token', 'statecode')
if result['success']:
print("心跳成功")
javascript
const result = await verify.heartbeatByQq('openid', 'access_token', 'statecode');
if (result.success) console.log('心跳成功');
java
T3Verify.T3Result result = verify.heartbeatByQq("openid", "access_token", "statecode");
if (result.success) System.out.println("心跳成功");
csharp
var result = verify.HeartbeatByQq("openid", "access_token", "statecode");
if (result.Success) Console.WriteLine("心跳成功");
php
$result = $verify->heartbeatByQq('openid', 'access_token', 'statecode');
if ($result['success']) echo "心跳成功\n";
前提条件需先通过 用户QQ登录 拿到 statecode。心跳建议每 60 秒调用一次。
请求参数
openid | string | 必填 | QQ openid(32 位字母数字) |
access_token | string | 必填 | QQ access_token(32 位字母数字) |
statecode | string | 必填 | 登录状态码(32 位,登录接口下发) |
成功响应
JSON 格式文本格式jsonc
{
"code": "200",
"msg": "心跳验证成功"
}
txt
心跳验证成功
错误列表
业务错误
openid不可为空 / access_token不可为空 | 凭证未传 |
openid只能为英文或数字 / access_token只能为英文或数字 | 凭证含非法字符 |
openid格式错误 / access_token格式错误 | 凭证长度不是 32 位 |
状态码不存在 | statecode 长度不是 32 位 |
该QQ未绑定用户 | openid + access_token 未匹配到已绑定的账号 |
用户未激活 | 账号 use_time=0 且 mode=0 |
登录状态不存在 | 服务器找不到对应的 statecode |
登录状态失效 | 已被其它设备顶号(后一次登录会把前一次心跳标记失效) |
通用错误
签名有误 | 签名校验失败 | 心跳失效处理接收到 登录状态失效 时应引导用户重新登录(用户QQ登录),并使用新拿到的 statecode 继续心跳。 |