package shanghu import ( orm "duoduo/database" "github.com/shopspring/decimal" "time" ) // 中奖活动商品 库存,中奖率 type MerchantActiveDrawProduct struct { ID int64 `gorm:"column:id;type:bigint(20);primary_key;AUTO_INCREMENT" json:"id"` MerchantOpenID string `gorm:"column:merchant_open_id;type:varchar(255)" json:"merchant_open_id"` DrawProductName string `gorm:"column:draw_product_name;type:varchar(255)" json:"draw_product_name"` // 抽奖名称 DrawOdds decimal.Decimal `gorm:"column:draw_odds;type:decimal(10,2)" json:"draw_odds"` // 中奖概率 Stock int `gorm:"column:stock;type:int(11)" json:"stock"` // 剩余库存 Version int `gorm:"column:version;type:int(11)" json:"version"` // Version IsPrize bool `gorm:"column:is_prize;type:tinyint(1)" json:"is_prize"` // 是否需要兑奖 谢谢惠顾不需要兑奖 DrawUrl string `gorm:"column:draw_url;type:varchar(255)" json:"draw_url"` // 中奖图片 TotalStock int `gorm:"column:total_stock;type:int(11)" json:"total_stock"` // 总库存 ActiveConfigID int64 `gorm:"column:active_config_id;type:bigint(20)" json:"active_config_id"` // 关联活动 CreateBy int64 `gorm:"column:create_by;type:bigint(20)" json:"create_by"` // 创建者 UpdateBy int64 `gorm:"column:update_by;type:bigint(20)" json:"update_by"` // 更新者 CreatedAt time.Time `gorm:"column:created_at;type:datetime(3)" json:"created_at"` // 创建时间 UpdatedAt time.Time `gorm:"column:updated_at;type:datetime(3)" json:"updated_at"` // 最后更新时间 DeletedAt time.Time `gorm:"column:deleted_at;type:datetime(3);default:null" json:"deleted_at"` // 删除时间 } func (m *MerchantActiveDrawProduct) TableName() string { return "merchant_active_draw_product" } func (u *MerchantActiveDrawProduct) Create() (MerchantActiveDrawProduct, error) { var doc MerchantActiveDrawProduct var err error doc = *u err = orm.ShMysql.Table(u.TableName()).Create(&doc).Error if err != nil { return doc, err } return doc, nil }