Skip to content

单码心跳验证 POST

单码卡密登录后定期调用,维持在线状态。超时未调用将被视为离线。

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

💡 SDK 快速接入

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

对接示例也已支持此接口

SDK 调用示例

python
result = verify.heartbeat(card, statecode)
if result['success']:
    print("心跳验证成功")
javascript
const result = await verify.heartbeat(card, statecode);
if (result.success) console.log('心跳验证成功');
java
T3Verify.T3Result result = verify.heartbeat(card, statecode);
if (result.success) System.out.println("心跳验证成功");
csharp
var result = verify.Heartbeat(card, statecode);
if (result.Success) Console.WriteLine("心跳验证成功");
cpp
auto result = verify.heartbeat(card, statecode);
if (result.success) std::cout << "心跳验证成功" << std::endl;
php
$result = $verify->heartbeat($card, $statecode);
if ($result['success']) echo "心跳验证成功\n";
swift
let result = verify.heartbeat(kami: card, statecode: statecode)
if result.success { print("心跳验证成功") }

调用时机

登录成功后,按「登录状态码有效期」内定期调用。建议间隔为有效期的 1/2 ~ 2/3

例如有效期为 60 秒,则每 30 ~ 40 秒调用一次。

请求参数

参数类型必填说明
statecodestring必填登录时返回的 statecode 值(32 位字符串)
tnumber条件必填秒级 Unix 时间戳
sstring条件必填请求签名
safe_codestring可选数据验证码

成功响应

jsonc
{
  "code": "200",             // 状态码
  "msg": "在线",              // 结果消息
  "time": 1741700000,        // 服务器时间戳
  "date": "202603111200"     // 服务器日期分钟
}
txt
在线
当前时间:202603111200
当前时间戳:1741700000

错误列表

心跳错误

错误消息原因
状态码不可为空未传 statecode
状态码不存在statecode 长度不是 32 位
登录状态不存在statecode 在心跳记录中不存在
登录状态失效登录状态被标记失效(可能被挤下线)
登录状态已过期超过有效期未调用心跳
卡密已到期卡密已过期
卡密被禁用卡密被后台禁用

通用错误

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

T3 网络验证 WebAPI 开发文档