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 同时发送。"
}
}请求参数
| 参数 | 位置 | 类型 | 必填 | 说明与约束 |
|---|---|---|---|---|
page | query | integer | 可选 | 页码,必须为数字,默认 1。 完整参数定义 |
limit | query | integer | 可选 | 每页条数,必须为数字,默认 10;传 0 时不分页。 完整参数定义 |
uid | query | integer | 可选 | 仅管理员有效:用户 ID 精确筛选。 完整参数定义 |
type | query | string | 可选 | 订单类型精确筛选。 完整参数定义 |
state | query | string | 可选 | 订单状态精确筛选。 完整参数定义 |
start | query | string | 可选 | 创建时间下界,直接交给数据库比较。 完整参数定义 |
end | query | string | 可选 | 创建时间上界(不含),直接交给数据库比较。 完整参数定义 |
响应
HTTP 200
成功及参数/认证错误均返回 HTTP 200。列表成功响应不含 msg。
application/json
oneOf
oneOf · 1 · object
| 字段 | 类型 | 必填 | 说明与约束 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
code | integer | 必填 | 订单列表查询成功时固定为 0。 约束 / 默认值 / 示例 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
count | integer | 必填 | 未分页的匹配订单数。 约束 / 默认值 / 示例 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
total | integer | 必填 | 匹配订单 amount 总和,单位为分;无订单时数据库可能返回 null。 约束 / 默认值 / 示例 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
data | array <object> | 必填 | 当前页订单。 展开字段结构当前页订单。 数组元素 · object
|
oneOf · 2 · object
| 字段 | 类型 | 必填 | 说明与约束 |
|---|---|---|---|
code | string | 必填 | page/limit 格式、state 非法或认证失败的业务错误码。 约束 / 默认值 / 示例 |
msg | string | 必填 | 分页参数、订单状态或认证失败的具体原因。 |
data | string | 必填 | 发生业务错误时固定返回空字符串。 约束 / 默认值 / 示例 |
完整 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"