feat: implement new structure
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user