feat: 更新用户、订单、媒体资产和租户模型,添加新的字段类型和结构体

This commit is contained in:
2025-12-29 12:01:22 +08:00
parent 0d0aee87b1
commit d648a1e45b
13 changed files with 141 additions and 92 deletions

View File

@@ -8,6 +8,8 @@ import (
"context"
"time"
"quyun/v2/database/fields"
"go.ipao.vip/gen"
"go.ipao.vip/gen/types"
)
@@ -16,16 +18,16 @@ const TableNameOrderItem = "order_items"
// OrderItem mapped from table <order_items>
type OrderItem struct {
ID int64 `gorm:"column:id;type:bigint;primaryKey;autoIncrement:true" json:"id"`
TenantID int64 `gorm:"column:tenant_id;type:bigint;not null" json:"tenant_id"`
UserID int64 `gorm:"column:user_id;type:bigint;not null" json:"user_id"`
OrderID int64 `gorm:"column:order_id;type:bigint;not null" json:"order_id"`
ContentID int64 `gorm:"column:content_id;type:bigint;not null" json:"content_id"`
ContentUserID int64 `gorm:"column:content_user_id;type:bigint;not null" json:"content_user_id"`
AmountPaid int64 `gorm:"column:amount_paid;type:bigint;not null" json:"amount_paid"`
Snapshot types.JSON `gorm:"column:snapshot;type:jsonb;default:{}" json:"snapshot"`
CreatedAt time.Time `gorm:"column:created_at;type:timestamp with time zone;default:now()" json:"created_at"`
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp with time zone;default:now()" json:"updated_at"`
ID int64 `gorm:"column:id;type:bigint;primaryKey;autoIncrement:true" json:"id"`
TenantID int64 `gorm:"column:tenant_id;type:bigint;not null" json:"tenant_id"`
UserID int64 `gorm:"column:user_id;type:bigint;not null" json:"user_id"`
OrderID int64 `gorm:"column:order_id;type:bigint;not null" json:"order_id"`
ContentID int64 `gorm:"column:content_id;type:bigint;not null" json:"content_id"`
ContentUserID int64 `gorm:"column:content_user_id;type:bigint;not null" json:"content_user_id"`
AmountPaid int64 `gorm:"column:amount_paid;type:bigint;not null" json:"amount_paid"`
Snapshot types.JSONType[fields.OrderItemsSnapshot] `gorm:"column:snapshot;type:jsonb;default:{}" json:"snapshot"`
CreatedAt time.Time `gorm:"column:created_at;type:timestamp with time zone;default:now()" json:"created_at"`
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp with time zone;default:now()" json:"updated_at"`
}
// Quick operations without importing query package