From 597fd329c44684ce714facc848d31329ac8e9c1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Thu, 23 Mar 2023 14:48:25 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sku.go | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/business/jxstore/cms/sku.go b/business/jxstore/cms/sku.go index 5591683d1..42885d0be 100644 --- a/business/jxstore/cms/sku.go +++ b/business/jxstore/cms/sku.go @@ -1150,6 +1150,7 @@ type aa struct { func getCategoryByName(name string) string { handler, _ := partner.GetPurchasePlatformFromVendorID(model.VendorIDJD).(partner.IPurchasePlatformStoreSkuHandler) vendorCategoryId, _ := handler.GetSkuCategoryIdByName(beego.AppConfig.DefaultString("jdOrgCode", "320406"), name) + globals.SugarLogger.Debugf("getCategoryByName vendorCategoryId :%s", vendorCategoryId) return vendorCategoryId } @@ -1157,11 +1158,13 @@ func getCategoryByName(name string) string { func getCategoryByImg(img string) string { handler, _ := partner.GetPurchasePlatformFromVendorID(model.VendorIDDD).(partner.IPurchasePlatformStoreSkuHandler) vendorCategoryId, _ := handler.GetSkuCategoryIdByName("57939570", img) + globals.SugarLogger.Debugf("getCategoryByImg vendorCategoryId :%s", vendorCategoryId) return vendorCategoryId } // 根据平台返回的分类id,获取本地绑定的映射分类id func getJDCategoryLoadingLocalCategoryReflex(jdCategoryId, jdsCategoryID, ebaiCategoryID, mtwmCategoryID string) (string, string, string) { + globals.SugarLogger.Debugf("getJDCategoryLoadingLocalCategoryReflex 1111: %s,%s,%s,%s", jdCategoryId, jdsCategoryID, ebaiCategoryID, mtwmCategoryID) cats, err := dao.GetCategoriesByName(dao.GetDB(), "", jdCategoryId) if len(cats) == 0 || err != nil { globals.SugarLogger.Errorf("%v", fmt.Errorf("根据京东分类id设置美团/饿了么分类错误:%d,%v", len(cats), err)) @@ -1177,6 +1180,7 @@ func getJDCategoryLoadingLocalCategoryReflex(jdCategoryId, jdsCategoryID, ebaiCa mtwmCategoryID = utils.Int64ToStr(cats[0].MtwmCategoryID) } } + globals.SugarLogger.Debugf("getJDCategoryLoadingLocalCategoryReflex 2222: %s,%s,%s,%s", jdCategoryId, jdsCategoryID, ebaiCategoryID, mtwmCategoryID) return jdsCategoryID, ebaiCategoryID, mtwmCategoryID } @@ -1215,6 +1219,7 @@ func updateOrCreateSkuVendorCategoryMap(db *dao.DaoDB, ctx *jxcontext.Context, n mtwmCategoryID := "" ddCategoryID := "" if skuNameExt != nil { + globals.SugarLogger.Debugf("======skuNameExt :%s", utils.Format4Output(skuNameExt, false)) if skuNameExt.JdCategoryID != "" { jdCategoryId = skuNameExt.JdCategoryID } else { @@ -1237,6 +1242,7 @@ func updateOrCreateSkuVendorCategoryMap(db *dao.DaoDB, ctx *jxcontext.Context, n ddCategoryID = getCategoryByImg(imgs) } } else { + globals.SugarLogger.Debugf("======payload :%s", utils.Format4Output(payload, false)) if payload["jdCategoryID"] != nil { jdCategoryId = payload["jdCategoryID"].(string) } else { @@ -1259,23 +1265,29 @@ func updateOrCreateSkuVendorCategoryMap(db *dao.DaoDB, ctx *jxcontext.Context, n } } - if jdsCategoryID != "" { + globals.SugarLogger.Debugf("jdsCategoryID:%s", jdsCategoryID) + globals.SugarLogger.Debugf("ebaiCategoryID:%s", ebaiCategoryID) + globals.SugarLogger.Debugf("mtwmCategoryID:%s", mtwmCategoryID) + globals.SugarLogger.Debugf("ddCategoryID:%s", ddCategoryID) + globals.SugarLogger.Debugf("jdCategoryId:%s", jdCategoryId) + + if jdsCategoryID != "" && jdsCategoryID != "0" { updateOrCreate(model.VendorIDJDShop, nameID, jdsCategoryID) flag = true } - if ebaiCategoryID != "" { + if ebaiCategoryID != "" && ebaiCategoryID != "0" { updateOrCreate(model.VendorIDEBAI, nameID, ebaiCategoryID) flag = true } - if mtwmCategoryID != "" { + if mtwmCategoryID != "" && mtwmCategoryID != "0" { updateOrCreate(model.VendorIDMTWM, nameID, mtwmCategoryID) flag = true } - if ddCategoryID != "" { + if ddCategoryID != "" && ddCategoryID != "0" { updateOrCreate(model.VendorIDDD, nameID, ddCategoryID) flag = true } - if jdCategoryId != "" { + if jdCategoryId != "" && jdCategoryId != "0" { updateOrCreate(model.VendorIDJD, nameID, jdCategoryId) flag = true } From 653238fe3c3f6b2a8ea3172a83aee9f0a0f0b859 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Thu, 23 Mar 2023 14:59:38 +0800 Subject: [PATCH 2/2] 1 --- business/jxstore/cms/sku.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/business/jxstore/cms/sku.go b/business/jxstore/cms/sku.go index 42885d0be..3a12e93ed 100644 --- a/business/jxstore/cms/sku.go +++ b/business/jxstore/cms/sku.go @@ -1149,16 +1149,18 @@ type aa struct { // 根据名称获取商品分类[京东] func getCategoryByName(name string) string { handler, _ := partner.GetPurchasePlatformFromVendorID(model.VendorIDJD).(partner.IPurchasePlatformStoreSkuHandler) - vendorCategoryId, _ := handler.GetSkuCategoryIdByName(beego.AppConfig.DefaultString("jdOrgCode", "320406"), name) + vendorCategoryId, err := handler.GetSkuCategoryIdByName("320406", name) globals.SugarLogger.Debugf("getCategoryByName vendorCategoryId :%s", vendorCategoryId) + globals.SugarLogger.Debugf("getCategoryByName err :%v", err) return vendorCategoryId } // 获取抖音商品分类[抖音] func getCategoryByImg(img string) string { handler, _ := partner.GetPurchasePlatformFromVendorID(model.VendorIDDD).(partner.IPurchasePlatformStoreSkuHandler) - vendorCategoryId, _ := handler.GetSkuCategoryIdByName("57939570", img) + vendorCategoryId, err := handler.GetSkuCategoryIdByName("57939570", img) globals.SugarLogger.Debugf("getCategoryByImg vendorCategoryId :%s", vendorCategoryId) + globals.SugarLogger.Debugf("getCategoryByImg err :%v", err) return vendorCategoryId }