itecdn 5.x用户文档
itecdn 5.x / 用户 API

查询订单列表

GET/v1/orders

分页查询订单,按订单 ID 倒序返回。接口要求登录。普通用户仅查询自身订单;管理员可传 uid 查询指定用户,或不传 uid 查询全部。total 为匹配订单 amount 的总和,保持数据库以分为单位的整数值。

身份认证

access-token

api-key + api-secret

认证定义
{
  "AccessToken": {
    "type": "apiKey",
    "in": "header",
    "name": "access-token",
    "description": "通过登录接口获得的短期访问令牌。"
  },
  "ApiKey": {
    "type": "apiKey",
    "in": "header",
    "name": "api-key",
    "description": "API Key;必须和 api-secret 同时发送。"
  },
  "ApiSecret": {
    "type": "apiKey",
    "in": "header",
    "name": "api-secret",
    "description": "API Secret;必须和 api-key 同时发送。"
  }
}

请求参数

参数位置类型必填说明与约束
pagequeryinteger可选

页码,必须为数字,默认 1。

完整参数定义
{
  "name": "page",
  "in": "query",
  "required": false,
  "description": "页码,必须为数字,默认 1。",
  "schema": {
    "type": "integer",
    "minimum": 1,
    "default": 1
  }
}
limitqueryinteger可选

每页条数,必须为数字,默认 10;传 0 时不分页。

完整参数定义
{
  "name": "limit",
  "in": "query",
  "required": false,
  "description": "每页条数,必须为数字,默认 10;传 0 时不分页。",
  "schema": {
    "type": "integer",
    "minimum": 0,
    "default": 10
  }
}
uidqueryinteger可选

仅管理员有效:用户 ID 精确筛选。

完整参数定义
{
  "name": "uid",
  "in": "query",
  "required": false,
  "description": "仅管理员有效:用户 ID 精确筛选。",
  "schema": {
    "type": "integer",
    "example": 12
  }
}
typequerystring可选

订单类型精确筛选。

完整参数定义
{
  "name": "type",
  "in": "query",
  "required": false,
  "description": "订单类型精确筛选。",
  "schema": {
    "type": "string"
  }
}
statequerystring可选

订单状态精确筛选。

完整参数定义
{
  "name": "state",
  "in": "query",
  "required": false,
  "description": "订单状态精确筛选。",
  "schema": {
    "type": "string",
    "enum": [
      "未付款",
      "已付款"
    ]
  }
}
startquerystring可选

创建时间下界,直接交给数据库比较。

完整参数定义
{
  "name": "start",
  "in": "query",
  "required": false,
  "description": "创建时间下界,直接交给数据库比较。",
  "schema": {
    "type": "string",
    "example": "2026-01-01 00:00:00"
  }
}
endquerystring可选

创建时间上界(不含),直接交给数据库比较。

完整参数定义
{
  "name": "end",
  "in": "query",
  "required": false,
  "description": "创建时间上界(不含),直接交给数据库比较。",
  "schema": {
    "type": "string",
    "example": "2026-02-01 00:00:00"
  }
}

响应

HTTP 200

成功及参数/认证错误均返回 HTTP 200。列表成功响应不含 msg。

application/json

oneOf

oneOf · 1 · object
字段类型必填说明与约束
codeinteger必填

订单列表查询成功时固定为 0。

约束 / 默认值 / 示例
{
  "enum": [
    0
  ]
}
countinteger必填

未分页的匹配订单数。

约束 / 默认值 / 示例
{
  "minimum": 0
}
totalinteger必填

匹配订单 amount 总和,单位为分;无订单时数据库可能返回 null。

约束 / 默认值 / 示例
{
  "nullable": true
}
dataarray <object>必填

当前页订单。

展开字段结构

当前页订单。

数组元素 · object
字段类型必填说明与约束
idinteger必填

订单 ID。

uidinteger必填

订单所属用户 ID。

约束 / 默认值 / 示例
{
  "nullable": true
}
typestring必填

订单类型。

约束 / 默认值 / 示例
{
  "nullable": true
}
desstring必填

订单描述。

约束 / 默认值 / 示例
{
  "nullable": true
}
datastring必填

订单业务数据文本。

约束 / 默认值 / 示例
{
  "nullable": true
}
amountinteger必填

订单金额,单位为分。

约束 / 默认值 / 示例
{
  "nullable": true
}
real_amountinteger必填

实付金额,单位为分。

约束 / 默认值 / 示例
{
  "nullable": true
}
pay_typestring必填

付款方式。

约束 / 默认值 / 示例
{
  "nullable": true
}
mch_order_nostring必填

商户订单号。

约束 / 默认值 / 示例
{
  "nullable": true
}
transaction_idstring必填

支付交易号。

约束 / 默认值 / 示例
{
  "nullable": true
}
statestring必填

订单状态。

约束 / 默认值 / 示例
{
  "nullable": true
}
create_atstring必填

格式化创建时间,YYYY-MM-DD HH:mm:ss。

约束 / 默认值 / 示例
{
  "nullable": true
}
pay_atstring必填

格式化付款时间,YYYY-MM-DD HH:mm:ss。

约束 / 默认值 / 示例
{
  "nullable": true
}
oneOf · 2 · object
字段类型必填说明与约束
codestring必填

page/limit 格式、state 非法或认证失败的业务错误码。

约束 / 默认值 / 示例
{
  "enum": [
    "order-1",
    "order-2",
    "order-4",
    "login_required"
  ]
}
msgstring必填

分页参数、订单状态或认证失败的具体原因。

datastring必填

发生业务错误时固定返回空字符串。

约束 / 默认值 / 示例
{
  "enum": [
    ""
  ]
}
完整 Schema
{
  "oneOf": [
    {
      "type": "object",
      "required": [
        "code",
        "count",
        "total",
        "data"
      ],
      "properties": {
        "code": {
          "type": "integer",
          "enum": [
            0
          ],
          "description": "订单列表查询成功时固定为 0。"
        },
        "count": {
          "type": "integer",
          "minimum": 0,
          "description": "未分页的匹配订单数。"
        },
        "total": {
          "type": "integer",
          "nullable": true,
          "description": "匹配订单 amount 总和,单位为分;无订单时数据库可能返回 null。"
        },
        "data": {
          "type": "array",
          "description": "当前页订单。",
          "items": {
            "type": "object",
            "required": [
              "id",
              "uid",
              "type",
              "des",
              "data",
              "amount",
              "real_amount",
              "pay_type",
              "mch_order_no",
              "transaction_id",
              "state",
              "create_at",
              "pay_at"
            ],
            "properties": {
              "id": {
                "type": "integer",
                "description": "订单 ID。"
              },
              "uid": {
                "type": "integer",
                "nullable": true,
                "description": "订单所属用户 ID。"
              },
              "type": {
                "type": "string",
                "nullable": true,
                "description": "订单类型。"
              },
              "des": {
                "type": "string",
                "nullable": true,
                "description": "订单描述。"
              },
              "data": {
                "type": "string",
                "nullable": true,
                "description": "订单业务数据文本。"
              },
              "amount": {
                "type": "integer",
                "nullable": true,
                "description": "订单金额,单位为分。"
              },
              "real_amount": {
                "type": "integer",
                "nullable": true,
                "description": "实付金额,单位为分。"
              },
              "pay_type": {
                "type": "string",
                "nullable": true,
                "description": "付款方式。"
              },
              "mch_order_no": {
                "type": "string",
                "nullable": true,
                "description": "商户订单号。"
              },
              "transaction_id": {
                "type": "string",
                "nullable": true,
                "description": "支付交易号。"
              },
              "state": {
                "type": "string",
                "nullable": true,
                "description": "订单状态。"
              },
              "create_at": {
                "type": "string",
                "nullable": true,
                "description": "格式化创建时间,YYYY-MM-DD HH:mm:ss。"
              },
              "pay_at": {
                "type": "string",
                "nullable": true,
                "description": "格式化付款时间,YYYY-MM-DD HH:mm:ss。"
              }
            },
            "additionalProperties": false
          }
        }
      },
      "additionalProperties": false
    },
    {
      "type": "object",
      "required": [
        "code",
        "msg",
        "data"
      ],
      "properties": {
        "code": {
          "type": "string",
          "enum": [
            "order-1",
            "order-2",
            "order-4",
            "login_required"
          ],
          "description": "page/limit 格式、state 非法或认证失败的业务错误码。"
        },
        "msg": {
          "type": "string",
          "description": "分页参数、订单状态或认证失败的具体原因。"
        },
        "data": {
          "type": "string",
          "enum": [
            ""
          ],
          "description": "发生业务错误时固定返回空字符串。"
        }
      },
      "additionalProperties": false
    }
  ]
}

示例

{
  "code": 0,
  "count": 1,
  "total": 1234,
  "data": [
    {
      "id": 501,
      "uid": 12,
      "type": "recharge",
      "des": "账户充值",
      "data": "",
      "amount": 1234,
      "real_amount": 1234,
      "pay_type": "alipay",
      "mch_order_no": "REDACTED_ORDER_NO",
      "transaction_id": "REDACTED_TRANSACTION_ID",
      "state": "已付款",
      "create_at": "2026-01-01 12:00:00",
      "pay_at": "2026-01-01 12:01:00"
    }
  ]
}

查询成功

{
  "code": 0,
  "count": 1,
  "total": 1234,
  "data": [
    {
      "id": 501,
      "uid": 12,
      "type": "recharge",
      "des": "账户充值",
      "data": "",
      "amount": 1234,
      "real_amount": 1234,
      "pay_type": "alipay",
      "mch_order_no": "REDACTED_ORDER_NO",
      "transaction_id": "REDACTED_TRANSACTION_ID",
      "state": "已付款",
      "create_at": "2026-01-01 12:00:00",
      "pay_at": "2026-01-01 12:01:00"
    }
  ]
}

cURL 示例

根据文档生成;请替换主控地址、路径参数和凭证,并按上表补充查询参数。

curl --request GET \
  "https://master.example.invalid/v1/orders" \
  --header "access-token: YOUR_ACCESS_TOKEN"

查看完整接口 JSON