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

查询单项主控配置

GET/v1/configs/{config_id}

按作用域、类型和名称组成的复合标识读取一条主控配置。登录用户只可读取 site 类型的 clean_url、clean_dir、ip-unlock-max-limit、ip-unlock-max-per-limit、pre_cache_url,以及 system 类型的 recharge;其余标识要求管理员身份。普通用户读取 recharge 时不会取得支付密钥,仅取得默认支付方式和转账说明。

身份认证

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

请求参数

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

复合配置标识,格式为 {scope_name}-{scope_id}-{type}-{name}。服务端以前三个连字符切分,因此 name 可以包含连字符,例如 global-0-system-recharge。

完整参数定义
{
  "name": "config_id",
  "in": "path",
  "required": true,
  "schema": {
    "type": "string"
  },
  "description": "复合配置标识,格式为 {scope_name}-{scope_id}-{type}-{name}。服务端以前三个连字符切分,因此 name 可以包含连字符,例如 global-0-system-recharge。",
  "example": "global-0-system-recharge"
}

响应

HTTP 200

业务结果使用 HTTP 200 返回。记录不存在时 data 为 null;普通用户读取充值配置时返回脱敏后的支付配置,权限不足或认证失效时返回业务错误码。

application/json

oneOf

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

成功状态码,固定为 0。

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

详情读取成功时固定为 null。

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

按配置名称与当前账户权限返回的配置记录或脱敏支付配置。

展开字段结构

按配置名称与当前账户权限返回的配置记录或脱敏支付配置。

oneOf · 1 · object

管理员读取时返回的完整配置记录及关联任务信息。

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

配置名称。

valuestring必填

数据库保存的原始配置值;JSON 配置仍以 JSON 文本字符串返回。

typestring必填

配置类型。

scope_idinteger (int64)必填

配置作用域实体 ID。

约束 / 默认值 / 示例
{
  "format": "int64"
}
scope_namestring必填

配置作用域名称。

create_atstring必填

配置创建时间。

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

配置最后更新时间。

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

配置启用状态:1 启用,0 禁用。

约束 / 默认值 / 示例
{
  "enum": [
    0,
    1
  ]
}
task_idinteger (int64)必填

最近一次配置同步任务 ID;没有同步任务时为 null。

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

关联同步任务的当前状态;无任务时为 null。

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

关联同步任务的返回内容;无任务时为 null。

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

关联同步任务类型;无任务时为 null。

约束 / 默认值 / 示例
{
  "nullable": true
}
oneOf · 2 · object

普通用户读取 system-recharge 时返回的脱敏支付配置。

字段类型必填说明与约束
default-paystring必填

默认支付渠道标识。

transferobject必填

转账支付的公开配置。

约束 / 默认值 / 示例
{
  "required": [
    "state",
    "data"
  ],
  "additionalProperties": false
}
展开字段结构

转账支付的公开配置。

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

转账支付启用状态。

datastring必填

转账支付说明或数据。

wxpayobject必填

脱敏后的微信支付配置。

约束 / 默认值 / 示例
{
  "required": [
    "state",
    "subtype"
  ],
  "additionalProperties": false
}
展开字段结构

脱敏后的微信支付配置。

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

微信支付启用状态。

subtypestring必填

微信支付子类型;未配置时为空字符串。

alipayobject必填

脱敏后的支付宝配置。

约束 / 默认值 / 示例
{
  "required": [
    "state",
    "subtype"
  ],
  "additionalProperties": false
}
展开字段结构

脱敏后的支付宝配置。

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

支付宝启用状态。

subtypestring必填

支付宝支付子类型;未配置时为空字符串。

oneOf · 3 · object

未找到对应配置记录时返回 null。

oneOf · 2 · object
字段类型必填说明与约束
codestring必填

config-273 表示需要管理员权限;login_required 表示认证无效。

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

权限或认证失败原因。

datastring必填

业务错误时固定为空字符串。

约束 / 默认值 / 示例
{
  "enum": [
    ""
  ]
}
完整 Schema
{
  "oneOf": [
    {
      "type": "object",
      "required": [
        "code",
        "msg",
        "data"
      ],
      "properties": {
        "code": {
          "type": "integer",
          "enum": [
            0
          ],
          "description": "成功状态码,固定为 0。"
        },
        "msg": {
          "type": "string",
          "nullable": true,
          "description": "详情读取成功时固定为 null。"
        },
        "data": {
          "description": "按配置名称与当前账户权限返回的配置记录或脱敏支付配置。",
          "oneOf": [
            {
              "type": "object",
              "required": [
                "name",
                "value",
                "type",
                "scope_id",
                "scope_name",
                "create_at",
                "update_at",
                "enable",
                "task_id",
                "state",
                "ret",
                "task_type"
              ],
              "properties": {
                "name": {
                  "type": "string",
                  "description": "配置名称。"
                },
                "value": {
                  "type": "string",
                  "description": "数据库保存的原始配置值;JSON 配置仍以 JSON 文本字符串返回。"
                },
                "type": {
                  "type": "string",
                  "description": "配置类型。"
                },
                "scope_id": {
                  "type": "integer",
                  "format": "int64",
                  "description": "配置作用域实体 ID。"
                },
                "scope_name": {
                  "type": "string",
                  "description": "配置作用域名称。"
                },
                "create_at": {
                  "type": "string",
                  "nullable": true,
                  "description": "配置创建时间。"
                },
                "update_at": {
                  "type": "string",
                  "nullable": true,
                  "description": "配置最后更新时间。"
                },
                "enable": {
                  "type": "integer",
                  "enum": [
                    0,
                    1
                  ],
                  "description": "配置启用状态:1 启用,0 禁用。"
                },
                "task_id": {
                  "type": "integer",
                  "format": "int64",
                  "nullable": true,
                  "description": "最近一次配置同步任务 ID;没有同步任务时为 null。"
                },
                "state": {
                  "type": "string",
                  "nullable": true,
                  "description": "关联同步任务的当前状态;无任务时为 null。"
                },
                "ret": {
                  "type": "string",
                  "nullable": true,
                  "description": "关联同步任务的返回内容;无任务时为 null。"
                },
                "task_type": {
                  "type": "string",
                  "nullable": true,
                  "description": "关联同步任务类型;无任务时为 null。"
                }
              },
              "additionalProperties": false,
              "description": "管理员读取时返回的完整配置记录及关联任务信息。"
            },
            {
              "type": "object",
              "required": [
                "default-pay",
                "transfer",
                "wxpay",
                "alipay"
              ],
              "properties": {
                "default-pay": {
                  "type": "string",
                  "description": "默认支付渠道标识。"
                },
                "transfer": {
                  "type": "object",
                  "required": [
                    "state",
                    "data"
                  ],
                  "properties": {
                    "state": {
                      "type": "boolean",
                      "description": "转账支付启用状态。"
                    },
                    "data": {
                      "type": "string",
                      "description": "转账支付说明或数据。"
                    }
                  },
                  "additionalProperties": false,
                  "description": "转账支付的公开配置。"
                },
                "wxpay": {
                  "type": "object",
                  "required": [
                    "state",
                    "subtype"
                  ],
                  "properties": {
                    "state": {
                      "type": "boolean",
                      "description": "微信支付启用状态。"
                    },
                    "subtype": {
                      "type": "string",
                      "description": "微信支付子类型;未配置时为空字符串。"
                    }
                  },
                  "additionalProperties": false,
                  "description": "脱敏后的微信支付配置。"
                },
                "alipay": {
                  "type": "object",
                  "required": [
                    "state",
                    "subtype"
                  ],
                  "properties": {
                    "state": {
                      "type": "boolean",
                      "description": "支付宝启用状态。"
                    },
                    "subtype": {
                      "type": "string",
                      "description": "支付宝支付子类型;未配置时为空字符串。"
                    }
                  },
                  "additionalProperties": false,
                  "description": "脱敏后的支付宝配置。"
                }
              },
              "additionalProperties": false,
              "description": "普通用户读取 system-recharge 时返回的脱敏支付配置。"
            },
            {
              "type": "object",
              "nullable": true,
              "additionalProperties": false,
              "description": "未找到对应配置记录时返回 null。"
            }
          ]
        }
      },
      "additionalProperties": false
    },
    {
      "type": "object",
      "required": [
        "code",
        "msg",
        "data"
      ],
      "properties": {
        "code": {
          "type": "string",
          "enum": [
            "config-273",
            "login_required"
          ],
          "description": "config-273 表示需要管理员权限;login_required 表示认证无效。"
        },
        "msg": {
          "type": "string",
          "description": "权限或认证失败原因。"
        },
        "data": {
          "type": "string",
          "enum": [
            ""
          ],
          "description": "业务错误时固定为空字符串。"
        }
      },
      "additionalProperties": false
    }
  ]
}

示例

{
  "code": 0,
  "msg": null,
  "data": {
    "default-pay": "transfer",
    "transfer": {
      "state": true,
      "data": "请按客服指引完成转账"
    },
    "wxpay": {
      "state": false,
      "subtype": ""
    },
    "alipay": {
      "state": false,
      "subtype": ""
    }
  }
}

cURL 示例

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

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

查看完整接口 JSON