- 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)
}
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()
}
}

View File

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