|
|
@ -24,15 +24,13 @@ type ShakeRedEnvelopeRecord struct { |
|
|
|
AreaName string `json:"area_name" xorm:"not null default '' comment('地区名字') VARCHAR(18)"` |
|
|
|
Name string `json:"name" xorm:"not null default '' comment('红包名字') VARCHAR(255)"` |
|
|
|
UserId int64 `json:"user_id" xorm:"not null default 0 comment('用户id') INT(11)"` |
|
|
|
Amount float64 `json:"amount" xorm:"not null default '0' comment('金额') DECIMAL(18)"` |
|
|
|
IsDraw int `json:"is_draw" xorm:"not null default(0) comment('-1未被摇中,0已被摇中,1已被提现,2提现失败')"` |
|
|
|
TransferType int `json:"transfer_type" xorm:"not null default 0 comment('0微信红包 1 微信转账') TINYINT(1)"` |
|
|
|
PartnerTradeNo string `json:"partner_trade_no" xorm:"not null default '' comment('转账账单no') VARCHAR(128)"` |
|
|
|
Amount float64 `json:"amount" xorm:"not null default 0.00 comment('金额') DECIMAL(18)"` |
|
|
|
IsValid bool `json:"is_valid,omitempty" xorm:"-"` |
|
|
|
IsDraw int `json:"is_draw" xorm:"not null default 0 comment('-1未被摇中,0已被摇中')"` |
|
|
|
MchBillno string `json:"mch_billno" xorm:"not null default"` |
|
|
|
Version int `json:"version" xorm:"not null version comment('乐观锁') INT(11)"` |
|
|
|
|
|
|
|
// 无关变量
|
|
|
|
// Status string `json:"status" xorm:"not null default '' comment('红包状态') VARCHAR(16)"`
|
|
|
|
IsValid bool `json:"is_valid,omitempty" xorm:"-"` |
|
|
|
} |
|
|
|
|
|
|
|
func (t *ShakeRedEnvelopeRecord) TableName() string { |
|
|
@ -71,8 +69,8 @@ func (t *ShakeRedEnvelopeRecord) GetByRuleId(ruleId, rehearsalId int64) (bool, e |
|
|
|
ruleId, rehearsalId).Get(t) |
|
|
|
} |
|
|
|
|
|
|
|
func (t *ShakeRedEnvelopeRecord) UpdateAllColsById(id int64) (int64, error) { |
|
|
|
return core.GetXormAuto().Where("is_delete=0 and id=?", id).AllCols().Update(t) |
|
|
|
func (t *ShakeRedEnvelopeRecord) UpdateById(id int64, field ...string) (int64, error) { |
|
|
|
return core.GetXormAuto().Where("is_delete=0 and id=?", id).Cols(field...).Update(t) |
|
|
|
} |
|
|
|
|
|
|
|
func GetRedEnvelopesByUserId(userId int64) ([]*ShakeRedEnvelopeRecord, error) { |
|
|
@ -86,6 +84,6 @@ func GetRedEnvelopesByUserId(userId int64) ([]*ShakeRedEnvelopeRecord, error) { |
|
|
|
} |
|
|
|
|
|
|
|
func (t *ShakeRedEnvelopeRecord) GetLiveRedPackRecord(id, rehearsalId interface{}) (bool, error) { |
|
|
|
return core.GetXormAuto().Where("is_delete=0 and red_envelope_type = 1 and user_id = 0 and "+ |
|
|
|
"live_red_envelope_rule_id=? and rehearsal_id=?", id, rehearsalId).Get(t) |
|
|
|
return core.GetXormAuto().Where("is_delete=0 and red_envelope_type = 1 and user_id = 0 "+ |
|
|
|
"and is_draw=0 and live_red_envelope_rule_id=? and rehearsal_id=?", id, rehearsalId).Get(t) |
|
|
|
} |