Skip to content

QQ凭证心跳验证 POST

通过已绑定的 QQ 凭证(openid + access_token)+ statecode 定期上报心跳,用于在线检测和顶号防同时登录。

请求方法: POST  Content-Type: application/x-www-form-urlencoded

💡 SDK 快速接入

官方 SDK 已支持此接口,您可以直接使用 SDK 一键调用,无需手动处理加密和签名。

对接示例也已支持此接口

SDK 调用示例

python
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 秒调用一次。

请求参数

参数类型必填说明
openidstring必填QQ openid(32 位字母数字)
access_tokenstring必填QQ access_token(32 位字母数字)
statecodestring必填登录状态码(32 位,登录接口下发)
tnumber条件必填秒级 Unix 时间戳
sstring条件必填请求签名
safe_codestring可选数据验证码

成功响应

jsonc
{
  "code": "200",
  "msg": "心跳验证成功"
}
txt
心跳验证成功

错误列表

业务错误

错误消息原因
openid不可为空 / access_token不可为空凭证未传
openid只能为英文或数字 / access_token只能为英文或数字凭证含非法字符
openid格式错误 / access_token格式错误凭证长度不是 32 位
状态码不可为空未传 statecode
状态码不存在statecode 长度不是 32 位
该QQ未绑定用户openid + access_token 未匹配到已绑定的账号
用户被禁用用户 active=0
用户未激活账号 use_time=0mode=0
用户使用时间已到期账号已过期且 mode=0
登录状态不存在服务器找不到对应的 statecode
登录状态失效已被其它设备顶号(后一次登录会把前一次心跳标记失效)

通用错误

错误消息原因
程序未开启 / 接口未开启程序或接口未启用
时间戳参数不可为空开启时间戳验证但未传 t
验证数据已失效,请重试时间戳校验失败(排障指南
签名参数不可为空开启签名验证但未传 s
签名有误签名校验失败

心跳失效处理

接收到 登录状态失效 时应引导用户重新登录(用户QQ登录),并使用新拿到的 statecode 继续心跳。

T3 网络验证 WebAPI 开发文档