From 66e7ddbea02fdb97b478b6dde86ee2ffa80cdff3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 24 Mar 2023 13:59:39 +0800 Subject: [PATCH 1/4] 1 --- business/jxstore/cms/sku.go | 18 +++++++++++++----- business/partner/purchase/ebai/financial.go | 5 +++++ business/partner/purchase/ebai/waybill.go | 2 ++ 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/business/jxstore/cms/sku.go b/business/jxstore/cms/sku.go index e75b1b06c..a8fb5412a 100644 --- a/business/jxstore/cms/sku.go +++ b/business/jxstore/cms/sku.go @@ -1168,10 +1168,10 @@ func getCategoryByImg(img ...string) string { } // 根据平台返回的分类id,获取本地绑定的映射分类id -func getJDCategoryLoadingLocalCategoryReflex(jdCategoryId, jdsCategoryID, ebaiCategoryID, mtwmCategoryID string) (string, string, string) { +func getJDCategoryLoadingLocalCategoryReflex(jdCategoryId, jdsCategoryID, ebaiCategoryID, mtwmCategoryID string, jxCategoryId int) (string, string, string, int) { cats, err := dao.GetCategoriesByName(dao.GetDB(), "", jdCategoryId) if len(cats) == 0 || err != nil { - return jdsCategoryID, ebaiCategoryID, mtwmCategoryID + return jdsCategoryID, ebaiCategoryID, mtwmCategoryID, 0 } else { if jdsCategoryID == "" && cats[0].JdsCategoryID != 0 { jdsCategoryID = utils.Int64ToStr(cats[0].JdsCategoryID) @@ -1182,8 +1182,11 @@ func getJDCategoryLoadingLocalCategoryReflex(jdCategoryId, jdsCategoryID, ebaiCa if mtwmCategoryID == "" && cats[0].MtwmCategoryID != 0 { mtwmCategoryID = utils.Int64ToStr(cats[0].MtwmCategoryID) } + if jxCategoryId == 0 { + jxCategoryId = cats[0].ID + } } - return jdsCategoryID, ebaiCategoryID, mtwmCategoryID + return jdsCategoryID, ebaiCategoryID, mtwmCategoryID, jxCategoryId } func updateOrCreateSkuVendorCategoryMap(db *dao.DaoDB, ctx *jxcontext.Context, nameID int, payload map[string]interface{}, skuNameExt *model.SkuNameExt, isDelete bool) (flag bool) { @@ -1220,6 +1223,7 @@ func updateOrCreateSkuVendorCategoryMap(db *dao.DaoDB, ctx *jxcontext.Context, n ebaiCategoryID := "" mtwmCategoryID := "" ddCategoryID := "" + jxCategoryID := 0 if skuNameExt != nil { if skuNameExt.JdCategoryID != "" { jdCategoryId = skuNameExt.JdCategoryID @@ -1228,11 +1232,12 @@ func updateOrCreateSkuVendorCategoryMap(db *dao.DaoDB, ctx *jxcontext.Context, n } if jdCategoryId != "" && jdCategoryId != "0" { - jdsCategoryID, ebaiCategoryID, mtwmCategoryID = getJDCategoryLoadingLocalCategoryReflex(jdCategoryId, skuNameExt.JdsCategoryID, skuNameExt.EbaiCategoryID, skuNameExt.MtwmCategoryID) + jdsCategoryID, ebaiCategoryID, mtwmCategoryID, jxCategoryID = getJDCategoryLoadingLocalCategoryReflex(jdCategoryId, skuNameExt.JdsCategoryID, skuNameExt.EbaiCategoryID, skuNameExt.MtwmCategoryID, skuNameExt.CategoryID) } else { jdsCategoryID = skuNameExt.JdsCategoryID ebaiCategoryID = skuNameExt.EbaiCategoryID mtwmCategoryID = skuNameExt.MtwmCategoryID + jxCategoryID = skuNameExt.CategoryID } if skuNameExt.DdCategoryID != "" { @@ -1257,9 +1262,12 @@ func updateOrCreateSkuVendorCategoryMap(db *dao.DaoDB, ctx *jxcontext.Context, n if payload["mtwmCategoryID"] != nil { mtwmCategoryID = payload["mtwmCategoryID"].(string) } + if payload["categoryID2"] != nil { + jxCategoryID = payload["categoryID2"].(int) + } if jdCategoryId != "" { - jdsCategoryID, ebaiCategoryID, mtwmCategoryID = getJDCategoryLoadingLocalCategoryReflex(jdCategoryId, jdsCategoryID, ebaiCategoryID, mtwmCategoryID) + jdsCategoryID, ebaiCategoryID, mtwmCategoryID, jxCategoryID = getJDCategoryLoadingLocalCategoryReflex(jdCategoryId, jdsCategoryID, ebaiCategoryID, mtwmCategoryID, jxCategoryID) } if payload["ddCategoryID"] != nil { diff --git a/business/partner/purchase/ebai/financial.go b/business/partner/purchase/ebai/financial.go index 0381d8922..3058f8f44 100644 --- a/business/partner/purchase/ebai/financial.go +++ b/business/partner/purchase/ebai/financial.go @@ -50,6 +50,11 @@ func (p *PurchaseHandler) onFinancialMsg(msg *ebaiapi.CallbackMsg) (response *eb if err == nil { err = CurPurchaseHandler.OnOrderDetail(orderMap, partner.UpdatedPeration) } + // 部分订单在隐私条约的保护下会隐藏用户收货地址,转自送成功自后才可以获取到正确的地址. + userMap := orderMap["user"].(map[string]interface{}) + order, _ := partner.CurOrderManager.LoadOrder(vendorOrderID, model.VendorIDEBAI) + order.ConsigneeAddress = utils.Interface2String(userMap["address"]) + partner.CurOrderManager.UpdateOrderFields(order, []string{"ConsigneeMobile"}) } } return api.EbaiAPI.Err2CallbackResponse(msg.Cmd, err, msg.Cmd) diff --git a/business/partner/purchase/ebai/waybill.go b/business/partner/purchase/ebai/waybill.go index 5b7569e4e..432e9a332 100644 --- a/business/partner/purchase/ebai/waybill.go +++ b/business/partner/purchase/ebai/waybill.go @@ -67,6 +67,8 @@ func (c *PurchaseHandler) onWaybillMsg(msg *ebaiapi.CallbackMsg) (retVal *ebaiap } }) } + vendorStatus := utils.Int64ToStr(utils.MustInterface2Int64(msg.Body["status"])) + return api.EbaiAPI.Err2CallbackResponse(msg.Cmd, partner.CurOrderManager.OnWaybillStatusChanged(order), order.VendorStatus) } From 1ed6bd3b7307d44345f6490c389a6257529f481a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 24 Mar 2023 16:30:22 +0800 Subject: [PATCH 2/4] 1 --- business/jxstore/act/act.go | 8 +++++++- business/partner/purchase/ebai/waybill.go | 2 -- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/business/jxstore/act/act.go b/business/jxstore/act/act.go index 5ad9861fd..cf99ad0cd 100644 --- a/business/jxstore/act/act.go +++ b/business/jxstore/act/act.go @@ -2004,7 +2004,9 @@ func RrefreshMtwmVendorAct(ctx *jxcontext.Context) (err error) { storeMap := batchItemList[0].(*model.StoreMap) mtapi := mtwm.GetAPI(storeMap.VendorOrgCode, storeMap.StoreID, "") for k, v := range actTypeMap { - if actList, _ := mtapi.RetailDiscountList(storeMap.VendorStoreID, k); len(actList) > 0 { + // 查询所有美团门店的折扣和爆款商品 + actList, _ := mtapi.RetailDiscountList(storeMap.VendorStoreID, k) + if len(actList) > 0 { for _, act := range actList { if act.Status > 0 { if checkActStoreSkuExist(db, storeMap.StoreID, utils.Str2Int(act.AppFoodCode), model.VendorIDMTWM, utils.Timestamp2Time(act.StartTime), utils.Timestamp2Time(act.EndTime)) { @@ -2030,6 +2032,10 @@ func RrefreshMtwmVendorAct(ctx *jxcontext.Context) (err error) { } } } + // 查询门店爆款商品,当门店存在爆款时,取消之前的力荐商品,将新的爆款设置为力荐商品 + if k == mtwmapi.RetailActTypeSecKill && len(actList) > 0 { + + } } } return retVal, err diff --git a/business/partner/purchase/ebai/waybill.go b/business/partner/purchase/ebai/waybill.go index 432e9a332..5b7569e4e 100644 --- a/business/partner/purchase/ebai/waybill.go +++ b/business/partner/purchase/ebai/waybill.go @@ -67,8 +67,6 @@ func (c *PurchaseHandler) onWaybillMsg(msg *ebaiapi.CallbackMsg) (retVal *ebaiap } }) } - vendorStatus := utils.Int64ToStr(utils.MustInterface2Int64(msg.Body["status"])) - return api.EbaiAPI.Err2CallbackResponse(msg.Cmd, partner.CurOrderManager.OnWaybillStatusChanged(order), order.VendorStatus) } From 5446166708a14a02e6beafe891e084395207e0b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 24 Mar 2023 16:54:28 +0800 Subject: [PATCH 3/4] 1 --- business/partner/purchase/jd/store.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/business/partner/purchase/jd/store.go b/business/partner/purchase/jd/store.go index b9ae1feff..cef5208e5 100644 --- a/business/partner/purchase/jd/store.go +++ b/business/partner/purchase/jd/store.go @@ -204,12 +204,15 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin } storeParams.StoreNotice = store.PromoteInfo modifyCloseStatus := false + //storeParams.CloseStatus = store.JdStoreStatus if store.SyncStatus&(model.SyncFlagNewMask|model.SyncFlagDeletedMask|model.SyncFlagStoreStatus) != 0 { modifyCloseStatus = true _, storeParams.CloseStatus = JxStoreStatus2JdStatus(jxutils.MergeStoreStatus(store.Status, store.JdStoreStatus)) // 1storeParams.CloseStatus } fillOpTimeParams(storeParams, store.GetOpTimeList()) errList := errlist.New() + globals.SugarLogger.Debugf("=========storeParams :%s", utils.Format4Output(storeParams, false)) + globals.SugarLogger.Debugf("=========store :%s", utils.Format4Output(store, false)) if globals.EnableJdStoreWrite { store1 := fmt.Sprintf("门店id:%d,门店名称:%s,第三方门店状态:%d,本地修改前门店状态%d,本地门店修改后状态:%d,第三方平台Id(ebai):%s", storeID, store.Name, 100, store.Status, 100, store.VendorOrgCode) event.AddOperateEvent(jxcontext.AdminCtx, jxcontext.AdminCtx.GetTrackInfo(), store1, "", "", 10, "UpdateStore") From 20ac41784f5bd3698c4cfd70e9f61e6916423038 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Sat, 25 Mar 2023 17:56:36 +0800 Subject: [PATCH 4/4] 1 --- business/jxstore/act/act.go | 24 ++++++++++++++++++++---- business/jxstore/cms/sku.go | 6 +++++- business/partner/purchase/jd/store.go | 2 -- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/business/jxstore/act/act.go b/business/jxstore/act/act.go index cf99ad0cd..7e3c2bbd6 100644 --- a/business/jxstore/act/act.go +++ b/business/jxstore/act/act.go @@ -2032,11 +2032,27 @@ func RrefreshMtwmVendorAct(ctx *jxcontext.Context) (err error) { } } } - // 查询门店爆款商品,当门店存在爆款时,取消之前的力荐商品,将新的爆款设置为力荐商品 - if k == mtwmapi.RetailActTypeSecKill && len(actList) > 0 { - - } } + // 查询门店爆款商品,当门店存在爆款时,取消之前的力荐商品,将新的爆款设置为力荐商品 + //if k == mtwmapi.RetailActTypeSecKill && len(actList) > 0 { + // allActivityList := make([]string, 0, 0) // 此门店全部的折扣(爆款)活动商品 + // activationActivityList := make([]string, 0, 0) // 此门店全部的折扣(爆款)活动商品 + // for _, ac := range actList { + // allActivityList = append(allActivityList, utils.Int64ToStr(ac.ItemID)) + // if ac.Status == 1 { + // activationActivityList = append(activationActivityList, utils.Int64ToStr(ac.ItemID)) + // } + // } + // // 取消当前力荐商品 + // mtapi.RetailDiscountDelete2(storeMap.VendorStoreID, k) + // // 重新推荐力荐商品 + // partner.GetPurchasePlatformFromVendorID(storeMap.VendorID).(partner.ISingleStoreStoreSkuHandler).UpdateStoreSkus() + //} + // + //// 门店爆款活动商品为0,则取消真在力荐的商品 + //if k == mtwmapi.RetailActTypeSecKill && len(actList) == 0 { + // + //} } return retVal, err }, storeMaps) diff --git a/business/jxstore/cms/sku.go b/business/jxstore/cms/sku.go index a8fb5412a..9e83b5db3 100644 --- a/business/jxstore/cms/sku.go +++ b/business/jxstore/cms/sku.go @@ -1263,7 +1263,11 @@ func updateOrCreateSkuVendorCategoryMap(db *dao.DaoDB, ctx *jxcontext.Context, n mtwmCategoryID = payload["mtwmCategoryID"].(string) } if payload["categoryID2"] != nil { - jxCategoryID = payload["categoryID2"].(int) + jxCategoryIDNumber, err := payload["categoryID2"].(json.Number).Int64() + if err != nil { + return false + } + jxCategoryID = int(jxCategoryIDNumber) } if jdCategoryId != "" { diff --git a/business/partner/purchase/jd/store.go b/business/partner/purchase/jd/store.go index cef5208e5..f422cd9a6 100644 --- a/business/partner/purchase/jd/store.go +++ b/business/partner/purchase/jd/store.go @@ -211,8 +211,6 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin } fillOpTimeParams(storeParams, store.GetOpTimeList()) errList := errlist.New() - globals.SugarLogger.Debugf("=========storeParams :%s", utils.Format4Output(storeParams, false)) - globals.SugarLogger.Debugf("=========store :%s", utils.Format4Output(store, false)) if globals.EnableJdStoreWrite { store1 := fmt.Sprintf("门店id:%d,门店名称:%s,第三方门店状态:%d,本地修改前门店状态%d,本地门店修改后状态:%d,第三方平台Id(ebai):%s", storeID, store.Name, 100, store.Status, 100, store.VendorOrgCode) event.AddOperateEvent(jxcontext.AdminCtx, jxcontext.AdminCtx.GetTrackInfo(), store1, "", "", 10, "UpdateStore")