From cde87bb6677f5bf82df388edd43646dd398503ea Mon Sep 17 00:00:00 2001 From: gazebo Date: Fri, 12 Jul 2019 17:21:38 +0800 Subject: [PATCH] =?UTF-8?q?-=20DeleteActStoreSkuBind=E4=B8=AD=EF=BC=8C?= =?UTF-8?q?=E5=AF=B9=E4=BA=8E=E5=8F=96=E6=B6=88=E6=B4=BB=E5=8A=A8=EF=BC=88?= =?UTF-8?q?actStoreSkuParam=E4=B8=BAnil=EF=BC=89=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E5=95=86=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/act/act.go | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/business/jxstore/act/act.go b/business/jxstore/act/act.go index 215f90293..b8f8d7155 100644 --- a/business/jxstore/act/act.go +++ b/business/jxstore/act/act.go @@ -580,22 +580,27 @@ func DeleteActStoreSkuBind(ctx *jxcontext.Context, db *dao.DaoDB, actID int, act for vendorID, act := range actMap { isDeleteAll := true isDeleteAtLeastOne := false - actStoreSkuMap := partner.SplitActStoreSku(actStoreSkuMap[vendorID]) - for storeID := range actStoreSkuMap { - for _, actStoreSku := range actStoreSkuMap[storeID] { - if actStoreSkuParam == nil || actStoreSkuParamMap[jxutils.Combine2Int(actStoreSku.StoreID, actStoreSku.SkuID)] != nil { - if _, err = dao.UpdateEntityLogically(db, partner.ActStoreSku2ActStoreSkuMap(actStoreSku), - map[string]interface{}{ - model.FieldSyncStatus: actStoreSku.SyncStatus | model.SyncFlagDeletedMask, - }, ctx.GetUserName(), nil); err != nil { - return err + if actStoreSkuParam != nil { + actStoreSkuMap := partner.SplitActStoreSku(actStoreSkuMap[vendorID]) + for storeID := range actStoreSkuMap { + for _, actStoreSku := range actStoreSkuMap[storeID] { + if actStoreSkuParam == nil || actStoreSkuParamMap[jxutils.Combine2Int(actStoreSku.StoreID, actStoreSku.SkuID)] != nil { + if _, err = dao.UpdateEntityLogically(db, partner.ActStoreSku2ActStoreSkuMap(actStoreSku), + map[string]interface{}{ + model.FieldSyncStatus: actStoreSku.SyncStatus | model.SyncFlagDeletedMask, + }, ctx.GetUserName(), nil); err != nil { + return err + } + isDeleteAtLeastOne = true + } else { + isNeedCancelAct = false + isDeleteAll = false } - isDeleteAtLeastOne = true - } else { - isNeedCancelAct = false - isDeleteAll = false } } + } else { + isDeleteAll = true + isDeleteAtLeastOne = true } if isDeleteAll || isDeleteAtLeastOne { syncStatus := model.SyncFlagModifiedMask