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.

29 lines
916 B

package promotion
import (
"github.com/golangkit/formatime"
"live/app/lib/db"
"time"
)
type PromotionGoods struct {
db.BaseModel
Id uint `gorm:"column:id" json:"id"`
PromotionTimeItemId uint `gorm:"column:promotion_time_item_id" json:"promotionTimeItemId"`
GoodsId uint `gorm:"column:goods_id" json:"goodsId"`
PromotionStartDate formatime.Date `gorm:"column:promotion_start_date" json:"promotionStartDate"`
Order uint `gorm:"column:order" json:"order"`
}
func (p *PromotionGoods) TableName() string {
return "recook_promotion_goods"
}
// @Title 获取当日所有数据
func (p *PromotionGoods) GetDayAll() (result []PromotionGoods) {
day := time.Now().Format("2006-01-02")
day = "2020-09-19"
p.GetDb().Model(p).Where("promotion_start_date = ?", day).Order("promotion_time_item_id,`order`").Find(&result)
return
}