|
|
@@ -78,9 +78,9 @@ func GetBalanceEffetivePromotions(queryDate time.Time, depart int64, useCache bo
|
|
|
}
|
|
|
|
|
|
sql := `
|
|
|
- select * from
|
|
|
- balance_promotions
|
|
|
- where DATE_ADD(begin_time,INTERVAL 8 HOUR) <= ? and DATE_ADD(end_time,INTERVAL 8 HOUR) >= ? and (depart = ? || depart=0) and is_enable = 1 ;
|
|
|
+ select a.* from
|
|
|
+ balance_promotions a left join depart_records_balance_promotions b on a.id=b.balance_promotion_id
|
|
|
+ where DATE_ADD(a.begin_time,INTERVAL 8 HOUR) <= ? and DATE_ADD(a.end_time,INTERVAL 8 HOUR) >= ? and b.depart_record_id = ? and a.is_enable = 1 ;
|
|
|
`
|
|
|
|
|
|
_, err := orm.NewOrm().Raw(sql, queryDate.Format("2006-01-02 15:04:05"), queryDate.Format("2006-01-02 15:04:05"), depart).QueryRows(&list)
|
|
|
@@ -102,9 +102,9 @@ func GetShopEffetivePromotions(queryDate time.Time, depart int64, useCache bool)
|
|
|
}
|
|
|
|
|
|
sql := `
|
|
|
- select * from
|
|
|
- shop_promotions
|
|
|
- where DATE_ADD(begin_time,INTERVAL 8 HOUR) <= ? and DATE_ADD(end_time,INTERVAL 8 HOUR) >= ? and (depart = ? || depart=0) and is_enable = 1 ;
|
|
|
+ select a.* from
|
|
|
+ shop_promotions a left join depart_records_shop_promotions b on a.id=b.shop_promotion_id
|
|
|
+ where DATE_ADD(a.begin_time,INTERVAL 8 HOUR) <= ? and DATE_ADD(a.end_time,INTERVAL 8 HOUR) >= ? and b.depart_record_id = ? and is_enable = 1 ;
|
|
|
`
|
|
|
|
|
|
_, err := orm.NewOrm().Raw(sql, queryDate.Format("2006-01-02 15:04:05"), queryDate.Format("2006-01-02 15:04:05"), depart).QueryRows(&list)
|