{
  "tags": [
    "订单"
  ],
  "description": "分页查询订单，按订单 ID 倒序返回。接口要求登录。普通用户仅查询自身订单；管理员可传 uid 查询指定用户，或不传 uid 查询全部。`total` 为匹配订单 amount 的总和，保持数据库以分为单位的整数值。",
  "operationId": "user_get_v1_orders",
  "security": [
    {
      "AccessToken": []
    },
    {
      "ApiKey": [],
      "ApiSecret": []
    }
  ],
  "responses": {
    "200": {
      "description": "成功及参数/认证错误均返回 HTTP 200。列表成功响应不含 msg。",
      "content": {
        "application/json": {
          "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
              }
            ]
          },
          "examples": {
            "success": {
              "summary": "查询成功",
              "value": {
                "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"
                  }
                ]
              }
            }
          },
          "example": {
            "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"
              }
            ]
          }
        }
      }
    }
  },
  "x-python-handler": "order.OrderAPI",
  "x-python-route-line": 670,
  "x-audience": "user",
  "x-auth": "user",
  "x-reviewed": true,
  "parameters": [
    {
      "name": "page",
      "in": "query",
      "required": false,
      "description": "页码，必须为数字，默认 1。",
      "schema": {
        "type": "integer",
        "minimum": 1,
        "default": 1
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "description": "每页条数，必须为数字，默认 10；传 0 时不分页。",
      "schema": {
        "type": "integer",
        "minimum": 0,
        "default": 10
      }
    },
    {
      "name": "uid",
      "in": "query",
      "required": false,
      "description": "仅管理员有效：用户 ID 精确筛选。",
      "schema": {
        "type": "integer",
        "example": 12
      }
    },
    {
      "name": "type",
      "in": "query",
      "required": false,
      "description": "订单类型精确筛选。",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "state",
      "in": "query",
      "required": false,
      "description": "订单状态精确筛选。",
      "schema": {
        "type": "string",
        "enum": [
          "未付款",
          "已付款"
        ]
      }
    },
    {
      "name": "start",
      "in": "query",
      "required": false,
      "description": "创建时间下界，直接交给数据库比较。",
      "schema": {
        "type": "string",
        "example": "2026-01-01 00:00:00"
      }
    },
    {
      "name": "end",
      "in": "query",
      "required": false,
      "description": "创建时间上界（不含），直接交给数据库比较。",
      "schema": {
        "type": "string",
        "example": "2026-02-01 00:00:00"
      }
    }
  ],
  "x-itecdn-source-reviewed": true,
  "extensions": [
    {
      "key": "x-python-handler",
      "value": "order.OrderAPI"
    },
    {
      "key": "x-python-route-line",
      "value": 670
    },
    {
      "key": "x-audience",
      "value": "user"
    },
    {
      "key": "x-auth",
      "value": "user"
    },
    {
      "key": "x-reviewed",
      "value": true
    },
    {
      "key": "x-itecdn-source-reviewed",
      "value": true
    }
  ],
  "method": "get",
  "path": "/v1/orders",
  "servers": [
    {
      "url": "https://master.example.invalid",
      "description": "不可调用的示例地址；复制示例后替换为自己的主控域名。"
    }
  ],
  "securitySchemes": {
    "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 同时发送。"
    }
  },
  "info": {
    "title": "itecdn v5 用户 API",
    "version": "5.x",
    "description": "itecdn v5.x Python 主控用户 API。本文档不适用于 v6 或其它实现。"
  },
  "postman": {
    "name": "查询订单列表",
    "description": {
      "content": "分页查询订单，按订单 ID 倒序返回。接口要求登录。普通用户仅查询自身订单；管理员可传 uid 查询指定用户，或不传 uid 查询全部。`total` 为匹配订单 amount 的总和，保持数据库以分为单位的整数值。",
      "type": "text/plain"
    },
    "url": {
      "path": [
        "v1",
        "orders"
      ],
      "host": [
        "{{baseUrl}}"
      ],
      "query": [
        {
          "disabled": false,
          "description": {
            "content": "页码，必须为数字，默认 1。",
            "type": "text/plain"
          },
          "key": "page",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "每页条数，必须为数字，默认 10；传 0 时不分页。",
            "type": "text/plain"
          },
          "key": "limit",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "仅管理员有效：用户 ID 精确筛选。",
            "type": "text/plain"
          },
          "key": "uid",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "订单类型精确筛选。",
            "type": "text/plain"
          },
          "key": "type",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "订单状态精确筛选。",
            "type": "text/plain"
          },
          "key": "state",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "创建时间下界，直接交给数据库比较。",
            "type": "text/plain"
          },
          "key": "start",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "创建时间上界（不含），直接交给数据库比较。",
            "type": "text/plain"
          },
          "key": "end",
          "value": ""
        }
      ],
      "variable": []
    },
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "method": "GET",
    "auth": {
      "type": "apikey",
      "apikey": [
        {
          "type": "any",
          "value": "access-token",
          "key": "key"
        },
        {
          "type": "any",
          "value": "{{apiKey}}",
          "key": "value"
        },
        {
          "type": "any",
          "value": "header",
          "key": "in"
        }
      ]
    }
  }
}