From 741a55f7a2d02c0e07e380eb986d5455c35d0b27 Mon Sep 17 00:00:00 2001 From: gazebo Date: Wed, 7 Nov 2018 14:27:09 +0800 Subject: [PATCH] - change isLock from bool to int for LockPromotionSkus --- business/jxstore/promotion/jd_promotion.go | 13 ++++++------- controllers/promotion.go | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/business/jxstore/promotion/jd_promotion.go b/business/jxstore/promotion/jd_promotion.go index 87a327c30..b99f20bc7 100644 --- a/business/jxstore/promotion/jd_promotion.go +++ b/business/jxstore/promotion/jd_promotion.go @@ -801,20 +801,19 @@ func RefreshJdPromotionLockStatus(promotionID int) (err error) { return RefreshJdPromotionItemListLockStatus(promotionItemList) } -func LockPromotionSkus(ctx *jxcontext.Context, promotionID int, isLock bool, skuIDs []int) (num int64, err error) { +func LockPromotionSkus(ctx *jxcontext.Context, promotionID int, isLock int, skuIDs []int) (num int64, err error) { globals.SugarLogger.Debugf("LockPromotionSkus promotionID:%d, isLock:%t, skuIDs:%v", promotionID, isLock, skuIDs) + if isLock != 0 { + isLock = 1 + } sql := ` UPDATE promotion_sku t1 SET t1.is_lock = ? WHERE t1.promotion_id = ? ` - intIsLock := 0 - if isLock { - intIsLock = 1 - } sqlParams := []interface{}{ - intIsLock, + isLock, promotionID, } if len(skuIDs) > 0 { @@ -825,7 +824,7 @@ func LockPromotionSkus(ctx *jxcontext.Context, promotionID int, isLock bool, sku num, err = dao.ExecuteSQL(db, sql, sqlParams...) if err == nil { RefreshJdPromotionLockStatus(promotionID) - if isLock { + if isLock != 0 { RefreshJdStoreSkuStock() } } diff --git a/controllers/promotion.go b/controllers/promotion.go index 2fac11024..7beee27e6 100644 --- a/controllers/promotion.go +++ b/controllers/promotion.go @@ -154,7 +154,7 @@ func (c *PromotionController) CancelPromotion() { // @Description 锁定解锁活动SKU // @Param token header string true "认证token" // @Param promotionID formData int true "活动id" -// @Param isLock formData bool true "活动id" +// @Param isLock formData int true "锁定标志,0:不锁定,1:锁定" // @Param skuIDs formData string false "缺省全部" // @Success 200 {object} controllers.CallResult // @Failure 200 {object} controllers.CallResult