fix: 资产钱包自动创建机制 — 修复C端购买时钱包不存在报错
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m8s

- client_order: 新增 getOrCreateWallet 兜底,钱包不存在时自动创建
- device_import: 设备导入事务内同步创建设备钱包
- iot_card_import: IoT卡批量导入后批量创建卡钱包
- queue/handler: 传递 AssetWalletStore 给两个导入 handler
- migration 000098: 为存量IoT卡和设备补建资产钱包
This commit is contained in:
2026-03-30 11:37:41 +08:00
parent 40809d11c5
commit f339fb1987
36 changed files with 1811 additions and 26 deletions

View File

@@ -398,6 +398,18 @@ components:
description: 失败原因
type: string
type: object
DtoApproveRefundRequest:
properties:
approved_refund_amount:
description: 审批实际退款金额(分),不填则使用申请金额
minimum: 1
nullable: true
type: integer
remark:
description: 审批备注
maxLength: 500
type: string
type: object
DtoApproveWithdrawalReq:
properties:
account_name:
@@ -1698,7 +1710,7 @@ components:
description: 支付方式
type: string
payment_status:
description: 支付状态 (0:待支付, 1:已支付, 2:已取消)
description: 支付状态 (1:待支付, 2:已支付, 3:已取消, 4:已退款)
type: integer
total_amount:
description: 订单总金额(分)
@@ -1717,7 +1729,7 @@ components:
description: 订单号
type: string
payment_status:
description: 支付状态 (0:待支付, 1:已支付, 2:已取消)
description: 支付状态 (1:待支付, 2:已支付, 3:已取消, 4:已退款)
type: integer
total_amount:
description: 订单总金额(分)
@@ -1742,7 +1754,7 @@ components:
nullable: true
type: array
payment_status:
description: 支付状态 (0:待支付, 1:已支付, 2:已取消)
description: 支付状态 (1:待支付, 2:已支付, 3:已取消, 4:已退款)
type: integer
total_amount:
description: 订单总金额(分)
@@ -2009,6 +2021,23 @@ components:
- recipient_phone
- recipient_address
type: object
DtoCommissionRecordResolveRequest:
properties:
action:
description: 操作 (release:入账, invalidate:作废)
type: string
amount:
description: 佣金金额release 时必填
minimum: 1
nullable: true
type: integer
remark:
description: 处理备注
maxLength: 500
type: string
required:
- action
type: object
DtoCommissionStatsResponse:
properties:
cost_diff_amount:
@@ -2548,6 +2577,34 @@ components:
- config_name
- priority
type: object
DtoCreateRefundRequest:
properties:
actual_received_amount:
description: 实收金额(分)
minimum: 1
type: integer
order_id:
description: 关联订单ID
minimum: 0
type: integer
package_usage_id:
description: 关联套餐使用记录ID可选
minimum: 0
nullable: true
type: integer
refund_reason:
description: 退款原因
maxLength: 1000
type: string
requested_refund_amount:
description: 申请退款金额(分)
minimum: 1
type: integer
required:
- order_id
- actual_received_amount
- requested_refund_amount
type: object
DtoCreateRoleRequest:
properties:
role_desc:
@@ -3072,6 +3129,10 @@ components:
description: 本次开机下载流量(字节)
nullable: true
type: string
gateway_msg:
description: Gateway 上游消息(成功时为 null失败时为错误信息
nullable: true
type: string
imei:
description: IMEI号
nullable: true
@@ -3354,6 +3415,10 @@ components:
description: 本次开机下载流量(字节)
nullable: true
type: string
gateway_msg:
description: Gateway 上游消息(成功时为 null失败时为错误信息
nullable: true
type: string
imei:
description: Gateway返回的IMEI号
nullable: true
@@ -5696,6 +5761,107 @@ components:
expires_in:
type: integer
type: object
DtoRefundListResponse:
properties:
items:
description: 退款申请列表
items:
$ref: '#/components/schemas/DtoRefundResponse'
nullable: true
type: array
page:
description: 当前页码
type: integer
size:
description: 每页数量
type: integer
total:
description: 总记录数
type: integer
type: object
DtoRefundResponse:
properties:
actual_received_amount:
description: 实收金额(分)
type: integer
approved_refund_amount:
description: 审批实际退款金额(分)
nullable: true
type: integer
asset_reset:
description: 资产是否已重置
type: boolean
commission_deducted:
description: 佣金是否已回扣
type: boolean
created_at:
description: 创建时间
type: string
creator:
description: 创建人ID
minimum: 0
type: integer
id:
description: 退款申请ID
minimum: 0
type: integer
order_id:
description: 关联订单ID
minimum: 0
type: integer
package_usage_id:
description: 关联套餐使用记录ID
minimum: 0
nullable: true
type: integer
processed_at:
description: 审批时间
type: string
processor_id:
description: 审批人ID
minimum: 0
nullable: true
type: integer
refund_no:
description: 退款单号
type: string
refund_reason:
description: 退款原因
type: string
reject_reason:
description: 拒绝原因
type: string
remark:
description: 审批备注
type: string
requested_refund_amount:
description: 申请退款金额(分)
type: integer
shop_id:
description: 店铺ID
minimum: 0
nullable: true
type: integer
status:
description: 状态 (1:待审批, 2:已通过, 3:已拒绝, 4:已退回)
type: integer
updated_at:
description: 更新时间
type: string
updater:
description: 更新人ID
minimum: 0
type: integer
type: object
DtoRejectRefundRequest:
properties:
reject_reason:
description: 拒绝原因(必填)
maxLength: 500
type: string
required:
- reject_reason
type: object
DtoRejectWithdrawalReq:
properties:
remark:
@@ -5711,6 +5877,31 @@ components:
description: 任务类型
type: string
type: object
DtoResubmitRefundRequest:
properties:
actual_received_amount:
description: 实收金额(分)
minimum: 1
nullable: true
type: integer
refund_reason:
description: 退款原因
maxLength: 1000
nullable: true
type: string
requested_refund_amount:
description: 申请退款金额(分)
minimum: 1
nullable: true
type: integer
type: object
DtoReturnRefundRequest:
properties:
remark:
description: 退回备注
maxLength: 500
type: string
type: object
DtoRolePageResult:
properties:
items:
@@ -10208,6 +10399,52 @@ paths:
summary: 更新运营商状态
tags:
- 运营商管理
/api/admin/commission-records/{id}/resolve:
post:
parameters:
- description: 佣金记录ID
in: path
name: id
required: true
schema:
description: 佣金记录ID
minimum: 0
type: integer
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/DtoCommissionRecordResolveRequest'
responses:
"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/commission/withdrawal-requests:
get:
parameters:
@@ -18283,6 +18520,418 @@ paths:
summary: 获取轮询任务统计
tags:
- 轮询管理-监控
/api/admin/refunds/:
get:
parameters:
- description: 页码默认1
in: query
name: page
schema:
description: 页码默认1
minimum: 1
type: integer
- description: 每页数量默认20最大100
in: query
name: page_size
schema:
description: 每页数量默认20最大100
maximum: 100
minimum: 1
type: integer
- description: 状态 (1:待审批, 2:已通过, 3:已拒绝, 4:已退回)
in: query
name: status
schema:
description: 状态 (1:待审批, 2:已通过, 3:已拒绝, 4:已退回)
maximum: 4
minimum: 1
nullable: true
type: integer
- description: 关联订单ID
in: query
name: order_id
schema:
description: 关联订单ID
minimum: 0
nullable: true
type: integer
- description: 店铺ID
in: query
name: shop_id
schema:
description: 店铺ID
minimum: 0
nullable: true
type: integer
responses:
"200":
content:
application/json:
schema:
properties:
code:
description: 响应码
example: 0
type: integer
data:
$ref: '#/components/schemas/DtoRefundListResponse'
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:
- 退款管理
post:
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/DtoCreateRefundRequest'
responses:
"200":
content:
application/json:
schema:
properties:
code:
description: 响应码
example: 0
type: integer
data:
$ref: '#/components/schemas/DtoRefundResponse'
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/refunds/{id}:
get:
parameters:
- description: 退款申请ID
in: path
name: id
required: true
schema:
description: 退款申请ID
minimum: 0
type: integer
responses:
"200":
content:
application/json:
schema:
properties:
code:
description: 响应码
example: 0
type: integer
data:
$ref: '#/components/schemas/DtoRefundResponse'
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/refunds/{id}/approve:
post:
parameters:
- description: 退款申请ID
in: path
name: id
required: true
schema:
description: 退款申请ID
minimum: 0
type: integer
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/DtoApproveRefundRequest'
responses:
"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/refunds/{id}/reject:
post:
parameters:
- description: 退款申请ID
in: path
name: id
required: true
schema:
description: 退款申请ID
minimum: 0
type: integer
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/DtoRejectRefundRequest'
responses:
"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/refunds/{id}/resubmit:
post:
parameters:
- description: 退款申请ID
in: path
name: id
required: true
schema:
description: 退款申请ID
minimum: 0
type: integer
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/DtoResubmitRefundRequest'
responses:
"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/refunds/{id}/return:
post:
parameters:
- description: 退款申请ID
in: path
name: id
required: true
schema:
description: 退款申请ID
minimum: 0
type: integer
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/DtoReturnRefundRequest'
responses:
"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/roles:
get:
parameters:
@@ -22103,13 +22752,13 @@ paths:
maxLength: 50
minLength: 1
type: string
- description: 支付状态 (0:待支付, 1:已支付, 2:已取消)
- description: 支付状态 (1:待支付, 2:已支付, 3:已取消, 4:已退款)
in: query
name: payment_status
schema:
description: 支付状态 (0:待支付, 1:已支付, 2:已取消)
maximum: 2
minimum: 0
description: 支付状态 (1:待支付, 2:已支付, 3:已取消, 4:已退款)
maximum: 4
minimum: 1
nullable: true
type: integer
- description: 页码