From 9d8e3926ffbad54c158bf3dbb6e1b1ac1d1faa5b Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 17 Apr 2026 17:33:07 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E6=9B=B4=E6=96=B0=20OpenAPI=20?= =?UTF-8?q?=E6=96=87=E6=A1=A3=EF=BC=8C=E6=96=B0=E5=A2=9E=20realname-mode?= =?UTF-8?q?=20=E6=9B=B4=E6=96=B0=E6=8E=A5=E5=8F=A3=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- docs/admin-openapi.yaml | 139 ++++++++++++++++++++++++++++++++++++++++ pkg/openapi/handlers.go | 2 +- 2 files changed, 140 insertions(+), 1 deletion(-) diff --git a/docs/admin-openapi.yaml b/docs/admin-openapi.yaml index ac2755f..e304af5 100644 --- a/docs/admin-openapi.yaml +++ b/docs/admin-openapi.yaml @@ -711,6 +711,9 @@ components: real_name_status_name: description: 实名状态名称(中文) type: string + realname_policy: + description: 实名认证策略 (none:无需实名, before_order:先实名后充值/购买, after_order:先充值/购买后实名) + type: string sn: description: 设备序列号 type: string @@ -941,6 +944,9 @@ components: real_name_status: description: 实名状态(asset_type=card时有效):0未实名 1已实名 type: integer + realname_policy: + description: 实名认证策略 (none:无需实名, before_order:先实名后充值/购买, after_order:先充值/购买后实名) + type: string type: object DtoAssetRefreshRequest: properties: @@ -1092,6 +1098,9 @@ components: real_name_status: description: 实名状态:0未实名 1已实名 type: integer + realname_policy: + description: 实名认证策略 (none:无需实名, before_order:先实名后充值/购买, after_order:先充值/购买后实名) + type: string series_id: description: 套餐系列ID minimum: 0 @@ -1587,6 +1596,9 @@ components: real_name_status: description: 实名状态:0未实名 1已实名 type: integer + realname_policy: + description: 实名认证策略 (none:无需实名, before_order:先实名后充值/购买, after_order:先充值/购买后实名) + type: string slot_position: description: 插槽位置 type: integer @@ -3204,6 +3216,9 @@ components: msisdn: description: 接入号 type: string + realname_policy: + description: 实名认证策略 (none:无需实名, before_order:先实名后充值/购买, after_order:先充值/购买后实名) + type: string slot_position: description: 插槽位置 (1-4) type: integer @@ -3241,6 +3256,9 @@ components: real_name_status: description: 实名状态 (0:未实名, 1:已实名) type: integer + realname_policy: + description: 实名认证策略 (none:无需实名, before_order:先实名后充值/购买, after_order:先充值/购买后实名) + type: string slot_position: description: 插槽位置 type: integer @@ -3448,6 +3466,9 @@ components: description: 任务ID minimum: 0 type: integer + realname_policy: + description: 实名认证策略 (none:无需实名, before_order:先实名后充值/购买, after_order:先充值/购买后实名) + type: string skip_count: description: 跳过数 type: integer @@ -3514,6 +3535,9 @@ components: description: 任务ID minimum: 0 type: integer + realname_policy: + description: 实名认证策略 (none:无需实名, before_order:先实名后充值/购买, after_order:先充值/购买后实名) + type: string skip_count: description: 跳过数 type: integer @@ -3759,6 +3783,9 @@ components: online_status: description: 在线状态:0未知 1在线 2离线 type: integer + realname_policy: + description: 实名认证策略 (none:无需实名, before_order:先实名后充值/购买, after_order:先充值/购买后实名) + type: string series_id: description: 套餐系列ID minimum: 0 @@ -4308,6 +4335,9 @@ components: maxLength: 500 minLength: 1 type: string + realname_policy: + description: 实名认证策略 (none:无需实名, before_order:先实名后充值/购买, after_order:先充值/购买后实名),默认 none + type: string required: - file_key type: object @@ -4342,6 +4372,9 @@ components: maxLength: 500 minLength: 1 type: string + realname_policy: + description: 实名认证策略 (none:无需实名, before_order:先实名后充值/购买, after_order:先充值/购买后实名),默认 none + type: string required: - carrier_id - file_key @@ -4420,6 +4453,9 @@ components: description: 任务ID minimum: 0 type: integer + realname_policy: + description: 实名认证策略 (none:无需实名, before_order:先实名后充值/购买, after_order:先充值/购买后实名) + type: string skip_count: description: 跳过数 type: integer @@ -4490,6 +4526,9 @@ components: description: 任务ID minimum: 0 type: integer + realname_policy: + description: 实名认证策略 (none:无需实名, before_order:先实名后充值/购买, after_order:先充值/购买后实名) + type: string skip_count: description: 跳过数 type: integer @@ -6819,6 +6858,9 @@ components: real_name_status_name: description: 实名状态名称(中文) type: string + realname_policy: + description: 实名认证策略 (none:无需实名, before_order:先实名后充值/购买, after_order:先充值/购买后实名) + type: string series_id: description: 套餐系列ID minimum: 0 @@ -6975,6 +7017,31 @@ components: description: 更新后的轮询状态 (true:已启用, false:已禁用) type: boolean type: object + DtoUpdateAssetRealnamePolicyRequest: + properties: + realname_policy: + description: 实名认证策略 (none:无需实名, before_order:先实名后充值/购买, after_order:先充值/购买后实名) + enum: + - none + - before_order + - after_order + type: string + required: + - realname_policy + type: object + DtoUpdateAssetRealnamePolicyResponse: + properties: + asset_id: + description: 资产ID + minimum: 0 + type: integer + asset_type: + description: 资产类型 (card:IoT卡, device:设备) + type: string + realname_policy: + description: 更新后的实名认证策略 (none:无需实名, before_order:先实名后充值/购买, after_order:先充值/购买后实名) + type: string + type: object DtoUpdateAuthorizationRemarkReq: properties: remark: @@ -9618,6 +9685,78 @@ paths: summary: 更新资产轮询状态 tags: - 资产管理 + /api/admin/assets/{identifier}/realname-mode: + patch: + description: 更新指定资产(IoT卡或设备)的实名认证策略,支持 none/before_order/after_order 三种模式。 + parameters: + - description: 资产标识符(ICCID 或 VirtualNo) + in: path + name: identifier + required: true + schema: + description: 资产标识符(ICCID 或 VirtualNo) + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/DtoUpdateAssetRealnamePolicyRequest' + responses: + "200": + content: + application/json: + schema: + properties: + code: + description: 响应码 + example: 0 + type: integer + data: + $ref: '#/components/schemas/DtoUpdateAssetRealnamePolicyResponse' + msg: + description: 响应消息 + example: success + type: string + timestamp: + description: 时间戳 + format: date-time + type: string + required: + - code + - msg + - data + - timestamp + type: object + description: 成功 + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + description: 请求参数错误 + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + description: 未认证或认证已过期 + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + description: 无权访问 + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + description: 服务器内部错误 + security: + - BearerAuth: [] + summary: 更新资产实名认证策略 + tags: + - 资产管理 /api/admin/assets/{identifier}/realtime-status: get: description: 查询资产实时状态。卡类型:读取 DB/Redis 持久化状态;设备类型:实时调用 Gateway sync-info 接口获取最新数据,Gateway 失败不阻断主流程(DeviceRealtime.gateway_msg 返回失败原因)。 diff --git a/pkg/openapi/handlers.go b/pkg/openapi/handlers.go index 900e645..305a7b9 100644 --- a/pkg/openapi/handlers.go +++ b/pkg/openapi/handlers.go @@ -56,7 +56,7 @@ func BuildDocHandlers() *bootstrap.Handlers { PollingAlert: admin.NewPollingAlertHandler(nil), PollingCleanup: admin.NewPollingCleanupHandler(nil), PollingManualTrigger: admin.NewPollingManualTriggerHandler(nil), - Asset: admin.NewAssetHandler(nil, nil, nil, nil), + Asset: admin.NewAssetHandler(nil, nil, nil, nil, nil), AssetLifecycle: admin.NewAssetLifecycleHandler(nil), AssetWallet: admin.NewAssetWalletHandler(nil), WechatConfig: admin.NewWechatConfigHandler(nil),