查询流量余额

查询指定用户的流量统计信息。

接口信息

GET /client/dynamics/account/stat/list

请求头

参数名类型描述
x-merchant-tokenString商户令牌
x-merchant-codeString商户代码
Content-TypeStringapplication/json

请求参数

参数名必选类型描述
accountIdLong用户账号ID
startTimeString开始时间(yyyy-MM-dd)
endTimeString结束时间(yyyy-MM-dd)

响应示例

{
  "msg": "操作成功",
  "code": 200,
  "data": [
    {
      "requestsTotal": 0,
      "trafficTotal": 0.02,
      "dusage": "2025-07-22"
    },
    {
      "requestsTotal": 0,
      "trafficTotal": 0.01,
      "dusage": "2025-07-23"
    },
    {
      "requestsTotal": 0,
      "trafficTotal": 2670.54,
      "dusage": "2025-07-26"
    },
    {
      "requestsTotal": 0,
      "trafficTotal": 354.39,
      "dusage": "2025-07-28"
    }
  ]
}

代码示例

// 使用 fetch 查询流量统计
fetch(' /client/dynamics/account/stat/list?accountId=123&startTime=2025-07-22&endTime=2025-07-28', {
    method: 'GET',
    headers: {
        'x-merchant-token': 'your_token',
        'x-merchant-code': 'your_code',
        'Content-Type': 'application/json'
    }
})
.then(response => response.json())
.then(data => console.log(data));

响应参数说明

参数名类型描述
trafficTotalBigDecimal流量总数(MB)
dUsageString日期

注意事项

  1. 部分动态账号支持查询当天的流量统计(startTime和endTime都设置为当天日期,分时返回yyyy-MM-dd hh:mm:ss格式的流量统计)