feat: add TenantLedger model and query generation

- Introduced TenantLedger model with fields for managing tenant transactions, including ID, TenantID, UserID, OrderID, transaction Type, Amount, and balance details.
- Implemented CRUD operations for TenantLedger with methods for Create, Update, Delete, and Reload.
- Generated query methods for TenantLedger to facilitate database interactions, including filtering, pagination, and aggregation functions.
- Established relationships with Order model for foreign key references.
This commit is contained in:
2025-12-18 13:12:26 +08:00
parent f93caefcb2
commit 1da84f2af3
42 changed files with 6468 additions and 265 deletions

View File

@@ -47,18 +47,18 @@ type contentPriceQuery struct {
contentPriceQueryDo contentPriceQueryDo
ALL field.Asterisk
ID field.Int64
TenantID field.Int64
UserID field.Int64
ContentID field.Int64
Currency field.Field
PriceAmount field.Int64
DiscountType field.Field
DiscountValue field.Int64
DiscountStartAt field.Time
DiscountEndAt field.Time
CreatedAt field.Time
UpdatedAt field.Time
ID field.Int64 // 主键ID自增
TenantID field.Int64 // 租户ID多租户隔离与内容归属一致
UserID field.Int64 // 用户ID设置/更新价格的操作人(通常为 tenant_admin用于审计
ContentID field.Int64 // 内容ID唯一约束 (tenant_id, content_id);一个内容在一个租户内仅一份定价
Currency field.Field // 币种:当前固定 CNY金额单位为分
PriceAmount field.Int64 // 基础价格0 表示免费(可直接访问正片资源)
DiscountType field.Field // 折扣类型none/percent/amount仅影响下单时成交价需写入订单快照
DiscountValue field.Int64 // 折扣值percent=0-100按业务校验amount=分none 时忽略
DiscountStartAt field.Time // 折扣开始时间:可为空;为空表示立即生效(由业务逻辑解释)
DiscountEndAt field.Time // 折扣结束时间:可为空;为空表示长期有效(由业务逻辑解释)
CreatedAt field.Time // 创建时间:默认 now();用于审计
UpdatedAt field.Time // 更新时间:默认 now();更新价格/折扣时写入
fieldMap map[string]field.Expr
}