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

获取订单详情

GET/v1/orders/{order_id}

获取当前登录用户的一条订单。服务端始终以订单 ID 和当前登录用户 ID 联合查询;即使管理员登录,也不能通过此接口查看其他用户的订单。

身份认证

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 同时发送。"
  }
}

请求参数

参数位置类型必填说明与约束
order_idpathinteger必填

要查询的订单 ID。

完整参数定义
{
  "name": "order_id",
  "in": "path",
  "required": true,
  "schema": {
    "type": "integer",
    "minimum": 1,
    "example": 501
  },
  "description": "要查询的订单 ID。"
}

响应

HTTP 200

成功、未登录和订单不存在/无权限均返回 HTTP 200。

application/json

oneOf

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

业务状态码;0 表示成功。

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

业务提示。

约束 / 默认值 / 示例
{
  "example": "获取成功"
}
dataobject必填

订单记录。

约束 / 默认值 / 示例
{
  "required": [
    "id",
    "uid",
    "type",
    "des",
    "data",
    "create_at",
    "pay_at",
    "amount",
    "real_amount",
    "pay_type",
    "mch_order_no",
    "transaction_id",
    "state"
  ],
  "additionalProperties": false
}
展开字段结构

订单记录。

字段类型必填说明与约束
idinteger必填

订单 ID。

uidinteger必填

订单所属用户 ID。

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

订单类型。

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

订单说明。

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

订单关联的业务数据文本。

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

订单创建时间;由数据库日期时间字段序列化返回。

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

订单付款时间;由数据库日期时间字段序列化返回。

约束 / 默认值 / 示例
{
  "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
}
oneOf · 2 · object
字段类型必填说明与约束
codestring必填

订单不存在、无权访问或未登录时的业务错误码。

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

错误原因。

约束 / 默认值 / 示例
{
  "example": "订单不存在或无权限"
}
datastring必填

错误响应中的固定空字符串。

约束 / 默认值 / 示例
{
  "example": ""
}
完整 Schema
{
  "oneOf": [
    {
      "type": "object",
      "required": [
        "code",
        "msg",
        "data"
      ],
      "properties": {
        "code": {
          "type": "integer",
          "description": "业务状态码;0 表示成功。",
          "enum": [
            0
          ]
        },
        "msg": {
          "type": "string",
          "description": "业务提示。",
          "example": "获取成功"
        },
        "data": {
          "type": "object",
          "description": "订单记录。",
          "required": [
            "id",
            "uid",
            "type",
            "des",
            "data",
            "create_at",
            "pay_at",
            "amount",
            "real_amount",
            "pay_type",
            "mch_order_no",
            "transaction_id",
            "state"
          ],
          "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": "订单关联的业务数据文本。"
            },
            "create_at": {
              "type": "string",
              "nullable": true,
              "description": "订单创建时间;由数据库日期时间字段序列化返回。"
            },
            "pay_at": {
              "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": "订单状态。"
            }
          },
          "additionalProperties": false
        }
      },
      "additionalProperties": false
    },
    {
      "type": "object",
      "required": [
        "code",
        "msg",
        "data"
      ],
      "properties": {
        "code": {
          "type": "string",
          "enum": [
            "order-3",
            "login_required"
          ],
          "description": "订单不存在、无权访问或未登录时的业务错误码。"
        },
        "msg": {
          "type": "string",
          "description": "错误原因。",
          "example": "订单不存在或无权限"
        },
        "data": {
          "type": "string",
          "description": "错误响应中的固定空字符串。",
          "example": ""
        }
      },
      "additionalProperties": false
    }
  ]
}

示例

{
  "code": 0,
  "msg": "获取成功",
  "data": {
    "id": 501,
    "uid": 12,
    "type": "充值",
    "des": "账户余额充值",
    "data": "",
    "create_at": "Mon, 01 Jan 2026 12:00:00 GMT",
    "pay_at": "Mon, 01 Jan 2026 12:01:00 GMT",
    "amount": 1234,
    "real_amount": 1234,
    "pay_type": "alipay",
    "mch_order_no": "REDACTED_ORDER_NO",
    "transaction_id": "REDACTED_TRANSACTION_ID",
    "state": "已付款"
  }
}

查询成功

{
  "code": 0,
  "msg": "获取成功",
  "data": {
    "id": 501,
    "uid": 12,
    "type": "充值",
    "des": "账户余额充值",
    "data": "",
    "create_at": "Mon, 01 Jan 2026 12:00:00 GMT",
    "pay_at": "Mon, 01 Jan 2026 12:01:00 GMT",
    "amount": 1234,
    "real_amount": 1234,
    "pay_type": "alipay",
    "mch_order_no": "REDACTED_ORDER_NO",
    "transaction_id": "REDACTED_TRANSACTION_ID",
    "state": "已付款"
  }
}

订单不存在或无权访问

{
  "code": "order-3",
  "msg": "订单不存在或无权限",
  "data": ""
}

cURL 示例

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

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

查看完整接口 JSON