feat: implement new structure

This commit is contained in:
2025-12-29 09:30:49 +08:00
parent 503b15aab7
commit ad52371028
116 changed files with 17579 additions and 1213 deletions

View File

@@ -29,9 +29,9 @@ func newContentPrice(db *gorm.DB, opts ...gen.DOOption) contentPriceQuery {
_contentPriceQuery.TenantID = field.NewInt64(tableName, "tenant_id")
_contentPriceQuery.UserID = field.NewInt64(tableName, "user_id")
_contentPriceQuery.ContentID = field.NewInt64(tableName, "content_id")
_contentPriceQuery.Currency = field.NewField(tableName, "currency")
_contentPriceQuery.Currency = field.NewString(tableName, "currency")
_contentPriceQuery.PriceAmount = field.NewInt64(tableName, "price_amount")
_contentPriceQuery.DiscountType = field.NewField(tableName, "discount_type")
_contentPriceQuery.DiscountType = field.NewString(tableName, "discount_type")
_contentPriceQuery.DiscountValue = field.NewInt64(tableName, "discount_value")
_contentPriceQuery.DiscountStartAt = field.NewTime(tableName, "discount_start_at")
_contentPriceQuery.DiscountEndAt = field.NewTime(tableName, "discount_end_at")
@@ -47,18 +47,18 @@ type contentPriceQuery struct {
contentPriceQueryDo contentPriceQueryDo
ALL field.Asterisk
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();更新价格/折扣时写入
ID field.Int64
TenantID field.Int64
UserID field.Int64
ContentID field.Int64
Currency field.String
PriceAmount field.Int64
DiscountType field.String
DiscountValue field.Int64
DiscountStartAt field.Time
DiscountEndAt field.Time
CreatedAt field.Time
UpdatedAt field.Time
fieldMap map[string]field.Expr
}
@@ -79,9 +79,9 @@ func (c *contentPriceQuery) updateTableName(table string) *contentPriceQuery {
c.TenantID = field.NewInt64(table, "tenant_id")
c.UserID = field.NewInt64(table, "user_id")
c.ContentID = field.NewInt64(table, "content_id")
c.Currency = field.NewField(table, "currency")
c.Currency = field.NewString(table, "currency")
c.PriceAmount = field.NewInt64(table, "price_amount")
c.DiscountType = field.NewField(table, "discount_type")
c.DiscountType = field.NewString(table, "discount_type")
c.DiscountValue = field.NewInt64(table, "discount_value")
c.DiscountStartAt = field.NewTime(table, "discount_start_at")
c.DiscountEndAt = field.NewTime(table, "discount_end_at")