From e62811eef18ce8556711b5d9a5574c214b728180 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 9 Jul 2020 09:44:27 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 618bc256a..a5678159a 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -869,11 +869,13 @@ func UpdateStoresSkus(ctx *jxcontext.Context, causeFlag int, storeIDs []int, sku if err != nil { return "", err } + fmt.Println("test12") isAsync = asyncStoreSkuOpFilter(ctx, isAsync) num = int64(len(skuIDs)) if num > 0 { hint, err = CurVendorSync.SyncStoresSkus(ctx, nil, causeFlag, db, nil, storeIDs, skuIDs, false, isAsync, isContinueWhenError) } + fmt.Println("test22") if num == 0 || !isAsync || hint == "" { hint = utils.Int64ToStr(num) } @@ -1020,7 +1022,6 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs if user := ctx.GetFullUser(); user != nil { isUserCanDirectChangePrice = user.Type&model.UserTypeOperator != 0 } - fmt.Println("test1") userName := ctx.GetUserName() needSyncIDMap := make(map[int]int) dao.Begin(db) @@ -1037,7 +1038,6 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs dao.Rollback(db) return nil, err } - fmt.Println("test2") scaleFactor := float64(1) if isScale { scaleFactor = 100 / float64(jxutils.ConstrainPayPercentage(storeDetail.PayPercentage)) @@ -1084,7 +1084,6 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs sqlParams = append(sqlParams, skuBindInfo.NameID, utils.DefaultTimeValue) // globals.SugarLogger.Debug(sql) if err = dao.GetRows(db, &allBinds, sql, sqlParams...); err == nil { - fmt.Println("test3") if len(allBinds) > 0 { // globals.SugarLogger.Debug(utils.Format4Output(allBinds, false)) inSkuBinsMap := make(map[int]*StoreSkuBindSkuInfo, len(inSkuBinds)) From 4bfb8b040a7281f2239051234fdafa49da6e186f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 9 Jul 2020 09:50:31 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=B5=8B=E8=AF=95updatestoresskus?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 9299ca29b..eb84f6354 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -897,13 +897,11 @@ func UpdateStoresSkus(ctx *jxcontext.Context, causeFlag int, storeIDs []int, sku if err != nil { return "", err } - fmt.Println("test12") isAsync = asyncStoreSkuOpFilter(ctx, isAsync) num = int64(len(skuIDs)) if num > 0 { hint, err = CurVendorSync.SyncStoresSkus(ctx, nil, causeFlag, db, nil, storeIDs, skuIDs, false, isAsync, isContinueWhenError) } - fmt.Println("test22") if num == 0 || !isAsync || hint == "" { hint = utils.Int64ToStr(num) } @@ -1139,6 +1137,7 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs unitPrice = int(float64(unitPrice) * scaleFactor) for _, v := range allBinds { var num int64 + fmt.Println("test1111111111111111111111111111111111") inSkuBind := inSkuBinsMap[v.RealSkuID] isCanChangePrice := (isUserCanDirectChangePrice || jxutils.TranslateStorePriceType(v.ChangePriceType) != model.StoreChangePriceTypeBossDisabled) // globals.SugarLogger.Debug(utils.Format4Output(inSkuBind, false)) @@ -1239,6 +1238,7 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs skuBind.Status = tmpStatus setStoreSkuBindStatus(skuBind, model.SyncFlagSaleMask) } + fmt.Println("test2222222222222222222222222222222222222") if skuBindInfo.UnitPrice != 0 && isCanChangePrice { // 这里是否需要加此条件限制 price := jxutils.CaculateSkuPrice(unitPrice, v.SpecQuality, v.SpecUnit, v.SkuNameUnit) jxPrice := jxutils.CaculatePriceByPricePack(storeDetail.PricePercentagePackObj, int(storeDetail.PricePercentage), price) @@ -1282,6 +1282,7 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs err = AddEventDetail(db, ctx, model.OperateUpdate, v.RealSkuID, model.ThingTypeSku, storeID, BuildDiffData(mapBefore), BuildDiffData(mapAfter)) } } + fmt.Println("test33333333333333333333333333333333") if len(updateFieldMap) > 0 { updateFieldMap[model.FieldJdSyncStatus] = 1 updateFieldMap[model.FieldEbaiSyncStatus] = 1 From 5b6006899cd9ecb2541b8fd60214802f47e21574 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 9 Jul 2020 09:54:54 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=B5=8B=E8=AF=95updatestoresskus?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index eb84f6354..2de228eb7 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -1048,6 +1048,7 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs if user := ctx.GetFullUser(); user != nil { isUserCanDirectChangePrice = user.Type&model.UserTypeOperator != 0 } + fmt.Println("test11111111111111111111111111111111111") userName := ctx.GetUserName() needSyncIDMap := make(map[int]int) dao.Begin(db) @@ -1059,6 +1060,7 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs }() for _, storeID := range storeIDs { // todo 可以考虑在需要更新价格再获取 + fmt.Println("test22222222222222222222222222222222222222222") storeDetail, err := dao.GetStoreDetail(dao.GetDB(), storeID, model.VendorIDJX) if err != nil { dao.Rollback(db) @@ -1110,6 +1112,7 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs sqlParams = append(sqlParams, skuBindInfo.NameID, utils.DefaultTimeValue) // globals.SugarLogger.Debug(sql) if err = dao.GetRows(db, &allBinds, sql, sqlParams...); err == nil { + fmt.Println("test3333333333333333333333333333333333333333") if len(allBinds) > 0 { // globals.SugarLogger.Debug(utils.Format4Output(allBinds, false)) inSkuBinsMap := make(map[int]*StoreSkuBindSkuInfo, len(inSkuBinds)) @@ -1137,7 +1140,6 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs unitPrice = int(float64(unitPrice) * scaleFactor) for _, v := range allBinds { var num int64 - fmt.Println("test1111111111111111111111111111111111") inSkuBind := inSkuBinsMap[v.RealSkuID] isCanChangePrice := (isUserCanDirectChangePrice || jxutils.TranslateStorePriceType(v.ChangePriceType) != model.StoreChangePriceTypeBossDisabled) // globals.SugarLogger.Debug(utils.Format4Output(inSkuBind, false)) @@ -1238,7 +1240,6 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs skuBind.Status = tmpStatus setStoreSkuBindStatus(skuBind, model.SyncFlagSaleMask) } - fmt.Println("test2222222222222222222222222222222222222") if skuBindInfo.UnitPrice != 0 && isCanChangePrice { // 这里是否需要加此条件限制 price := jxutils.CaculateSkuPrice(unitPrice, v.SpecQuality, v.SpecUnit, v.SkuNameUnit) jxPrice := jxutils.CaculatePriceByPricePack(storeDetail.PricePercentagePackObj, int(storeDetail.PricePercentage), price) @@ -1282,7 +1283,6 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs err = AddEventDetail(db, ctx, model.OperateUpdate, v.RealSkuID, model.ThingTypeSku, storeID, BuildDiffData(mapBefore), BuildDiffData(mapAfter)) } } - fmt.Println("test33333333333333333333333333333333") if len(updateFieldMap) > 0 { updateFieldMap[model.FieldJdSyncStatus] = 1 updateFieldMap[model.FieldEbaiSyncStatus] = 1 From 518cfab22e66fe397032abe6ae533bb0aaa039a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 9 Jul 2020 09:57:17 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=B5=8B=E8=AF=95updatestoresskus?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 2de228eb7..5bc5529ee 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -1048,7 +1048,6 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs if user := ctx.GetFullUser(); user != nil { isUserCanDirectChangePrice = user.Type&model.UserTypeOperator != 0 } - fmt.Println("test11111111111111111111111111111111111") userName := ctx.GetUserName() needSyncIDMap := make(map[int]int) dao.Begin(db) @@ -1060,12 +1059,12 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs }() for _, storeID := range storeIDs { // todo 可以考虑在需要更新价格再获取 - fmt.Println("test22222222222222222222222222222222222222222") storeDetail, err := dao.GetStoreDetail(dao.GetDB(), storeID, model.VendorIDJX) if err != nil { dao.Rollback(db) return nil, err } + fmt.Println("test22222222222222222222222222222222222222222") scaleFactor := float64(1) if isScale { scaleFactor = 100 / float64(jxutils.ConstrainPayPercentage(storeDetail.PayPercentage)) @@ -1112,7 +1111,6 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs sqlParams = append(sqlParams, skuBindInfo.NameID, utils.DefaultTimeValue) // globals.SugarLogger.Debug(sql) if err = dao.GetRows(db, &allBinds, sql, sqlParams...); err == nil { - fmt.Println("test3333333333333333333333333333333333333333") if len(allBinds) > 0 { // globals.SugarLogger.Debug(utils.Format4Output(allBinds, false)) inSkuBinsMap := make(map[int]*StoreSkuBindSkuInfo, len(inSkuBinds)) @@ -1308,6 +1306,7 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs } } } else { + fmt.Println("test3333333333333333333333333333333333333333") dao.Rollback(db) return nil, err }