From b370e4d1580371675563e185ec57276f657cb8e3 Mon Sep 17 00:00:00 2001 From: gazebo Date: Wed, 14 Nov 2018 10:16:52 +0800 Subject: [PATCH] - support cityCode in GetPromotions - promotion beginAt and endAt are time format(not just date format) --- business/jxstore/promotion/jd_promotion.go | 10 +++++++--- controllers/promotion.go | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/business/jxstore/promotion/jd_promotion.go b/business/jxstore/promotion/jd_promotion.go index 9fec1f1cd..681526cf9 100644 --- a/business/jxstore/promotion/jd_promotion.go +++ b/business/jxstore/promotion/jd_promotion.go @@ -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, diff --git a/controllers/promotion.go b/controllers/promotion.go index b63a11890..9d3d5bdb7 100644 --- a/controllers/promotion.go +++ b/controllers/promotion.go @@ -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:限时抢购"