- support cityCode in GetPromotions

- promotion beginAt and endAt are time format(not just date format)
This commit is contained in:
gazebo
2018-11-14 10:16:52 +08:00
parent 9e0d3c7a59
commit b370e4d158
2 changed files with 8 additions and 3 deletions

View File

@@ -583,6 +583,10 @@ func GetJdPromotions(ctx *jxcontext.Context, keyword string, params map[string]i
sql += " AND (SELECT COUNT(*) FROM promotion_sku tt1 WHERE tt1.promotion_id = t1.id AND tt1.sku_id = ?) > 0"
sqlParams = append(sqlParams, params["skuID"].(int))
}
if params["cityCode"] != nil {
sql += " AND (SELECT COUNT(*) FROM promotion_store tt1 JOIN store st ON st.id = tt1.store_id AND st.code = ? WHERE tt1.promotion_id = t1.id) > 0"
sqlParams = append(sqlParams, params["cityCode"].(int))
}
sql += `
GROUP BY
1,2,3,4,5,6,7,8,9,10,11,12
@@ -670,7 +674,7 @@ func RefreshJdLockStoreSku() (err error) {
WHERE t1.deleted_at = ? AND t1.vendor_id = ? AND t1.status = ? AND (t1.begin_at <= ? AND t1.end_at >= ?)
GROUP BY 1,2,3
`
nowDate := utils.GetCurDate()
nowDate := time.Now()
sqlParams := []interface{}{
model.VendorIDJD,
utils.DefaultTimeValue,
@@ -707,7 +711,7 @@ func RefreshJdStoreSkuStock() (err error) {
GROUP BY 1,2,3
ORDER BY 1,2,3
`
nowDate := utils.GetCurDate()
nowDate := time.Now()
sqlParams := []interface{}{
model.VendorIDJD,
utils.DefaultTimeValue,
@@ -805,7 +809,7 @@ func RefreshJdPromotionLockStatus(ctx *jxcontext.Context, promotionID int) (err
JOIN sku t32 ON t3.sku_id = t32.id
WHERE t1.id = ?
`
nowDate := utils.GetCurDate()
nowDate := time.Now()
sqlParams := []interface{}{
nowDate,
nowDate,

View File

@@ -123,6 +123,7 @@ func (c *PromotionController) SendAdvertingByGoodsOrder() {
// @Param vendorPromotionID query string false "厂商活动id"
// @Param days query int false "多少天内创建的缺省7天"
// @Param name query string false "活动名,不完全匹配"
// @Param cityCode query int false "活动门店所属城市code"
// @Param beginAt query string false "开始日期,包括"
// @Param endAt query string false "结束日期,包括"
// @Param type query int false "活动类型3直降4限时抢购"