|
@@ -8,15 +8,15 @@ import (
|
|
|
|
|
|
type ClientActiveDrawLog struct {
|
|
|
ID int64 `gorm:"column:id;type:bigint(20);primary_key;AUTO_INCREMENT" json:"id"`
|
|
|
- ActiveConfigID int64 `gorm:"column:active_config_id;type:bigint(20)" json:"active_config_id"` // 活动抽奖id
|
|
|
- ClientOpenID string `gorm:"column:client_open_id;type:varchar(255)" json:"client_open_id"`
|
|
|
- DrawProductID int64 `gorm:"column:draw_product_id;type:bigint(20)" json:"draw_product_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)" json:"deleted_at"` // 删除时间
|
|
|
- IsPrize int `gorm:"column:is_prize;type:int(11)" json:"is_prize"` // 1-未中奖 2-未兑奖 3-已兑奖
|
|
|
+ ActiveConfigID int64 `gorm:"column:active_config_id;type:bigint(20)" json:"active_config_id"` // 活动抽奖id
|
|
|
+ ClientOpenID string `gorm:"column:client_open_id;type:varchar(255)" json:"client_open_id"` //
|
|
|
+ DrawProductID int64 `gorm:"column:draw_product_id;type:bigint(20)" json:"draw_product_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"` // 删除时间
|
|
|
+ IsPrize int `gorm:"column:is_prize;type:int(11)" json:"is_prize"` // 1-未中奖 2-未兑奖 3-已兑奖
|
|
|
}
|
|
|
|
|
|
func (m *ClientActiveDrawLog) TableName() string {
|
|
@@ -36,6 +36,19 @@ func (m *ClientActiveDrawLog) GetClientActiveDrawLogByBiZHong() (int64, error) {
|
|
|
|
|
|
}
|
|
|
|
|
|
+func (m *ClientActiveDrawLog) GetClientActiveDrawLogNum() (int, error) {
|
|
|
+ var count int
|
|
|
+
|
|
|
+ table := orm.ShMysql.Table(m.TableName())
|
|
|
+ table = table.Where("active_config_id = ? and client_open_id = ? ",
|
|
|
+ m.ActiveConfigID, m.ClientOpenID)
|
|
|
+ if err := table.Count(&count).Error; err != nil {
|
|
|
+ return 0, nil
|
|
|
+ }
|
|
|
+ return count, nil
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
func (m *ClientActiveDrawLog) Create() (ClientActiveDrawLog, error) {
|
|
|
var doc ClientActiveDrawLog
|
|
|
var err error
|