feat: 移除“租户管理员为用户充值 / 每租户一套余额”能力:余额统一为全局用户余额

This commit is contained in:
2025-12-23 10:59:59 +08:00
parent dd7bcdfb98
commit a80c9b759b
39 changed files with 566 additions and 1869 deletions

View File

@@ -967,7 +967,7 @@ const docTemplate = `{
},
{
"type": "string",
"description": "BizRefType 按业务引用类型过滤(可选)。\n约定当前业务写入为 \"order\";未来可扩展为 refund/topup 等。",
"description": "BizRefType 按业务引用类型过滤(可选)。\n约定当前业务写入为 \"order\";未来可扩展为 refund 等。",
"name": "biz_ref_type",
"in": "query"
},
@@ -991,7 +991,7 @@ const docTemplate = `{
},
{
"type": "integer",
"description": "OperatorUserID 按操作者用户ID过滤可选。\n典型场景后台检索“某个管理员发起的充值/退款”等敏感操作流水。",
"description": "OperatorUserID 按操作者用户ID过滤可选。\n典型场景后台检索“某个管理员发起的退款/调账”等敏感操作流水。",
"name": "operator_user_id",
"in": "query"
},
@@ -1009,7 +1009,6 @@ const docTemplate = `{
},
{
"enum": [
"credit_topup",
"debit_purchase",
"credit_refund",
"freeze",
@@ -1018,7 +1017,6 @@ const docTemplate = `{
],
"type": "string",
"x-enum-varnames": [
"TenantLedgerTypeCreditTopup",
"TenantLedgerTypeDebitPurchase",
"TenantLedgerTypeCreditRefund",
"TenantLedgerTypeFreeze",
@@ -1452,15 +1450,13 @@ const docTemplate = `{
},
{
"enum": [
"content_purchase",
"topup"
"content_purchase"
],
"type": "string",
"x-enum-varnames": [
"OrderTypeContentPurchase",
"OrderTypeTopup"
"OrderTypeContentPurchase"
],
"description": "Type 订单类型可选content_purchase/topup 等。",
"description": "Type 订单类型可选content_purchase 等。",
"name": "type",
"in": "query"
},
@@ -1615,15 +1611,13 @@ const docTemplate = `{
},
{
"enum": [
"content_purchase",
"topup"
"content_purchase"
],
"type": "string",
"x-enum-varnames": [
"OrderTypeContentPurchase",
"OrderTypeTopup"
"OrderTypeContentPurchase"
],
"description": "Type 订单类型可选content_purchase/topup 等。",
"description": "Type 订单类型可选content_purchase 等。",
"name": "type",
"in": "query"
},
@@ -1691,6 +1685,7 @@ const docTemplate = `{
},
"/t/{tenantCode}/v1/admin/orders/{orderID}/refund": {
"post": {
"description": "该接口只负责将订单从 paid 推进到 refunding并提交异步退款任务退款入账与权益回收由 worker 异步完成。\n重复请求幂等订单处于 refunding/refunded 时会返回当前订单状态,不会重复入账/重复回收权益。",
"consumes": [
"application/json"
],
@@ -1834,46 +1829,6 @@ const docTemplate = `{
}
}
},
"/t/{tenantCode}/v1/admin/users/topup/batch": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Tenant"
],
"summary": "批量为租户成员充值(租户管理)",
"parameters": [
{
"type": "string",
"description": "Tenant Code",
"name": "tenantCode",
"in": "path",
"required": true
},
{
"description": "Form",
"name": "form",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.AdminBatchTopupForm"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/dto.AdminBatchTopupResponse"
}
}
}
}
},
"/t/{tenantCode}/v1/admin/users/{userID}": {
"delete": {
"consumes": [
@@ -2000,54 +1955,6 @@ const docTemplate = `{
}
}
},
"/t/{tenantCode}/v1/admin/users/{userID}/topup": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Tenant"
],
"summary": "为租户成员充值(租户管理)",
"parameters": [
{
"type": "string",
"description": "Tenant Code",
"name": "tenantCode",
"in": "path",
"required": true
},
{
"type": "integer",
"format": "int64",
"description": "UserID",
"name": "userID",
"in": "path",
"required": true
},
{
"description": "Form",
"name": "form",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.AdminTopupForm"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.Order"
}
}
}
}
},
"/t/{tenantCode}/v1/contents": {
"get": {
"consumes": [
@@ -2945,12 +2852,10 @@ const docTemplate = `{
"consts.OrderType": {
"type": "string",
"enum": [
"content_purchase",
"topup"
"content_purchase"
],
"x-enum-varnames": [
"OrderTypeContentPurchase",
"OrderTypeTopup"
"OrderTypeContentPurchase"
]
},
"consts.Role": {
@@ -2993,7 +2898,6 @@ const docTemplate = `{
"consts.TenantLedgerType": {
"type": "string",
"enum": [
"credit_topup",
"debit_purchase",
"credit_refund",
"freeze",
@@ -3001,7 +2905,6 @@ const docTemplate = `{
"adjustment"
],
"x-enum-varnames": [
"TenantLedgerTypeCreditTopup",
"TenantLedgerTypeDebitPurchase",
"TenantLedgerTypeCreditRefund",
"TenantLedgerTypeFreeze",
@@ -3046,100 +2949,6 @@ const docTemplate = `{
"UserStatusBanned"
]
},
"dto.AdminBatchTopupForm": {
"type": "object",
"properties": {
"batch_idempotency_key": {
"description": "BatchIdempotencyKey 批次幂等键:必须填写;用于重试同一批次时保证不会重复入账。",
"type": "string"
},
"items": {
"description": "Items 充值明细列表:至少 1 条;单批次条数在业务侧限制(避免拖垮系统)。",
"type": "array",
"items": {
"$ref": "#/definitions/dto.AdminBatchTopupItem"
}
}
}
},
"dto.AdminBatchTopupItem": {
"type": "object",
"properties": {
"amount": {
"description": "Amount 充值金额:单位分;必须 \u003e 0。",
"type": "integer"
},
"idempotency_key": {
"description": "IdempotencyKey 幂等键(可选):为空时后端会用 batch_idempotency_key 派生生成;\n建议前端/调用方提供稳定值,便于重试时保持结果一致。",
"type": "string"
},
"reason": {
"description": "Reason 充值原因(可选):用于审计与追溯。",
"type": "string"
},
"user_id": {
"description": "UserID 目标用户ID必须属于当前租户否则该条充值失败。",
"type": "integer"
}
}
},
"dto.AdminBatchTopupResponse": {
"type": "object",
"properties": {
"failed": {
"description": "Failed 失败条数。",
"type": "integer"
},
"items": {
"description": "Items 明细结果列表:与请求 items 顺序一致,便于前端逐条展示。",
"type": "array",
"items": {
"$ref": "#/definitions/dto.AdminBatchTopupResultItem"
}
},
"success": {
"description": "Success 成功条数。",
"type": "integer"
},
"total": {
"description": "Total 总条数:等于 items 长度。",
"type": "integer"
}
}
},
"dto.AdminBatchTopupResultItem": {
"type": "object",
"properties": {
"amount": {
"description": "Amount 充值金额(单位分)。",
"type": "integer"
},
"error_code": {
"description": "ErrorCode 错误码:失败时返回;成功时为 0。",
"type": "integer"
},
"error_message": {
"description": "ErrorMessage 错误信息:失败时返回;成功时为空。",
"type": "string"
},
"idempotency_key": {
"description": "IdempotencyKey 实际使用的幂等键:可能为客户端传入,也可能为后端派生生成。",
"type": "string"
},
"ok": {
"description": "OK 是否成功true 表示该条充值已成功入账或命中幂等成功结果。",
"type": "boolean"
},
"order_id": {
"description": "OrderID 生成的订单ID成功时返回失败时为 0。",
"type": "integer"
},
"user_id": {
"description": "UserID 目标用户ID。",
"type": "integer"
}
}
},
"dto.AdminLedgerItem": {
"type": "object",
"properties": {
@@ -3383,23 +3192,6 @@ const docTemplate = `{
}
}
},
"dto.AdminTopupForm": {
"type": "object",
"properties": {
"amount": {
"description": "Amount is the topup amount in cents (CNY 分); must be \u003e 0.",
"type": "integer"
},
"idempotency_key": {
"description": "IdempotencyKey ensures the topup request is processed at most once.",
"type": "string"
},
"reason": {
"description": "Reason is the human-readable topup reason used for audit.",
"type": "string"
}
}
},
"dto.ContentAssetAttachForm": {
"type": "object",
"properties": {
@@ -3859,6 +3651,14 @@ const docTemplate = `{
"dto.UserItem": {
"type": "object",
"properties": {
"balance": {
"description": "全局可用余额:分/最小货币单位;用户在所有已加入租户内共享该余额;默认 0",
"type": "integer"
},
"balance_frozen": {
"description": "全局冻结余额:分/最小货币单位;用于下单冻结等;默认 0",
"type": "integer"
},
"created_at": {
"type": "string"
},
@@ -4336,7 +4136,7 @@ const docTemplate = `{
"type": "integer"
},
"type": {
"description": "订单类型content_purchase购买内容/topup充值等;当前默认 content_purchase",
"description": "订单类型content_purchase购买内容当前默认 content_purchase",
"allOf": [
{
"$ref": "#/definitions/consts.OrderType"
@@ -4582,7 +4382,7 @@ const docTemplate = `{
"type": "integer"
},
"biz_ref_type": {
"description": "业务引用类型order/refund/topup/etc与 biz_ref_id 组成可选的结构化幂等/追溯键",
"description": "业务引用类型order/refund/etc与 biz_ref_id 组成可选的结构化幂等/追溯键",
"type": "string"
},
"created_at": {
@@ -4625,7 +4425,7 @@ const docTemplate = `{
"type": "integer"
},
"type": {
"description": "流水类型:credit_topup/debit_purchase/credit_refund/freeze/unfreeze/adjustment不同类型决定余额/冻结余额的变更方向",
"description": "流水类型debit_purchase/credit_refund/freeze/unfreeze/adjustment不同类型决定余额/冻结余额的变更方向",
"allOf": [
{
"$ref": "#/definitions/consts.TenantLedgerType"
@@ -4645,13 +4445,6 @@ const docTemplate = `{
"models.TenantUser": {
"type": "object",
"properties": {
"balance": {
"type": "integer"
},
"balance_frozen": {
"description": "冻结余额:分/最小货币单位;下单冻结时从可用余额转入,最终扣款或回滚时转出;默认 0",
"type": "integer"
},
"created_at": {
"type": "string"
},
@@ -4681,6 +4474,14 @@ const docTemplate = `{
"models.User": {
"type": "object",
"properties": {
"balance": {
"description": "全局可用余额:分/最小货币单位;用户在所有已加入租户内共享该余额;默认 0",
"type": "integer"
},
"balance_frozen": {
"description": "全局冻结余额:分/最小货币单位;用于下单冻结等;默认 0",
"type": "integer"
},
"created_at": {
"type": "string"
},

View File

@@ -961,7 +961,7 @@
},
{
"type": "string",
"description": "BizRefType 按业务引用类型过滤(可选)。\n约定当前业务写入为 \"order\";未来可扩展为 refund/topup 等。",
"description": "BizRefType 按业务引用类型过滤(可选)。\n约定当前业务写入为 \"order\";未来可扩展为 refund 等。",
"name": "biz_ref_type",
"in": "query"
},
@@ -985,7 +985,7 @@
},
{
"type": "integer",
"description": "OperatorUserID 按操作者用户ID过滤可选。\n典型场景后台检索“某个管理员发起的充值/退款”等敏感操作流水。",
"description": "OperatorUserID 按操作者用户ID过滤可选。\n典型场景后台检索“某个管理员发起的退款/调账”等敏感操作流水。",
"name": "operator_user_id",
"in": "query"
},
@@ -1003,7 +1003,6 @@
},
{
"enum": [
"credit_topup",
"debit_purchase",
"credit_refund",
"freeze",
@@ -1012,7 +1011,6 @@
],
"type": "string",
"x-enum-varnames": [
"TenantLedgerTypeCreditTopup",
"TenantLedgerTypeDebitPurchase",
"TenantLedgerTypeCreditRefund",
"TenantLedgerTypeFreeze",
@@ -1446,15 +1444,13 @@
},
{
"enum": [
"content_purchase",
"topup"
"content_purchase"
],
"type": "string",
"x-enum-varnames": [
"OrderTypeContentPurchase",
"OrderTypeTopup"
"OrderTypeContentPurchase"
],
"description": "Type 订单类型可选content_purchase/topup 等。",
"description": "Type 订单类型可选content_purchase 等。",
"name": "type",
"in": "query"
},
@@ -1609,15 +1605,13 @@
},
{
"enum": [
"content_purchase",
"topup"
"content_purchase"
],
"type": "string",
"x-enum-varnames": [
"OrderTypeContentPurchase",
"OrderTypeTopup"
"OrderTypeContentPurchase"
],
"description": "Type 订单类型可选content_purchase/topup 等。",
"description": "Type 订单类型可选content_purchase 等。",
"name": "type",
"in": "query"
},
@@ -1685,6 +1679,7 @@
},
"/t/{tenantCode}/v1/admin/orders/{orderID}/refund": {
"post": {
"description": "该接口只负责将订单从 paid 推进到 refunding并提交异步退款任务退款入账与权益回收由 worker 异步完成。\n重复请求幂等订单处于 refunding/refunded 时会返回当前订单状态,不会重复入账/重复回收权益。",
"consumes": [
"application/json"
],
@@ -1828,46 +1823,6 @@
}
}
},
"/t/{tenantCode}/v1/admin/users/topup/batch": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Tenant"
],
"summary": "批量为租户成员充值(租户管理)",
"parameters": [
{
"type": "string",
"description": "Tenant Code",
"name": "tenantCode",
"in": "path",
"required": true
},
{
"description": "Form",
"name": "form",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.AdminBatchTopupForm"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/dto.AdminBatchTopupResponse"
}
}
}
}
},
"/t/{tenantCode}/v1/admin/users/{userID}": {
"delete": {
"consumes": [
@@ -1994,54 +1949,6 @@
}
}
},
"/t/{tenantCode}/v1/admin/users/{userID}/topup": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Tenant"
],
"summary": "为租户成员充值(租户管理)",
"parameters": [
{
"type": "string",
"description": "Tenant Code",
"name": "tenantCode",
"in": "path",
"required": true
},
{
"type": "integer",
"format": "int64",
"description": "UserID",
"name": "userID",
"in": "path",
"required": true
},
{
"description": "Form",
"name": "form",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.AdminTopupForm"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.Order"
}
}
}
}
},
"/t/{tenantCode}/v1/contents": {
"get": {
"consumes": [
@@ -2939,12 +2846,10 @@
"consts.OrderType": {
"type": "string",
"enum": [
"content_purchase",
"topup"
"content_purchase"
],
"x-enum-varnames": [
"OrderTypeContentPurchase",
"OrderTypeTopup"
"OrderTypeContentPurchase"
]
},
"consts.Role": {
@@ -2987,7 +2892,6 @@
"consts.TenantLedgerType": {
"type": "string",
"enum": [
"credit_topup",
"debit_purchase",
"credit_refund",
"freeze",
@@ -2995,7 +2899,6 @@
"adjustment"
],
"x-enum-varnames": [
"TenantLedgerTypeCreditTopup",
"TenantLedgerTypeDebitPurchase",
"TenantLedgerTypeCreditRefund",
"TenantLedgerTypeFreeze",
@@ -3040,100 +2943,6 @@
"UserStatusBanned"
]
},
"dto.AdminBatchTopupForm": {
"type": "object",
"properties": {
"batch_idempotency_key": {
"description": "BatchIdempotencyKey 批次幂等键:必须填写;用于重试同一批次时保证不会重复入账。",
"type": "string"
},
"items": {
"description": "Items 充值明细列表:至少 1 条;单批次条数在业务侧限制(避免拖垮系统)。",
"type": "array",
"items": {
"$ref": "#/definitions/dto.AdminBatchTopupItem"
}
}
}
},
"dto.AdminBatchTopupItem": {
"type": "object",
"properties": {
"amount": {
"description": "Amount 充值金额:单位分;必须 \u003e 0。",
"type": "integer"
},
"idempotency_key": {
"description": "IdempotencyKey 幂等键(可选):为空时后端会用 batch_idempotency_key 派生生成;\n建议前端/调用方提供稳定值,便于重试时保持结果一致。",
"type": "string"
},
"reason": {
"description": "Reason 充值原因(可选):用于审计与追溯。",
"type": "string"
},
"user_id": {
"description": "UserID 目标用户ID必须属于当前租户否则该条充值失败。",
"type": "integer"
}
}
},
"dto.AdminBatchTopupResponse": {
"type": "object",
"properties": {
"failed": {
"description": "Failed 失败条数。",
"type": "integer"
},
"items": {
"description": "Items 明细结果列表:与请求 items 顺序一致,便于前端逐条展示。",
"type": "array",
"items": {
"$ref": "#/definitions/dto.AdminBatchTopupResultItem"
}
},
"success": {
"description": "Success 成功条数。",
"type": "integer"
},
"total": {
"description": "Total 总条数:等于 items 长度。",
"type": "integer"
}
}
},
"dto.AdminBatchTopupResultItem": {
"type": "object",
"properties": {
"amount": {
"description": "Amount 充值金额(单位分)。",
"type": "integer"
},
"error_code": {
"description": "ErrorCode 错误码:失败时返回;成功时为 0。",
"type": "integer"
},
"error_message": {
"description": "ErrorMessage 错误信息:失败时返回;成功时为空。",
"type": "string"
},
"idempotency_key": {
"description": "IdempotencyKey 实际使用的幂等键:可能为客户端传入,也可能为后端派生生成。",
"type": "string"
},
"ok": {
"description": "OK 是否成功true 表示该条充值已成功入账或命中幂等成功结果。",
"type": "boolean"
},
"order_id": {
"description": "OrderID 生成的订单ID成功时返回失败时为 0。",
"type": "integer"
},
"user_id": {
"description": "UserID 目标用户ID。",
"type": "integer"
}
}
},
"dto.AdminLedgerItem": {
"type": "object",
"properties": {
@@ -3377,23 +3186,6 @@
}
}
},
"dto.AdminTopupForm": {
"type": "object",
"properties": {
"amount": {
"description": "Amount is the topup amount in cents (CNY 分); must be \u003e 0.",
"type": "integer"
},
"idempotency_key": {
"description": "IdempotencyKey ensures the topup request is processed at most once.",
"type": "string"
},
"reason": {
"description": "Reason is the human-readable topup reason used for audit.",
"type": "string"
}
}
},
"dto.ContentAssetAttachForm": {
"type": "object",
"properties": {
@@ -3853,6 +3645,14 @@
"dto.UserItem": {
"type": "object",
"properties": {
"balance": {
"description": "全局可用余额:分/最小货币单位;用户在所有已加入租户内共享该余额;默认 0",
"type": "integer"
},
"balance_frozen": {
"description": "全局冻结余额:分/最小货币单位;用于下单冻结等;默认 0",
"type": "integer"
},
"created_at": {
"type": "string"
},
@@ -4330,7 +4130,7 @@
"type": "integer"
},
"type": {
"description": "订单类型content_purchase购买内容/topup充值等;当前默认 content_purchase",
"description": "订单类型content_purchase购买内容当前默认 content_purchase",
"allOf": [
{
"$ref": "#/definitions/consts.OrderType"
@@ -4576,7 +4376,7 @@
"type": "integer"
},
"biz_ref_type": {
"description": "业务引用类型order/refund/topup/etc与 biz_ref_id 组成可选的结构化幂等/追溯键",
"description": "业务引用类型order/refund/etc与 biz_ref_id 组成可选的结构化幂等/追溯键",
"type": "string"
},
"created_at": {
@@ -4619,7 +4419,7 @@
"type": "integer"
},
"type": {
"description": "流水类型:credit_topup/debit_purchase/credit_refund/freeze/unfreeze/adjustment不同类型决定余额/冻结余额的变更方向",
"description": "流水类型debit_purchase/credit_refund/freeze/unfreeze/adjustment不同类型决定余额/冻结余额的变更方向",
"allOf": [
{
"$ref": "#/definitions/consts.TenantLedgerType"
@@ -4639,13 +4439,6 @@
"models.TenantUser": {
"type": "object",
"properties": {
"balance": {
"type": "integer"
},
"balance_frozen": {
"description": "冻结余额:分/最小货币单位;下单冻结时从可用余额转入,最终扣款或回滚时转出;默认 0",
"type": "integer"
},
"created_at": {
"type": "string"
},
@@ -4675,6 +4468,14 @@
"models.User": {
"type": "object",
"properties": {
"balance": {
"description": "全局可用余额:分/最小货币单位;用户在所有已加入租户内共享该余额;默认 0",
"type": "integer"
},
"balance_frozen": {
"description": "全局冻结余额:分/最小货币单位;用于下单冻结等;默认 0",
"type": "integer"
},
"created_at": {
"type": "string"
},

View File

@@ -111,11 +111,9 @@ definitions:
consts.OrderType:
enum:
- content_purchase
- topup
type: string
x-enum-varnames:
- OrderTypeContentPurchase
- OrderTypeTopup
consts.Role:
enum:
- user
@@ -146,7 +144,6 @@ definitions:
- TenantJoinRequestStatusRejected
consts.TenantLedgerType:
enum:
- credit_topup
- debit_purchase
- credit_refund
- freeze
@@ -154,7 +151,6 @@ definitions:
- adjustment
type: string
x-enum-varnames:
- TenantLedgerTypeCreditTopup
- TenantLedgerTypeDebitPurchase
- TenantLedgerTypeCreditRefund
- TenantLedgerTypeFreeze
@@ -188,75 +184,6 @@ definitions:
- UserStatusPendingVerify
- UserStatusVerified
- UserStatusBanned
dto.AdminBatchTopupForm:
properties:
batch_idempotency_key:
description: BatchIdempotencyKey 批次幂等键:必须填写;用于重试同一批次时保证不会重复入账。
type: string
items:
description: Items 充值明细列表:至少 1 条;单批次条数在业务侧限制(避免拖垮系统)。
items:
$ref: '#/definitions/dto.AdminBatchTopupItem'
type: array
type: object
dto.AdminBatchTopupItem:
properties:
amount:
description: Amount 充值金额:单位分;必须 > 0。
type: integer
idempotency_key:
description: |-
IdempotencyKey 幂等键(可选):为空时后端会用 batch_idempotency_key 派生生成;
建议前端/调用方提供稳定值,便于重试时保持结果一致。
type: string
reason:
description: Reason 充值原因(可选):用于审计与追溯。
type: string
user_id:
description: UserID 目标用户ID必须属于当前租户否则该条充值失败。
type: integer
type: object
dto.AdminBatchTopupResponse:
properties:
failed:
description: Failed 失败条数。
type: integer
items:
description: Items 明细结果列表:与请求 items 顺序一致,便于前端逐条展示。
items:
$ref: '#/definitions/dto.AdminBatchTopupResultItem'
type: array
success:
description: Success 成功条数。
type: integer
total:
description: Total 总条数:等于 items 长度。
type: integer
type: object
dto.AdminBatchTopupResultItem:
properties:
amount:
description: Amount 充值金额(单位分)。
type: integer
error_code:
description: ErrorCode 错误码:失败时返回;成功时为 0。
type: integer
error_message:
description: ErrorMessage 错误信息:失败时返回;成功时为空。
type: string
idempotency_key:
description: IdempotencyKey 实际使用的幂等键:可能为客户端传入,也可能为后端派生生成。
type: string
ok:
description: OK 是否成功true 表示该条充值已成功入账或命中幂等成功结果。
type: boolean
order_id:
description: OrderID 生成的订单ID成功时返回失败时为 0。
type: integer
user_id:
description: UserID 目标用户ID。
type: integer
type: object
dto.AdminLedgerItem:
properties:
ledger:
@@ -448,19 +375,6 @@ definitions:
description: Role 角色member/tenant_admin。
type: string
type: object
dto.AdminTopupForm:
properties:
amount:
description: Amount is the topup amount in cents (CNY 分); must be > 0.
type: integer
idempotency_key:
description: IdempotencyKey ensures the topup request is processed at most
once.
type: string
reason:
description: Reason is the human-readable topup reason used for audit.
type: string
type: object
dto.ContentAssetAttachForm:
properties:
asset_id:
@@ -760,6 +674,12 @@ definitions:
type: object
dto.UserItem:
properties:
balance:
description: 全局可用余额:分/最小货币单位;用户在所有已加入租户内共享该余额;默认 0
type: integer
balance_frozen:
description: 全局冻结余额:分/最小货币单位;用于下单冻结等;默认 0
type: integer
created_at:
type: string
deleted_at:
@@ -1077,7 +997,7 @@ definitions:
type:
allOf:
- $ref: '#/definitions/consts.OrderType'
description: 订单类型content_purchase购买内容/topup充值等;当前默认 content_purchase
description: 订单类型content_purchase购买内容当前默认 content_purchase
updated_at:
description: 更新时间:默认 now();状态变更/退款写入时更新
type: string
@@ -1244,7 +1164,7 @@ definitions:
description: 业务引用ID与 biz_ref_type 配合使用(例如 orders.id用于对账与审计
type: integer
biz_ref_type:
description: 业务引用类型order/refund/topup/etc与 biz_ref_id 组成可选的结构化幂等/追溯键
description: 业务引用类型order/refund/etc与 biz_ref_id 组成可选的结构化幂等/追溯键
type: string
created_at:
description: 创建时间:默认 now()
@@ -1278,7 +1198,7 @@ definitions:
type:
allOf:
- $ref: '#/definitions/consts.TenantLedgerType'
description: 流水类型:credit_topup/debit_purchase/credit_refund/freeze/unfreeze/adjustment不同类型决定余额/冻结余额的变更方向
description: 流水类型debit_purchase/credit_refund/freeze/unfreeze/adjustment不同类型决定余额/冻结余额的变更方向
updated_at:
description: 更新时间:默认 now()
type: string
@@ -1288,11 +1208,6 @@ definitions:
type: object
models.TenantUser:
properties:
balance:
type: integer
balance_frozen:
description: 冻结余额:分/最小货币单位;下单冻结时从可用余额转入,最终扣款或回滚时转出;默认 0
type: integer
created_at:
type: string
id:
@@ -1312,6 +1227,12 @@ definitions:
type: object
models.User:
properties:
balance:
description: 全局可用余额:分/最小货币单位;用户在所有已加入租户内共享该余额;默认 0
type: integer
balance_frozen:
description: 全局冻结余额:分/最小货币单位;用于下单冻结等;默认 0
type: integer
created_at:
type: string
deleted_at:
@@ -2004,7 +1925,7 @@ paths:
type: integer
- description: |-
BizRefType 按业务引用类型过滤(可选)。
约定:当前业务写入为 "order";未来可扩展为 refund/topup 等。
约定:当前业务写入为 "order";未来可扩展为 refund 等。
in: query
name: biz_ref_type
type: string
@@ -2023,7 +1944,7 @@ paths:
type: integer
- description: |-
OperatorUserID 按操作者用户ID过滤可选
典型场景:后台检索“某个管理员发起的充值/退款”等敏感操作流水。
典型场景:后台检索“某个管理员发起的退款/调账”等敏感操作流水。
in: query
name: operator_user_id
type: integer
@@ -2037,7 +1958,6 @@ paths:
type: integer
- description: Type 按流水类型过滤(可选)。
enum:
- credit_topup
- debit_purchase
- credit_refund
- freeze
@@ -2047,7 +1967,6 @@ paths:
name: type
type: string
x-enum-varnames:
- TenantLedgerTypeCreditTopup
- TenantLedgerTypeDebitPurchase
- TenantLedgerTypeCreditRefund
- TenantLedgerTypeFreeze
@@ -2340,16 +2259,14 @@ paths:
- OrderStatusRefunded
- OrderStatusCanceled
- OrderStatusFailed
- description: Type 订单类型可选content_purchase/topup 等。
- description: Type 订单类型可选content_purchase 等。
enum:
- content_purchase
- topup
in: query
name: type
type: string
x-enum-varnames:
- OrderTypeContentPurchase
- OrderTypeTopup
- description: UserID 下单用户ID可选按买家用户ID精确过滤。
in: query
name: user_id
@@ -2403,6 +2320,9 @@ paths:
post:
consumes:
- application/json
description: |-
该接口只负责将订单从 paid 推进到 refunding并提交异步退款任务退款入账与权益回收由 worker 异步完成。
重复请求幂等:订单处于 refunding/refunded 时会返回当前订单状态,不会重复入账/重复回收权益。
parameters:
- description: Tenant Code
in: path
@@ -2509,16 +2429,14 @@ paths:
- OrderStatusRefunded
- OrderStatusCanceled
- OrderStatusFailed
- description: Type 订单类型可选content_purchase/topup 等。
- description: Type 订单类型可选content_purchase 等。
enum:
- content_purchase
- topup
in: query
name: type
type: string
x-enum-varnames:
- OrderTypeContentPurchase
- OrderTypeTopup
- description: UserID 下单用户ID可选按买家用户ID精确过滤。
in: query
name: user_id
@@ -2685,64 +2603,6 @@ paths:
summary: 设置成员角色(租户管理)
tags:
- Tenant
/t/{tenantCode}/v1/admin/users/{userID}/topup:
post:
consumes:
- application/json
parameters:
- description: Tenant Code
in: path
name: tenantCode
required: true
type: string
- description: UserID
format: int64
in: path
name: userID
required: true
type: integer
- description: Form
in: body
name: form
required: true
schema:
$ref: '#/definitions/dto.AdminTopupForm'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/models.Order'
summary: 为租户成员充值(租户管理)
tags:
- Tenant
/t/{tenantCode}/v1/admin/users/topup/batch:
post:
consumes:
- application/json
parameters:
- description: Tenant Code
in: path
name: tenantCode
required: true
type: string
- description: Form
in: body
name: form
required: true
schema:
$ref: '#/definitions/dto.AdminBatchTopupForm'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/dto.AdminBatchTopupResponse'
summary: 批量为租户成员充值(租户管理)
tags:
- Tenant
/t/{tenantCode}/v1/contents:
get:
consumes: