跳到主内容

查询账户余额 · Get Account Balance

查询当前账户的钻石余额、签到金币余额、会员到期时间,以及 VIP 等级信息。

接口地址

POST https://xiangcao.ai/api/get-account-balance

该接口为普通接口,使用 POST 方法,无需请求体。

鉴权

需要在请求头携带 API Key:

Authorization: Bearer <YOUR_API_KEY>

余额只能查询 Token 所属账户自己的数据。缺少或无效的 Token 会返回 401

请求体

无需任何参数,请求体可以省略或传空对象 {}

响应(JSON)

字段类型说明
creditBalancenumber账户钻石余额。
checkinBalancenumber签到金币余额。
membershipExpiresAtnumber | null会员到期时间(毫秒时间戳);null 表示非会员。
vipLevelnumber当前 VIP 等级(0–30),0 表示尚未充值。
vipScorenumberVIP 分数 = 累计充值金额,单位为「分」(cents)。

类型定义(TypeScript)

interface GetAccountBalanceResponse {
  /** 账户钻石余额 */
  creditBalance: number;
  /** 签到金币余额 */
  checkinBalance: number;
  /** 会员到期时间(毫秒时间戳),null 表示非会员 */
  membershipExpiresAt: number | null;
  /** 当前 VIP 等级(0-30),0 表示尚未充值 */
  vipLevel: number;
  /** VIP 分数 = 累计充值金额(单位:分 / cents) */
  vipScore: number;
}

示例

请求:

curl -X POST "https://xiangcao.ai/api/get-account-balance" \
  -H "Authorization: Bearer <YOUR_API_KEY>" \
  -H "Content-Type: application/json"

响应:

{
  "creditBalance": 1280,
  "checkinBalance": 60,
  "membershipExpiresAt": 1767225600000,
  "vipLevel": 3,
  "vipScore": 9900
}

错误处理

出错时返回相应 HTTP 状态码及 JSON。

状态码说明
401未携带有效的 Bearer Token,或账号已被封禁。
500服务端内部错误(GetAccountBalanceFailed)。