{
  "tags": [
    "套餐目录"
  ],
  "description": "获取一条套餐记录。普通用户只能读取启用套餐，管理员可读取停用套餐。传入 `duration` 时，服务端会按当前登录用户的有效折扣和可用优惠码试算该周期价格，并在返回数据中附加价格字段。",
  "operationId": "user_get_v1_packages_package_id",
  "security": [
    {
      "AccessToken": []
    },
    {
      "ApiKey": [],
      "ApiSecret": []
    }
  ],
  "responses": {
    "200": {
      "description": "成功、未登录、套餐不存在、普通用户查询停用套餐及周期参数非法均返回 HTTP 200。",
      "content": {
        "application/json": {
          "schema": {
            "oneOf": [
              {
                "type": "object",
                "required": [
                  "code",
                  "msg",
                  "data"
                ],
                "properties": {
                  "code": {
                    "type": "integer",
                    "enum": [
                      0
                    ],
                    "description": "业务状态码；0 表示成功。"
                  },
                  "msg": {
                    "type": "string",
                    "description": "成功时为空字符串。",
                    "example": ""
                  },
                  "data": {
                    "type": "object",
                    "description": "套餐记录；指定 `duration` 时会额外包含 `orgin_price`、`new_price` 和 `err`。",
                    "properties": {
                      "id": {
                        "type": "integer",
                        "description": "套餐 ID。"
                      },
                      "name": {
                        "type": "string",
                        "nullable": true,
                        "description": "套餐名称。"
                      },
                      "des": {
                        "type": "string",
                        "nullable": true,
                        "description": "套餐备注。"
                      },
                      "region_id": {
                        "type": "integer",
                        "nullable": true,
                        "description": "所属区域 ID。"
                      },
                      "node_group_id": {
                        "type": "integer",
                        "nullable": true,
                        "description": "主线路组 ID。"
                      },
                      "backup_node_group": {
                        "type": "integer",
                        "nullable": true,
                        "description": "备用线路组 ID。"
                      },
                      "cname_domain": {
                        "type": "integer",
                        "nullable": true,
                        "description": "CNAME 域名配置 ID。"
                      },
                      "cname_hostname2": {
                        "type": "string",
                        "nullable": true,
                        "description": "备用 CNAME 主机名。"
                      },
                      "cname_mode": {
                        "type": "string",
                        "nullable": true,
                        "description": "CNAME 使用模式。"
                      },
                      "traffic": {
                        "type": "integer",
                        "nullable": true,
                        "description": "流量额度；`-1` 表示不限。"
                      },
                      "bandwidth": {
                        "type": "string",
                        "nullable": true,
                        "description": "带宽限制值；`-1` 表示不限。"
                      },
                      "connection": {
                        "type": "integer",
                        "nullable": true,
                        "description": "连接数限制；`-1` 表示不限。"
                      },
                      "domain": {
                        "type": "integer",
                        "nullable": true,
                        "description": "域名数量限制；`-1` 表示不限。"
                      },
                      "main_domain": {
                        "type": "integer",
                        "nullable": true,
                        "description": "主域名数量限制；`-1` 表示不限。"
                      },
                      "http_port": {
                        "type": "integer",
                        "nullable": true,
                        "description": "HTTP 端口数量限制；`-1` 表示不限。"
                      },
                      "stream_port": {
                        "type": "integer",
                        "nullable": true,
                        "description": "四层转发端口数量限制；`-1` 表示不限。"
                      },
                      "custom_cc_rule": {
                        "type": "integer",
                        "nullable": true,
                        "enum": [
                          0,
                          1
                        ],
                        "description": "是否允许自定义 CC 规则：1 为允许。"
                      },
                      "websocket": {
                        "type": "integer",
                        "nullable": true,
                        "enum": [
                          0,
                          1
                        ],
                        "description": "是否支持 WebSocket：1 为支持。"
                      },
                      "http3": {
                        "type": "integer",
                        "nullable": true,
                        "enum": [
                          0,
                          1
                        ],
                        "description": "是否支持 HTTP/3：1 为支持。"
                      },
                      "l2_state": {
                        "type": "integer",
                        "nullable": true,
                        "enum": [
                          0,
                          1
                        ],
                        "description": "是否启用二层调度能力：1 为启用。"
                      },
                      "cc_protect": {
                        "type": "string",
                        "nullable": true,
                        "description": "CC 防护能力说明。"
                      },
                      "ddos_protect": {
                        "type": "string",
                        "nullable": true,
                        "description": "DDoS 防护能力说明。"
                      },
                      "expire": {
                        "type": "string",
                        "nullable": true,
                        "description": "套餐截止时间，由数据库日期时间字段序列化返回。"
                      },
                      "buy_num_limit": {
                        "type": "integer",
                        "nullable": true,
                        "description": "单用户购买数量限制；`-1` 表示不限。"
                      },
                      "backend_ip_limit": {
                        "type": "string",
                        "nullable": true,
                        "description": "源站 IP/CIDR 限制配置文本。"
                      },
                      "id_verify": {
                        "type": "integer",
                        "nullable": true,
                        "enum": [
                          0,
                          1
                        ],
                        "description": "是否要求实名认证：1 为要求。"
                      },
                      "before_exp_days_renew": {
                        "type": "integer",
                        "nullable": true,
                        "description": "到期前允许续费的提前天数；`-1` 表示不限。"
                      },
                      "month_price": {
                        "type": "integer",
                        "nullable": true,
                        "description": "月付价格，单位为系统最小货币单位。"
                      },
                      "quarter_price": {
                        "type": "integer",
                        "nullable": true,
                        "description": "季付价格，单位为系统最小货币单位。"
                      },
                      "year_price": {
                        "type": "integer",
                        "nullable": true,
                        "description": "年付价格，单位为系统最小货币单位。"
                      },
                      "create_at": {
                        "type": "string",
                        "nullable": true,
                        "description": "创建时间，由数据库日期时间字段序列化返回。"
                      },
                      "update_at": {
                        "type": "string",
                        "nullable": true,
                        "description": "最后更新时间，由数据库日期时间字段序列化返回。"
                      },
                      "sort": {
                        "type": "integer",
                        "nullable": true,
                        "description": "展示排序值。"
                      },
                      "owner": {
                        "type": "string",
                        "nullable": true,
                        "description": "专属用户 ID 列表，使用英文逗号分隔。"
                      },
                      "enable": {
                        "type": "integer",
                        "nullable": true,
                        "enum": [
                          0,
                          1
                        ],
                        "description": "是否启用：1 为启用，0 为停用。"
                      },
                      "orgin_price": {
                        "type": "integer",
                        "description": "仅传 `duration` 时返回：所选周期的原始价格，单位为系统最小货币单位。"
                      },
                      "new_price": {
                        "type": "integer",
                        "description": "仅传 `duration` 时返回：应用有效折扣或优惠码后的所选周期试算价格，单位为系统最小货币单位。"
                      },
                      "err": {
                        "type": "string",
                        "nullable": true,
                        "description": "仅传 `duration` 时返回：优惠码或折扣不能应用时的原因；无错误时为 null。"
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "additionalProperties": false
              },
              {
                "type": "object",
                "required": [
                  "code",
                  "msg",
                  "data"
                ],
                "properties": {
                  "code": {
                    "type": "string",
                    "enum": [
                      "package-83",
                      "package-36",
                      "package-37",
                      "login_required"
                    ],
                    "description": "周期参数非法、套餐不存在、普通用户无权查询停用套餐或未登录时的业务错误码。"
                  },
                  "msg": {
                    "type": "string",
                    "description": "错误原因。",
                    "example": "无权限查询"
                  },
                  "data": {
                    "type": "string",
                    "description": "错误响应中的固定空字符串。",
                    "example": ""
                  }
                },
                "additionalProperties": false
              }
            ]
          },
          "examples": {
            "priced": {
              "summary": "携带周期的价格试算",
              "value": {
                "code": 0,
                "msg": "",
                "data": {
                  "id": 11,
                  "name": "标准套餐",
                  "region_id": 1,
                  "node_group_id": 2,
                  "cname_domain": 1,
                  "traffic": 100,
                  "bandwidth": "10Mbps",
                  "connection": 1000,
                  "domain": 10,
                  "main_domain": 1,
                  "http_port": 2,
                  "stream_port": 0,
                  "custom_cc_rule": 1,
                  "websocket": 1,
                  "http3": 1,
                  "l2_state": 0,
                  "month_price": 1000,
                  "quarter_price": 2700,
                  "year_price": 10000,
                  "enable": 1,
                  "orgin_price": 1000,
                  "new_price": 900,
                  "err": null
                }
              }
            }
          },
          "example": {
            "code": 0,
            "msg": "",
            "data": {
              "id": 11,
              "name": "标准套餐",
              "region_id": 1,
              "node_group_id": 2,
              "cname_domain": 1,
              "traffic": 100,
              "bandwidth": "10Mbps",
              "connection": 1000,
              "domain": 10,
              "main_domain": 1,
              "http_port": 2,
              "stream_port": 0,
              "custom_cc_rule": 1,
              "websocket": 1,
              "http3": 1,
              "l2_state": 0,
              "month_price": 1000,
              "quarter_price": 2700,
              "year_price": 10000,
              "enable": 1,
              "orgin_price": 1000,
              "new_price": 900,
              "err": null
            }
          }
        }
      }
    }
  },
  "x-python-handler": "package.PackageAPI",
  "x-python-route-line": 423,
  "x-audience": "user",
  "x-auth": "user",
  "x-reviewed": true,
  "parameters": [
    {
      "name": "package_id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "example": 11
      },
      "description": "套餐 ID。"
    },
    {
      "name": "duration",
      "in": "query",
      "required": false,
      "description": "购买周期。传入后触发当前用户的价格试算。",
      "schema": {
        "type": "string",
        "enum": [
          "month",
          "quarter",
          "year"
        ],
        "example": "month"
      }
    },
    {
      "name": "coupon_code",
      "in": "query",
      "required": false,
      "description": "优惠码；仅在传入 `duration` 时用于价格试算。存在有效用户折扣时不会与优惠码叠加，原因通过响应中的 `err` 返回。",
      "schema": {
        "type": "string",
        "example": "REDACTED_COUPON"
      }
    }
  ],
  "x-itecdn-source-reviewed": true,
  "extensions": [
    {
      "key": "x-python-handler",
      "value": "package.PackageAPI"
    },
    {
      "key": "x-python-route-line",
      "value": 423
    },
    {
      "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/packages/{package_id}",
  "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": "获取一条套餐记录。普通用户只能读取启用套餐，管理员可读取停用套餐。传入 `duration` 时，服务端会按当前登录用户的有效折扣和可用优惠码试算该周期价格，并在返回数据中附加价格字段。",
      "type": "text/plain"
    },
    "url": {
      "path": [
        "v1",
        "packages",
        ":package_id"
      ],
      "host": [
        "{{baseUrl}}"
      ],
      "query": [
        {
          "disabled": false,
          "description": {
            "content": "购买周期。传入后触发当前用户的价格试算。",
            "type": "text/plain"
          },
          "key": "duration",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "优惠码；仅在传入 `duration` 时用于价格试算。存在有效用户折扣时不会与优惠码叠加，原因通过响应中的 `err` 返回。",
            "type": "text/plain"
          },
          "key": "coupon_code",
          "value": ""
        }
      ],
      "variable": [
        {
          "disabled": false,
          "description": {
            "content": "(Required) 套餐 ID。",
            "type": "text/plain"
          },
          "type": "any",
          "value": "",
          "key": "package_id"
        }
      ]
    },
    "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"
        }
      ]
    }
  }
}