You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
2.4 KiB
42 lines
2.4 KiB
package models
|
|
|
|
import (
|
|
"github.com/ouxuanserver/osmanthuswine/src/core"
|
|
"time"
|
|
)
|
|
|
|
const ShakeRedEnvelopeActivityTableName = TableNamePrefix + "shake_red_envelope_activity"
|
|
|
|
//摇红包活动
|
|
type ShakeRedEnvelopeActivity struct {
|
|
Id int64 `json:"id" xorm:"pk autoincr BIGINT(20)"`
|
|
ActivityId int64 `json:"activity_id" xorm:"not null comment('主活动id') BIGINT(20)" description:"活动的id"`
|
|
RedEnvelopeActivityName string `json:"red_envelope_activity_name" xorm:"not null default('') comment('红包活动名字') VARCHAR(255)"`
|
|
ShakeRedEnvelopeRule *ShakeRedEnvelopeRule `json:"shake_red_envelope_rule" xorm:"-" description:"规则"`
|
|
MoreAreaMode string `json:"more_area_mode" xorm:"not null default('') comment('多地区') VARCHAR(125)"`
|
|
IsPay int `json:"is_pay" xorm:"not null default(0) comment('1支付0未支付') TINYINT(1)"`
|
|
TotalMoney float64 `json:"total_money" xorm:"not null comment('轮次的总金额') DECIMAL"`
|
|
EditTotalMoney float64 `json:"edit_total_money" xorm:"not null comment('修改后的总额') DECIMAL"`
|
|
FinalTotalMoney float64 `json:"final_total_money" xorm:"not null comment('最后总金额') DECIMAL" description:"最后总额"`
|
|
IsDelete bool `json:"is_delete" xorm:"default(0) comment('软删除') TINYINT(1)" description:"是否已删除"`
|
|
CreatedAt time.Time `json:"create_at" xorm:"not null created comment('创建时间') DATETIME"`
|
|
UpdatedAt time.Time `json:"update_at" xorm:"not null updated comment('更新时间') DATETIME"`
|
|
}
|
|
|
|
func (t *ShakeRedEnvelopeActivity) TableName() string {
|
|
return ShakeRedEnvelopeActivityTableName
|
|
}
|
|
|
|
func (t *ShakeRedEnvelopeActivity) Alias(name string) string {
|
|
return AliasTableName(t, name)
|
|
}
|
|
|
|
func (t *ShakeRedEnvelopeActivity) GetPayedById(id int64) (bool, error) {
|
|
return core.GetXormAuto().Where("is_delete=0 and is_pay=1 and id=?", id).Get(t)
|
|
}
|
|
func GetSREActivityIdsByActivityId(aid int64) ([]int64, error) {
|
|
shakeRbIds := make([]int64, 0)
|
|
err := core.GetXormAuto().Table(new(ShakeRedEnvelopeActivity)).Select("id").
|
|
Where("is_delete=0 and activity_id=?", aid).Find(&shakeRbIds)
|
|
return shakeRbIds, err
|
|
}
|