- change isLock from bool to int for LockPromotionSkus

This commit is contained in:
gazebo
2018-11-07 14:27:09 +08:00
parent 88929a687c
commit 741a55f7a2
2 changed files with 7 additions and 8 deletions

View File

@@ -801,20 +801,19 @@ func RefreshJdPromotionLockStatus(promotionID int) (err error) {
return RefreshJdPromotionItemListLockStatus(promotionItemList) 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) globals.SugarLogger.Debugf("LockPromotionSkus promotionID:%d, isLock:%t, skuIDs:%v", promotionID, isLock, skuIDs)
if isLock != 0 {
isLock = 1
}
sql := ` sql := `
UPDATE promotion_sku t1 UPDATE promotion_sku t1
SET t1.is_lock = ? SET t1.is_lock = ?
WHERE t1.promotion_id = ? WHERE t1.promotion_id = ?
` `
intIsLock := 0
if isLock {
intIsLock = 1
}
sqlParams := []interface{}{ sqlParams := []interface{}{
intIsLock, isLock,
promotionID, promotionID,
} }
if len(skuIDs) > 0 { 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...) num, err = dao.ExecuteSQL(db, sql, sqlParams...)
if err == nil { if err == nil {
RefreshJdPromotionLockStatus(promotionID) RefreshJdPromotionLockStatus(promotionID)
if isLock { if isLock != 0 {
RefreshJdStoreSkuStock() RefreshJdStoreSkuStock()
} }
} }

View File

@@ -154,7 +154,7 @@ func (c *PromotionController) CancelPromotion() {
// @Description 锁定解锁活动SKU // @Description 锁定解锁活动SKU
// @Param token header string true "认证token" // @Param token header string true "认证token"
// @Param promotionID formData int true "活动id" // @Param promotionID formData int true "活动id"
// @Param isLock formData bool true "活动id" // @Param isLock formData int true "锁定标志0不锁定1锁定"
// @Param skuIDs formData string false "缺省全部" // @Param skuIDs formData string false "缺省全部"
// @Success 200 {object} controllers.CallResult // @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult // @Failure 200 {object} controllers.CallResult