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

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