- 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,