From 48cf10b07ce8066332cf65fb9e047bb38eff52ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Wed, 11 Jan 2023 11:05:39 +0800 Subject: [PATCH 01/11] 1 --- business/jxstore/cms/sync2.go | 2 ++ business/model/dao/sku.go | 3 +++ 2 files changed, 5 insertions(+) diff --git a/business/jxstore/cms/sync2.go b/business/jxstore/cms/sync2.go index 800ca15cf..27363835a 100644 --- a/business/jxstore/cms/sync2.go +++ b/business/jxstore/cms/sync2.go @@ -97,6 +97,8 @@ func syncCategories(ctx *jxcontext.Context, db *dao.DaoDB, parentTask tasksch.IT func SyncCategories(ctx *jxcontext.Context, parentTask tasksch.ITask, vendorIDs []int, appOrgCodes []string, catIDs []int, isAsync bool) (hint string, err error) { db := dao.GetDB() catList, err := dao.GetSkuCategoryWithVendor(db, vendorIDs, appOrgCodes, -1, catIDs, true) + globals.SugarLogger.Debug("========catList %s", utils.Format4Output(catList, false)) + globals.SugarLogger.Debug("========err %v", err) if err == nil && len(catList) > 0 { //TODO 同一平台不同账号会有影响needSyncParentIDs,暂不处理 var needSyncParentIDs []int diff --git a/business/model/dao/sku.go b/business/model/dao/sku.go index 2c0033b68..b25aa4fef 100644 --- a/business/model/dao/sku.go +++ b/business/model/dao/sku.go @@ -1,6 +1,7 @@ package dao import ( + "git.rosy.net.cn/jx-callback/globals" "time" "git.rosy.net.cn/baseapi/platformapi/aliupcapi" @@ -290,6 +291,8 @@ func GetSkuCategoryWithVendor(db *DaoDB, vendorIDs []int, appOrgCodes []string, sqlParams = append(sqlParams, parentCatID) } sql += " ORDER BY t1.seq" + globals.SugarLogger.Debug("==sql %s", sql) + globals.SugarLogger.Debug("==sql %s", utils.Format4Output(sqlParams, false)) err = GetRows(db, &catList, sql, sqlParams...) return catList, err } From 4165ee21624ecf3d2bfaad8d83b641fc0153368c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Thu, 12 Jan 2023 10:58:43 +0800 Subject: [PATCH 02/11] 1 --- business/jxstore/cms/sync2.go | 3 +-- business/model/dao/sku.go | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/business/jxstore/cms/sync2.go b/business/jxstore/cms/sync2.go index 27363835a..dcd178aaa 100644 --- a/business/jxstore/cms/sync2.go +++ b/business/jxstore/cms/sync2.go @@ -97,8 +97,6 @@ func syncCategories(ctx *jxcontext.Context, db *dao.DaoDB, parentTask tasksch.IT func SyncCategories(ctx *jxcontext.Context, parentTask tasksch.ITask, vendorIDs []int, appOrgCodes []string, catIDs []int, isAsync bool) (hint string, err error) { db := dao.GetDB() catList, err := dao.GetSkuCategoryWithVendor(db, vendorIDs, appOrgCodes, -1, catIDs, true) - globals.SugarLogger.Debug("========catList %s", utils.Format4Output(catList, false)) - globals.SugarLogger.Debug("========err %v", err) if err == nil && len(catList) > 0 { //TODO 同一平台不同账号会有影响needSyncParentIDs,暂不处理 var needSyncParentIDs []int @@ -144,6 +142,7 @@ func SyncSkus(ctx *jxcontext.Context, parentTask tasksch.ITask, vendorIDs []int, db := dao.GetDB() skuList, err := dao.GetSkusWithVendor(db, vendorIDs, appOrgCodes, nameIDs, skuIDs, true) + globals.SugarLogger.Debug("========skuList %s", utils.Format4Output(skuList, false)) cc := func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { skuVendorInfo := batchItemList[0].(*dao.StoreSkuSyncInfo) var failedList []*partner.StoreSkuInfoWithErr diff --git a/business/model/dao/sku.go b/business/model/dao/sku.go index b25aa4fef..888c1d688 100644 --- a/business/model/dao/sku.go +++ b/business/model/dao/sku.go @@ -291,8 +291,6 @@ func GetSkuCategoryWithVendor(db *DaoDB, vendorIDs []int, appOrgCodes []string, sqlParams = append(sqlParams, parentCatID) } sql += " ORDER BY t1.seq" - globals.SugarLogger.Debug("==sql %s", sql) - globals.SugarLogger.Debug("==sql %s", utils.Format4Output(sqlParams, false)) err = GetRows(db, &catList, sql, sqlParams...) return catList, err } @@ -369,6 +367,8 @@ func GetSkusWithVendor(db *DaoDB, vendorIDs []int, appOrgCodes []string, nameIDs sqlParams = append(sqlParams, skuIDs) } sql += " ORDER BY t1.seq" + globals.SugarLogger.Debug("============sql := %s", sql) + globals.SugarLogger.Debug("==========sqlParams := %s", utils.Format4Output(sqlParams, false)) if err = GetRows(db, &skuList, sql, sqlParams...); err == nil { skuPlaceList, err2 := GetSkuNamePlaces(db, nameIDs, skuIDs) if err = err2; err == nil { From 10b7a6a2a78a5f8ff983c2439d6e568f2b2f1e5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Thu, 12 Jan 2023 14:30:44 +0800 Subject: [PATCH 03/11] 1 --- business/jxstore/cms/store_sku.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 43b26257f..48fbaa035 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -1974,7 +1974,10 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs FOR UPDATE` sqlParams = append(sqlParams, utils.DefaultTimeValue) // globals.SugarLogger.Debug(sql) + globals.SugarLogger.Debug("==========sql %s", sql) + globals.SugarLogger.Debug("==========sqlParams %s", utils.Format4Output(sqlParams, false)) if err = dao.GetRows(db, &allBinds, sql, sqlParams...); err == nil { + globals.SugarLogger.Debug("==========allBinds %s", utils.Format4Output(allBinds, false)) if len(allBinds) > 0 { inSkuBinsMap := make(map[int]*StoreSkuBindSkuInfo, len(inSkuBinds)) for _, v := range inSkuBinds { From 70ca31010d080777ab0d25ddb9f41dcd2020b5ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Thu, 12 Jan 2023 14:47:13 +0800 Subject: [PATCH 04/11] 1 --- business/jxstore/cms/store_sku.go | 3 --- business/jxstore/cms/sync_store_sku.go | 5 +++++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 48fbaa035..43b26257f 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -1974,10 +1974,7 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs FOR UPDATE` sqlParams = append(sqlParams, utils.DefaultTimeValue) // globals.SugarLogger.Debug(sql) - globals.SugarLogger.Debug("==========sql %s", sql) - globals.SugarLogger.Debug("==========sqlParams %s", utils.Format4Output(sqlParams, false)) if err = dao.GetRows(db, &allBinds, sql, sqlParams...); err == nil { - globals.SugarLogger.Debug("==========allBinds %s", utils.Format4Output(allBinds, false)) if len(allBinds) > 0 { inSkuBinsMap := make(map[int]*StoreSkuBindSkuInfo, len(inSkuBinds)) for _, v := range inSkuBinds { diff --git a/business/jxstore/cms/sync_store_sku.go b/business/jxstore/cms/sync_store_sku.go index bc445f14f..3390c3d2f 100644 --- a/business/jxstore/cms/sync_store_sku.go +++ b/business/jxstore/cms/sync_store_sku.go @@ -474,6 +474,8 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag } else { skus, err = dao.GetStoreSkus(db, vendorID, storeID, skuIDs) } + globals.SugarLogger.Debug("==========skus %s", utils.Format4Output(skus, false)) + if err != nil || len(skus) == 0 { return err } @@ -700,6 +702,9 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag // api.JdShop2API.SetCookieWithStr(configs[0].Value) // } } + globals.SugarLogger.Debug("==========createList %s", utils.Format4Output(createList, false)) + globals.SugarLogger.Debug("==========updateList %s", utils.Format4Output(updateList, false)) + task := tasksch.NewParallelTask("syncStoreSkuNew", tasksch.NewParallelConfig().SetParallelCount(1).SetIsContinueWhenError(isContinueWhenError2), ctx, func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { step := batchItemList[0].(int) From 9b7d60807166b6569477fd7aac7364405c2c125c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Thu, 12 Jan 2023 15:54:53 +0800 Subject: [PATCH 05/11] 1 --- business/jxcallback/orderman/orderman_ext.go | 2 +- business/jxcallback/scheduler/defsch/defsch_ext.go | 1 - business/jxstore/cms/store.go | 1 - business/jxstore/cms/sync2.go | 1 - business/jxstore/cms/sync_store_sku.go | 7 ------- business/model/dao/sku.go | 3 --- business/partner/purchase/tiktok_store/store.go | 1 - business/partner/purchase/tiktok_store/warehouse.go | 1 - 8 files changed, 1 insertion(+), 16 deletions(-) diff --git a/business/jxcallback/orderman/orderman_ext.go b/business/jxcallback/orderman/orderman_ext.go index 146f60467..224f2f734 100644 --- a/business/jxcallback/orderman/orderman_ext.go +++ b/business/jxcallback/orderman/orderman_ext.go @@ -458,7 +458,7 @@ func (c *OrderManager) ExportOrders(ctx *jxcontext.Context, fromDateStr, toDateS } } } - orders, _, err = dao.GetOrders(dao.GetDB(), nil, true, true, fromDateStr, toDateStr, true, nil, false, "", mapParams, 0, model.UnlimitedPageSize) + orders, _, err = dao.GetOrders(dao.GetDB(), nil, true, true, fromDateStr, toDateStr, false, nil, false, "", mapParams, 0, model.UnlimitedPageSize) case 1: afsSkuMap, err = c.getAfsOrderSkuInfo4ExportOrders(ctx, fromDateStr, toDateStr) case 2: diff --git a/business/jxcallback/scheduler/defsch/defsch_ext.go b/business/jxcallback/scheduler/defsch/defsch_ext.go index 3981239eb..011b217dc 100644 --- a/business/jxcallback/scheduler/defsch/defsch_ext.go +++ b/business/jxcallback/scheduler/defsch/defsch_ext.go @@ -157,7 +157,6 @@ func (s *DefScheduler) CreateWaybillOnProviders4SavedOrder(ctx *jxcontext.Contex if bills, err = s.CreateWaybillOnProviders(ctx, order, courierVendorIDs, excludeCourierVendorIDs, maxDeliveryFee, forceCreate); err == nil { if forceCreate { order.DeliveryFlag |= model.OrderDeliveryFlagMaskScheduleDisabled - globals.SugarLogger.Debugf("order.DeliveryFlag============%d,order.Status===========%d", order.DeliveryFlag, order.Status) err = partner.CurOrderManager.UpdateOrderStatusAndDeliveryFlag(order) } if err == nil { diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index a51b67d05..9788a251e 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -1707,7 +1707,6 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor if (storeMap.DeliveryFeeDeductionFee > 0 || utils.Str2Int(storeMap.YbStorePrefix) > 0) && vendorID == model.VendorIDDD { DDFlag = true } - globals.SugarLogger.Debugf("ddflag=========%v", DDFlag) if DDFlag { globals.SugarLogger.Debug("进入DDFlag 特殊处理运费模板、起送价、打包费") if err := tiktok_store.SpecialTreat(storeMap.VendorOrgCode, utils.Str2Int64(storeMap.VendorStoreID), int64(storeMap.StoreID), int64(storeMap.DeliveryFeeDeductionFee), utils.Str2Int64(storeMap.YbStorePrefix)); err != nil { diff --git a/business/jxstore/cms/sync2.go b/business/jxstore/cms/sync2.go index dcd178aaa..800ca15cf 100644 --- a/business/jxstore/cms/sync2.go +++ b/business/jxstore/cms/sync2.go @@ -142,7 +142,6 @@ func SyncSkus(ctx *jxcontext.Context, parentTask tasksch.ITask, vendorIDs []int, db := dao.GetDB() skuList, err := dao.GetSkusWithVendor(db, vendorIDs, appOrgCodes, nameIDs, skuIDs, true) - globals.SugarLogger.Debug("========skuList %s", utils.Format4Output(skuList, false)) cc := func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { skuVendorInfo := batchItemList[0].(*dao.StoreSkuSyncInfo) var failedList []*partner.StoreSkuInfoWithErr diff --git a/business/jxstore/cms/sync_store_sku.go b/business/jxstore/cms/sync_store_sku.go index 3390c3d2f..1189a46a0 100644 --- a/business/jxstore/cms/sync_store_sku.go +++ b/business/jxstore/cms/sync_store_sku.go @@ -474,7 +474,6 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag } else { skus, err = dao.GetStoreSkus(db, vendorID, storeID, skuIDs) } - globals.SugarLogger.Debug("==========skus %s", utils.Format4Output(skus, false)) if err != nil || len(skus) == 0 { return err @@ -540,10 +539,6 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag if singleStoreHandler == nil { if dao.IsVendorThingIDEmpty(sku.VendorSkuID) { // todo 多平台商品库没有正常创建,直接跳过 - // 这是打的补,可以删除掉感觉 - //if sku.VendorOrgCode == "379599" { // 水果的果切 - // createList = append(createList, sku) - //} } else { sku.SkuSyncStatus |= model.SyncFlagSaleMask | model.SyncFlagPriceMask bareSku = storeSkuSyncInfo2Bare(sku) @@ -702,8 +697,6 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag // api.JdShop2API.SetCookieWithStr(configs[0].Value) // } } - globals.SugarLogger.Debug("==========createList %s", utils.Format4Output(createList, false)) - globals.SugarLogger.Debug("==========updateList %s", utils.Format4Output(updateList, false)) task := tasksch.NewParallelTask("syncStoreSkuNew", tasksch.NewParallelConfig().SetParallelCount(1).SetIsContinueWhenError(isContinueWhenError2), ctx, func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { diff --git a/business/model/dao/sku.go b/business/model/dao/sku.go index 888c1d688..2c0033b68 100644 --- a/business/model/dao/sku.go +++ b/business/model/dao/sku.go @@ -1,7 +1,6 @@ package dao import ( - "git.rosy.net.cn/jx-callback/globals" "time" "git.rosy.net.cn/baseapi/platformapi/aliupcapi" @@ -367,8 +366,6 @@ func GetSkusWithVendor(db *DaoDB, vendorIDs []int, appOrgCodes []string, nameIDs sqlParams = append(sqlParams, skuIDs) } sql += " ORDER BY t1.seq" - globals.SugarLogger.Debug("============sql := %s", sql) - globals.SugarLogger.Debug("==========sqlParams := %s", utils.Format4Output(sqlParams, false)) if err = GetRows(db, &skuList, sql, sqlParams...); err == nil { skuPlaceList, err2 := GetSkuNamePlaces(db, nameIDs, skuIDs) if err = err2; err == nil { diff --git a/business/partner/purchase/tiktok_store/store.go b/business/partner/purchase/tiktok_store/store.go index 027df2c61..d50e6f3a6 100644 --- a/business/partner/purchase/tiktok_store/store.go +++ b/business/partner/purchase/tiktok_store/store.go @@ -1022,7 +1022,6 @@ type RelInfo struct { func ToStringSlice(actual interface{}) ([]string, error) { var res []string value := reflect.ValueOf(actual) - globals.SugarLogger.Debugf("value.Kind()=========%s", value.Kind()) if value.Kind() != reflect.Slice || value.Kind() != reflect.Array { return nil, errors.New("parse error") } diff --git a/business/partner/purchase/tiktok_store/warehouse.go b/business/partner/purchase/tiktok_store/warehouse.go index 10a1fb407..0afc132cd 100644 --- a/business/partner/purchase/tiktok_store/warehouse.go +++ b/business/partner/purchase/tiktok_store/warehouse.go @@ -300,7 +300,6 @@ func SpecialTreat(vendorOrgCode string, vendorStoreID, storeID, deliveryFeeDeduc } } else { //更新为起送价模板 if updateSaleLimitID, err := UpdateTradeLimitTemplate(vendorOrgCode, bindSaleLimitID, minPrice); err != nil { - globals.SugarLogger.Debugf("进入更新门店起送价限售模板,minPrice=======%d", minPrice) errList.AddErr(fmt.Errorf("更新门店起送价限售模板失败:%v", err)) } else { FreightTemplate.TradeLimitID = updateSaleLimitID From ac3b3e54a2668563b86950f26fbb4ce073dbad20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Thu, 12 Jan 2023 16:47:22 +0800 Subject: [PATCH 06/11] 1 --- business/jxstore/cms/store_sku.go | 1 + controllers/cms_sync.go | 2 ++ 2 files changed, 3 insertions(+) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 43b26257f..b306cd509 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -1735,6 +1735,7 @@ func UpdateStoresSkus(ctx *jxcontext.Context, causeFlag int, storeIDs []int, sku isAsync = asyncStoreSkuOpFilter(ctx, isAsync) num = int64(len(skuIDs)) if num > 0 { + globals.SugarLogger.Debug("====UpdateStoresSkus causeFlag[%d],vendorIds[%d],storeIDs[%s],skuIDs[%s],isForce[%s],isAsync[%s],isContinueWhenError[%s]", causeFlag, utils.Format4Output("", false), utils.Format4Output(storeIDs, false), utils.Format4Output(skuIDs, false), utils.Format4Output("false", false), utils.Format4Output(isAsync, false), utils.Format4Output(isContinueWhenError, false)) hint, err = CurVendorSync.SyncStoresSkus(ctx, nil, causeFlag, db, nil, storeIDs, skuIDs, false, isAsync, isContinueWhenError) } if num == 0 || !isAsync || hint == "" { diff --git a/controllers/cms_sync.go b/controllers/cms_sync.go index 6444747fe..f99655c29 100644 --- a/controllers/cms_sync.go +++ b/controllers/cms_sync.go @@ -3,6 +3,7 @@ package controllers import ( "fmt" "git.rosy.net.cn/jx-callback/business/jxutils/jxcontext" + "git.rosy.net.cn/jx-callback/globals" "github.com/panjf2000/ants" "io" "sync" @@ -38,6 +39,7 @@ func (c *SyncController) SyncStoresSkus() { if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs, params.SkuIDs, &skuIDs, params.VendorIDs, &vendorIDs); err != nil { return retVal, "", err } + globals.SugarLogger.Debug("====SyncStoresSkus causeFlag[%d],vendorIds[%d],storeIDs[%s],skuIDs[%s],isForce[%s],isAsync[%s],isContinueWhenError[%s]", 0, utils.Format4Output(vendorIDs, false), utils.Format4Output(storeIDs, false), utils.Format4Output(skuIDs, false), utils.Format4Output(params.IsForce, false), utils.Format4Output(params.IsAsync, false), utils.Format4Output(params.IsContinueWhenError, false)) retVal, err = cms.CurVendorSync.SyncStoresSkus(params.Ctx, nil, 0, db, vendorIDs, storeIDs, skuIDs, params.IsForce, params.IsAsync, params.IsContinueWhenError) return retVal, "", err }) From 7bd1b7053870b8578097790f621a68f742dc7b55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 13 Jan 2023 09:33:12 +0800 Subject: [PATCH 07/11] 1 --- controllers/cms_sync.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/controllers/cms_sync.go b/controllers/cms_sync.go index f99655c29..4495f6634 100644 --- a/controllers/cms_sync.go +++ b/controllers/cms_sync.go @@ -40,7 +40,8 @@ func (c *SyncController) SyncStoresSkus() { return retVal, "", err } globals.SugarLogger.Debug("====SyncStoresSkus causeFlag[%d],vendorIds[%d],storeIDs[%s],skuIDs[%s],isForce[%s],isAsync[%s],isContinueWhenError[%s]", 0, utils.Format4Output(vendorIDs, false), utils.Format4Output(storeIDs, false), utils.Format4Output(skuIDs, false), utils.Format4Output(params.IsForce, false), utils.Format4Output(params.IsAsync, false), utils.Format4Output(params.IsContinueWhenError, false)) - retVal, err = cms.CurVendorSync.SyncStoresSkus(params.Ctx, nil, 0, db, vendorIDs, storeIDs, skuIDs, params.IsForce, params.IsAsync, params.IsContinueWhenError) + //retVal, err = cms.CurVendorSync.SyncStoresSkus(params.Ctx, nil, 0, db, vendorIDs, storeIDs, skuIDs, params.IsForce, params.IsAsync, params.IsContinueWhenError) + retVal, err = cms.CurVendorSync.SyncStoresSkus(params.Ctx, nil, 0, db, vendorIDs, storeIDs, skuIDs, false, false, false) return retVal, "", err }) } From 4fdd3d76abbdbdb72774f3aed6f4c64bdbccdfd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 13 Jan 2023 09:58:47 +0800 Subject: [PATCH 08/11] 1 --- business/jxstore/cms/store_sku.go | 5 ++--- business/jxstore/cms/sync_store_sku.go | 3 +++ controllers/cms_sync.go | 5 +---- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index b306cd509..4578864cc 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -1728,14 +1728,13 @@ func UpdateStoresSkus(ctx *jxcontext.Context, causeFlag int, storeIDs []int, sku if !flag { var num int64 db := dao.GetDB() - skuIDs, err := updateStoresSkusWithoutSync(ctx, db, storeIDs, skuBindInfos, isScale, isRefreshHigh) + skuIDs, err := updateStoresSkusWithoutSync(ctx, db, storeIDs, skuBindInfos, isScale, isRefreshHigh) // 这个方法再通知京东创建商品 if err != nil { return "", err } isAsync = asyncStoreSkuOpFilter(ctx, isAsync) num = int64(len(skuIDs)) - if num > 0 { - globals.SugarLogger.Debug("====UpdateStoresSkus causeFlag[%d],vendorIds[%d],storeIDs[%s],skuIDs[%s],isForce[%s],isAsync[%s],isContinueWhenError[%s]", causeFlag, utils.Format4Output("", false), utils.Format4Output(storeIDs, false), utils.Format4Output(skuIDs, false), utils.Format4Output("false", false), utils.Format4Output(isAsync, false), utils.Format4Output(isContinueWhenError, false)) + if num > 0 { // 这个方法非京东的创建商品,京东的改为同步库存,上下架等! hint, err = CurVendorSync.SyncStoresSkus(ctx, nil, causeFlag, db, nil, storeIDs, skuIDs, false, isAsync, isContinueWhenError) } if num == 0 || !isAsync || hint == "" { diff --git a/business/jxstore/cms/sync_store_sku.go b/business/jxstore/cms/sync_store_sku.go index 1189a46a0..35c4cd254 100644 --- a/business/jxstore/cms/sync_store_sku.go +++ b/business/jxstore/cms/sync_store_sku.go @@ -202,6 +202,7 @@ func SyncStoreSkuNew2(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFla func FullSyncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, vendorID, storeID int, vendorStoreID string, excludeSkuIDs []int, isAsync, isContinueWhenError bool) (hint string, err error) { singleStoreHandler, _ := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.ISingleStoreStoreSkuHandler) + globals.SugarLogger.Debugf("====singleStoreHandler==== %s", utils.Format4Output(singleStoreHandler, false)) task := tasksch.NewParallelTask("FullSyncStoreSkuNew", tasksch.NewParallelConfig().SetParallelCount(1).SetIsContinueWhenError(isContinueWhenError), ctx, func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { step := batchItemList[0].(int) @@ -215,8 +216,10 @@ func FullSyncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, vendo } case 1: if singleStoreHandler != nil { + // 同步分类在同步商品 _, err = SyncStoreSkuNew(ctx, task, 0, vendorID, storeID, vendorStoreID, "", nil, nil, excludeSkuIDs, false, isContinueWhenError) } else { + // 直接同步商品 err = syncStoreSkuNew(ctx, task, 0, true, vendorID, storeID, "", nil, nil, excludeSkuIDs, false, isContinueWhenError) } } diff --git a/controllers/cms_sync.go b/controllers/cms_sync.go index 4495f6634..6444747fe 100644 --- a/controllers/cms_sync.go +++ b/controllers/cms_sync.go @@ -3,7 +3,6 @@ package controllers import ( "fmt" "git.rosy.net.cn/jx-callback/business/jxutils/jxcontext" - "git.rosy.net.cn/jx-callback/globals" "github.com/panjf2000/ants" "io" "sync" @@ -39,9 +38,7 @@ func (c *SyncController) SyncStoresSkus() { if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs, params.SkuIDs, &skuIDs, params.VendorIDs, &vendorIDs); err != nil { return retVal, "", err } - globals.SugarLogger.Debug("====SyncStoresSkus causeFlag[%d],vendorIds[%d],storeIDs[%s],skuIDs[%s],isForce[%s],isAsync[%s],isContinueWhenError[%s]", 0, utils.Format4Output(vendorIDs, false), utils.Format4Output(storeIDs, false), utils.Format4Output(skuIDs, false), utils.Format4Output(params.IsForce, false), utils.Format4Output(params.IsAsync, false), utils.Format4Output(params.IsContinueWhenError, false)) - //retVal, err = cms.CurVendorSync.SyncStoresSkus(params.Ctx, nil, 0, db, vendorIDs, storeIDs, skuIDs, params.IsForce, params.IsAsync, params.IsContinueWhenError) - retVal, err = cms.CurVendorSync.SyncStoresSkus(params.Ctx, nil, 0, db, vendorIDs, storeIDs, skuIDs, false, false, false) + retVal, err = cms.CurVendorSync.SyncStoresSkus(params.Ctx, nil, 0, db, vendorIDs, storeIDs, skuIDs, params.IsForce, params.IsAsync, params.IsContinueWhenError) return retVal, "", err }) } From 44f4cb0cbd46ae3407f49e9943b6203c7d4e20ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 13 Jan 2023 11:14:04 +0800 Subject: [PATCH 09/11] 1 --- business/jxstore/cms/sync_store_sku.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/business/jxstore/cms/sync_store_sku.go b/business/jxstore/cms/sync_store_sku.go index 35c4cd254..39cb9b1ae 100644 --- a/business/jxstore/cms/sync_store_sku.go +++ b/business/jxstore/cms/sync_store_sku.go @@ -184,9 +184,11 @@ func SyncStoreSkuNew2(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFla switch step { case 0: if singleStoreHandler != nil { + globals.SugarLogger.Debugf("==SyncStoreCategories===") _, err = SyncStoreCategories(ctx, task, vendorID, storeID, vendorStoreID, nameIDs, skuIDs, false, isContinueWhenError) } case 1: + globals.SugarLogger.Debugf("==syncStoreSkuNew===") err = syncStoreSkuNew(ctx, task, causeFlag, false, vendorID, storeID, vendorOrgCode, nameIDs, skuIDs, excludeSkuIDs, useVendorPriceDirectly, isContinueWhenError) } return result, err @@ -209,17 +211,21 @@ func FullSyncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, vendo switch step { case 0: if singleStoreHandler != nil { + globals.SugarLogger.Debugf("amendAndPruneStoreStuff --------[%d]", storeID) // _, err = ClearRemoteStoreStuffAndSetNew(ctx, task, vendorID, storeID, vendorStoreID, false, isContinueWhenError) _, err = amendAndPruneStoreStuff(ctx, parentTask, vendorID, storeID, vendorStoreID, false, isContinueWhenError, AmendPruneAll, false) } else { + globals.SugarLogger.Debugf("SetStoreSkuSyncStatus --------[%d]", storeID) _, err = dao.SetStoreSkuSyncStatus(dao.GetDB(), vendorID, []int{storeID}, nil, model.SyncFlagStoreSkuOnlyMask) } case 1: if singleStoreHandler != nil { // 同步分类在同步商品 + globals.SugarLogger.Debugf("SyncStoreSkuNew --------[%d]", storeID) _, err = SyncStoreSkuNew(ctx, task, 0, vendorID, storeID, vendorStoreID, "", nil, nil, excludeSkuIDs, false, isContinueWhenError) } else { // 直接同步商品 + globals.SugarLogger.Debugf("syncStoreSkuNew --------[%d]", storeID) err = syncStoreSkuNew(ctx, task, 0, true, vendorID, storeID, "", nil, nil, excludeSkuIDs, false, isContinueWhenError) } } From 04fdd63b39b95ee37cb0a919924645b687e9e8f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 13 Jan 2023 11:45:27 +0800 Subject: [PATCH 10/11] 1 --- business/jxstore/cms/sync_store_sku.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/business/jxstore/cms/sync_store_sku.go b/business/jxstore/cms/sync_store_sku.go index 39cb9b1ae..729a723c9 100644 --- a/business/jxstore/cms/sync_store_sku.go +++ b/business/jxstore/cms/sync_store_sku.go @@ -204,28 +204,23 @@ func SyncStoreSkuNew2(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFla func FullSyncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, vendorID, storeID int, vendorStoreID string, excludeSkuIDs []int, isAsync, isContinueWhenError bool) (hint string, err error) { singleStoreHandler, _ := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.ISingleStoreStoreSkuHandler) - globals.SugarLogger.Debugf("====singleStoreHandler==== %s", utils.Format4Output(singleStoreHandler, false)) task := tasksch.NewParallelTask("FullSyncStoreSkuNew", tasksch.NewParallelConfig().SetParallelCount(1).SetIsContinueWhenError(isContinueWhenError), ctx, func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { step := batchItemList[0].(int) switch step { case 0: if singleStoreHandler != nil { - globals.SugarLogger.Debugf("amendAndPruneStoreStuff --------[%d]", storeID) // _, err = ClearRemoteStoreStuffAndSetNew(ctx, task, vendorID, storeID, vendorStoreID, false, isContinueWhenError) _, err = amendAndPruneStoreStuff(ctx, parentTask, vendorID, storeID, vendorStoreID, false, isContinueWhenError, AmendPruneAll, false) } else { - globals.SugarLogger.Debugf("SetStoreSkuSyncStatus --------[%d]", storeID) _, err = dao.SetStoreSkuSyncStatus(dao.GetDB(), vendorID, []int{storeID}, nil, model.SyncFlagStoreSkuOnlyMask) } case 1: if singleStoreHandler != nil { // 同步分类在同步商品 - globals.SugarLogger.Debugf("SyncStoreSkuNew --------[%d]", storeID) _, err = SyncStoreSkuNew(ctx, task, 0, vendorID, storeID, vendorStoreID, "", nil, nil, excludeSkuIDs, false, isContinueWhenError) } else { // 直接同步商品 - globals.SugarLogger.Debugf("syncStoreSkuNew --------[%d]", storeID) err = syncStoreSkuNew(ctx, task, 0, true, vendorID, storeID, "", nil, nil, excludeSkuIDs, false, isContinueWhenError) } } @@ -706,6 +701,17 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag // api.JdShop2API.SetCookieWithStr(configs[0].Value) // } } + if vendorOrgCode == "381564" { + globals.SugarLogger.Debugf("createList=== %s", utils.Format4Output(createList, false)) + globals.SugarLogger.Debugf("updateList=== %s", utils.Format4Output(updateList, false)) + globals.SugarLogger.Debugf("deleteList=== %s", utils.Format4Output(deleteList, false)) + globals.SugarLogger.Debugf("stockList=== %s", utils.Format4Output(stockList, false)) + globals.SugarLogger.Debugf("onlineList=== %s", utils.Format4Output(onlineList, false)) + globals.SugarLogger.Debugf("offlineList=== %s", utils.Format4Output(offlineList, false)) + globals.SugarLogger.Debugf("priceList=== %s", utils.Format4Output(priceList, false)) + globals.SugarLogger.Debugf("updateItems=== %s", utils.Format4Output(updateItems, false)) + globals.SugarLogger.Debugf("reorderSkuMap=== %s", utils.Format4Output(reorderSkuMap, false)) + } task := tasksch.NewParallelTask("syncStoreSkuNew", tasksch.NewParallelConfig().SetParallelCount(1).SetIsContinueWhenError(isContinueWhenError2), ctx, func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { From 598a95711377dbf89a90fd9651e7d4613e01c252 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 13 Jan 2023 11:50:49 +0800 Subject: [PATCH 11/11] 1 --- business/jxstore/cms/sync_store_sku.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxstore/cms/sync_store_sku.go b/business/jxstore/cms/sync_store_sku.go index 729a723c9..1f7d5fbe4 100644 --- a/business/jxstore/cms/sync_store_sku.go +++ b/business/jxstore/cms/sync_store_sku.go @@ -701,7 +701,7 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag // api.JdShop2API.SetCookieWithStr(configs[0].Value) // } } - if vendorOrgCode == "381564" { + if storeID == 668767 { globals.SugarLogger.Debugf("createList=== %s", utils.Format4Output(createList, false)) globals.SugarLogger.Debugf("updateList=== %s", utils.Format4Output(updateList, false)) globals.SugarLogger.Debugf("deleteList=== %s", utils.Format4Output(deleteList, false))