Skip to content
On this page

消费记录查询接口

1.接口功能

该功能允许用户通过千面动捕服务接口查询自己的消费记录。

2.请求方法

Post

3.请求路径

https://www.qmai.vip/business/consumptionRecord

4.请求参数

  • companyKey:必填,企业用户的上传凭证(可在用户详情页查看)。

  • page:页索引。

  • size:每页请求数

5.响应信息

服务端将以 JSON 格式返回响应数据。成功的响应会包含状态码、消息和数据;错误的响应会包含状态码和错误信息。

  • message:查询是否成功;
  • data:返回相关数据。示例:
{
    'records': [
        {
            'amount': 5,
            'reason': 'Video Upload',
            'duration': 5,
            'videoId': '192761892839000883',
            'videoName': 'static',
            'username': None,
            'createAt': 1748415141000,
            'statusName': 'Complete'
        }
    ],
    'total': 14,
    'size': 1
}

6.python示例代码

# encoding=utf-8
import configparser
import datetime
import json
import time
import traceback

import requests

key = ''


def read_record(key):
    try:
        url = f"https://www.qmai.vip/business/consumptionRecord"
        data = {
            "companyKey": key,
            "page": 1,
            "size": 1
        }
        print(url, data)
        response = requests.post(url, json=data)
        if response.status_code == 200:
            response_data = json.loads(response.text)
            now_time = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
            print(now_time, response_data)
            if response_data["code"] == 0 and response_data["message"] == 'success':
                return True
        else:
            print("访问链接失败")
    except Exception:
        traceback.print_exc()
        print("Exception read_status")
    return False


if __name__ == "__main__":
    #
    while True:
        if read_record(key):
            break
        time.sleep(5)