feat: 移除“租户管理员为用户充值 / 每租户一套余额”能力:余额统一为全局用户余额
This commit is contained in:
@@ -18,7 +18,7 @@ type AdminLedgerListFilter struct {
|
||||
requests.Pagination `json:",inline" query:",inline"`
|
||||
|
||||
// OperatorUserID 按操作者用户ID过滤(可选)。
|
||||
// 典型场景:后台检索“某个管理员发起的充值/退款”等敏感操作流水。
|
||||
// 典型场景:后台检索“某个管理员发起的退款/调账”等敏感操作流水。
|
||||
OperatorUserID *int64 `json:"operator_user_id,omitempty" query:"operator_user_id"`
|
||||
|
||||
// UserID 按余额账户归属用户ID过滤(可选)。
|
||||
@@ -32,7 +32,7 @@ type AdminLedgerListFilter struct {
|
||||
OrderID *int64 `json:"order_id,omitempty" query:"order_id"`
|
||||
|
||||
// BizRefType 按业务引用类型过滤(可选)。
|
||||
// 约定:当前业务写入为 "order";未来可扩展为 refund/topup 等。
|
||||
// 约定:当前业务写入为 "order";未来可扩展为 refund 等。
|
||||
BizRefType *string `json:"biz_ref_type,omitempty" query:"biz_ref_type"`
|
||||
|
||||
// BizRefID 按业务引用ID过滤(可选)。
|
||||
|
||||
@@ -29,7 +29,7 @@ type AdminOrderListFilter struct {
|
||||
// ContentTitle 内容标题关键字(可选):通过 order_items + contents 关联,模糊匹配 contents.title(like)。
|
||||
ContentTitle *string `json:"content_title,omitempty" query:"content_title"`
|
||||
|
||||
// Type 订单类型(可选):content_purchase/topup 等。
|
||||
// Type 订单类型(可选):content_purchase 等。
|
||||
Type *consts.OrderType `json:"type,omitempty" query:"type"`
|
||||
|
||||
// Status 订单状态(可选):created/paid/refunding/refunded/canceled/failed。
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
package dto
|
||||
|
||||
// AdminBatchTopupItem 批量充值的单条明细。
|
||||
type AdminBatchTopupItem struct {
|
||||
// UserID 目标用户ID:必须属于当前租户,否则该条充值失败。
|
||||
UserID int64 `json:"user_id"`
|
||||
|
||||
// Amount 充值金额:单位分;必须 > 0。
|
||||
Amount int64 `json:"amount"`
|
||||
|
||||
// Reason 充值原因(可选):用于审计与追溯。
|
||||
Reason string `json:"reason,omitempty"`
|
||||
|
||||
// IdempotencyKey 幂等键(可选):为空时后端会用 batch_idempotency_key 派生生成;
|
||||
// 建议前端/调用方提供稳定值,便于重试时保持结果一致。
|
||||
IdempotencyKey string `json:"idempotency_key,omitempty"`
|
||||
}
|
||||
|
||||
// AdminBatchTopupForm 租户管理员批量充值请求参数。
|
||||
type AdminBatchTopupForm struct {
|
||||
// BatchIdempotencyKey 批次幂等键:必须填写;用于重试同一批次时保证不会重复入账。
|
||||
BatchIdempotencyKey string `json:"batch_idempotency_key"`
|
||||
|
||||
// Items 充值明细列表:至少 1 条;单批次条数在业务侧限制(避免拖垮系统)。
|
||||
Items []*AdminBatchTopupItem `json:"items"`
|
||||
}
|
||||
|
||||
// AdminBatchTopupResultItem 批量充值的单条处理结果。
|
||||
type AdminBatchTopupResultItem struct {
|
||||
// UserID 目标用户ID。
|
||||
UserID int64 `json:"user_id"`
|
||||
|
||||
// Amount 充值金额(单位分)。
|
||||
Amount int64 `json:"amount"`
|
||||
|
||||
// IdempotencyKey 实际使用的幂等键:可能为客户端传入,也可能为后端派生生成。
|
||||
IdempotencyKey string `json:"idempotency_key"`
|
||||
|
||||
// OrderID 生成的订单ID:成功时返回;失败时为 0。
|
||||
OrderID int64 `json:"order_id,omitempty"`
|
||||
|
||||
// OK 是否成功:true 表示该条充值已成功入账或命中幂等成功结果。
|
||||
OK bool `json:"ok"`
|
||||
|
||||
// ErrorCode 错误码:失败时返回;成功时为 0。
|
||||
ErrorCode int `json:"error_code,omitempty"`
|
||||
|
||||
// ErrorMessage 错误信息:失败时返回;成功时为空。
|
||||
ErrorMessage string `json:"error_message,omitempty"`
|
||||
}
|
||||
|
||||
// AdminBatchTopupResponse 批量充值的汇总结果。
|
||||
type AdminBatchTopupResponse struct {
|
||||
// Total 总条数:等于 items 长度。
|
||||
Total int `json:"total"`
|
||||
|
||||
// Success 成功条数。
|
||||
Success int `json:"success"`
|
||||
|
||||
// Failed 失败条数。
|
||||
Failed int `json:"failed"`
|
||||
|
||||
// Items 明细结果列表:与请求 items 顺序一致,便于前端逐条展示。
|
||||
Items []*AdminBatchTopupResultItem `json:"items"`
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package dto
|
||||
|
||||
// AdminTopupForm defines payload for tenant-admin to topup a tenant member balance.
|
||||
type AdminTopupForm struct {
|
||||
// Amount is the topup amount in cents (CNY 分); must be > 0.
|
||||
Amount int64 `json:"amount,omitempty"`
|
||||
// Reason is the human-readable topup reason used for audit.
|
||||
Reason string `json:"reason,omitempty"`
|
||||
// IdempotencyKey ensures the topup request is processed at most once.
|
||||
IdempotencyKey string `json:"idempotency_key,omitempty"`
|
||||
}
|
||||
Reference in New Issue
Block a user