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 }