feat: 移除“租户管理员为用户充值 / 每租户一套余额”能力:余额统一为全局用户余额
This commit is contained in:
@@ -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"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user