互动
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.

30 lines
1.4 KiB

package models
import (
"github.com/ouxuanserver/osmanthuswine/src/core"
"hudongzhuanjia/utils/define"
"time"
)
const OrderGiftTableName = TableNamePrefix + "order_gift"
type OrderGift struct {
Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"`
ActivityId int64 `json:"activity_id" xorm:"not null default(0) comment('互动id') INT(11)"`
OrderGiftSwitch string `json:"order_gift_switch" xorm:"not null default('关闭') comment('订单送礼开关[开启|关闭]') VARCHAR(2)"`
Num int `json:"num" xorm:"not null default(0) comment('前多少人下单有礼0不限制') INT(11)"`
GiftName string `json:"gift_name" xorm:"not null default('') comment('礼品名字') VARCHAR(255)"`
GiftPicUrl string `json:"gift_pic_url" xorm:"not null default('') comment('礼品图片url') VARCHAR(255)"`
IsDelete bool `json:"is_delete" xorm:"not null default(0) comment('软删除') TINYINT(0)"`
CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME"`
UpdatedAt time.Time `json:"updated_at" xorm:"not null updated comment('更新时间') DATETIME"`
}
func (t *OrderGift) TableName() string {
return OrderGiftTableName
}
func (t *OrderGift) GetByActivityId(aid int64) (bool, error) {
return core.GetXormAuto().Where("is_delete=0 and order_gift_switch=? "+
"and activity_id=?", define.StatusOpen, aid).Get(t)
}