From 7c313ecca8c21ac8cc7eeb4b2f2485e5630f401f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 3 Jan 2025 09:21:52 +0800 Subject: [PATCH] 1 --- business/jxstore/cms/system_store_sku.go | 66 +++++++++++------------- business/model/dao/store.go | 2 +- controllers/ebai_callback.go | 4 +- 3 files changed, 34 insertions(+), 38 deletions(-) diff --git a/business/jxstore/cms/system_store_sku.go b/business/jxstore/cms/system_store_sku.go index d4e595883..7b50bbac1 100644 --- a/business/jxstore/cms/system_store_sku.go +++ b/business/jxstore/cms/system_store_sku.go @@ -207,35 +207,35 @@ func CopyMtToMT(ctx *jxcontext.Context, fromStore, toStore *dao.StoreDetail, isA switch step { case 1: // 同步分类 - fromCategoryList, err := fromApi.RetailCatList(fromStore.VendorStoreID) - if len(fromCategoryList) == model.NO { - return nil, err - } - //toCategoryList, err := toApi.RetailCatList(toStore.VendorStoreID) - //if err != nil { + //fromCategoryList, err := fromApi.RetailCatList(fromStore.VendorStoreID) + //if len(fromCategoryList) == model.NO { // return nil, err //} - for _, v := range fromCategoryList { - categoryErr := toApi.RetailCatUpdate(toStore.VendorStoreID, v.Name, &mtwmapi.Param4UpdateCat{ - CategoryCode: v.Code, - Sequence: v.Sequence, - }) - if categoryErr != nil { - globals.SugarLogger.Debugf("err := RetailCatUpdate : %v", categoryErr) - } - if v.Children != nil && len(v.Children) != 0 { - for _, c := range v.Children { - if err3 := toApi.RetailCatUpdate(toStore.VendorStoreID, v.Name, &mtwmapi.Param4UpdateCat{ - CategoryNameOrigin: v.Name, - SecondaryCategoryCode: c.Code, - SecondaryCategoryName: c.Name, - Sequence: c.Sequence, - }); err3 != nil { - globals.SugarLogger.Debugf("err := RetailCatUpdate Children : %v", err3) - } - } - } - } + ////toCategoryList, err := toApi.RetailCatList(toStore.VendorStoreID) + ////if err != nil { + //// return nil, err + ////} + //for _, v := range fromCategoryList { + // categoryErr := toApi.RetailCatUpdate(toStore.VendorStoreID, v.Name, &mtwmapi.Param4UpdateCat{ + // CategoryCode: v.Code, + // Sequence: v.Sequence, + // }) + // if categoryErr != nil { + // globals.SugarLogger.Debugf("err := RetailCatUpdate : %v", categoryErr) + // } + // if v.Children != nil && len(v.Children) != 0 { + // for _, c := range v.Children { + // if err3 := toApi.RetailCatUpdate(toStore.VendorStoreID, v.Name, &mtwmapi.Param4UpdateCat{ + // CategoryNameOrigin: v.Name, + // SecondaryCategoryCode: c.Code, + // SecondaryCategoryName: c.Name, + // Sequence: c.Sequence, + // }); err3 != nil { + // globals.SugarLogger.Debugf("err := RetailCatUpdate Children : %v", err3) + // } + // } + // } + //} case 2: i := offSet @@ -330,7 +330,7 @@ func BatchInitSkuMT2MT(ctx *jxcontext.Context, fromSku []*mtwmapi.AppFood, toApi } }*/ //mapSkuList["available_times"] = string(salesCycle) - mapSkuList["available_times"] = v.AvailableTimes + //mapSkuList["available_times"] = v.AvailableTimes //if v.MinOrderCount != "" { // mapSkuList["min_order_count"] = utils.Str2Int(v.MinOrderCount) //} @@ -362,13 +362,9 @@ func BatchInitSkuMT2MT(ctx *jxcontext.Context, fromSku []*mtwmapi.AppFood, toApi //todo 增加商品必填属性 //foodData["common_attr_value"] = storeSku.CommonAttrValue - if categoryCode := utils.Interface2Int64WithDefault(foodData["category_code"], 0); categoryCode != 0 { - commonAttrValue, err := createCommonAttrValue(toApi, categoryCode, utils.Interface2String(foodData["name"])) - if err == nil { - foodData["common_attr_value"] = commonAttrValue - } else if storeSku.CommonAttrValue != "" && storeSku.CommonAttrValue != "[]" { - foodData["common_attr_value"] = mtwmapi.CommonAttrValueUpdate(storeSku.CommonAttrValue) - } + commonAttrValue, err := createCommonAttrValue(toApi, utils.Interface2Int64WithDefault(foodData["category_code"], 0), utils.Interface2String(foodData["name"])) + if err == nil { + foodData["common_attr_value"] = commonAttrValue } else if storeSku.CommonAttrValue != "" && storeSku.CommonAttrValue != "[]" { foodData["common_attr_value"] = mtwmapi.CommonAttrValueUpdate(storeSku.CommonAttrValue) } diff --git a/business/model/dao/store.go b/business/model/dao/store.go index 5d9754b8a..b004300eb 100644 --- a/business/model/dao/store.go +++ b/business/model/dao/store.go @@ -208,7 +208,7 @@ func GetStoreCourierList2(db *DaoDB, storeIDs, vendorIDs []int, status int, audi } func GetStoresMapList2(db *DaoDB, vendorIDs, storeIDs, storeStatuss []int, status, isSync int, pricePack, name, vendorOrgCode string, mustDirty bool) (storeMapList []*model.StoreMap, err error) { - sql := ` + sql := ` SELECT t1.* FROM store_map t1 JOIN store t2 ON t2.id = t1.store_id AND t2.deleted_at = ? diff --git a/controllers/ebai_callback.go b/controllers/ebai_callback.go index 93656b8e3..7b4f5826c 100644 --- a/controllers/ebai_callback.go +++ b/controllers/ebai_callback.go @@ -20,8 +20,8 @@ func (c *EbaiController) Msg() { if c.Ctx.Input.Method() == http.MethodPost { obj, callbackResponse := api.EbaiAPI.GetCallbackMsg(c.Ctx.Request) if callbackResponse == nil { - vendorStoreId := obj.Body["platform_shop_id"].(string) - if vendorStoreId != "" { + vendorStoreId, _ := utils.TryInterface2Int64(obj.Body["platform_shop_id"]) + if vendorStoreId != 0 { //storeDetail, _ := dao.GetStoreDetailByVendorStoreID(dao.GetDB(), vendorStoreId, model.VendorIDEBAI, "") //if storeDetail == nil { // globals.SugarLogger.Debugf("-----饿百订单非菜市消息推送-%s", utils.Format4Output(obj, false))