From fa4a73052952864ed07b2c3a343bc83437d75ec1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 12 Jan 2024 11:44:21 +0800 Subject: [PATCH] 1 --- business/jxstore/cms/store.go | 5 ++++- business/jxstore/cms/sync.go | 7 ------- business/model/dao/store.go | 2 +- business/partner/purchase/mtwm/store.go | 8 ++++++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 03151e971..b343e0e37 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -1856,6 +1856,9 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor valid["address"] = payload["address"].(string) syncStatus |= model.SyncFlagStoreName address = payload["address"].(string) + // 这个字段暂存美团门店地址 + storeMap.YbStorePrefix = address + dao.UpdateEntity(db, storeMap, "YbStorePrefix") } if err == nil { @@ -1920,7 +1923,7 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor } if isUpdateStoreNeedSync(valid) { // 同步修改门店已经配送门店 - _, err = CurVendorSync.SyncStore(ctx, db, vendorID, storeID, false, userName) + _, err = CurVendorSync.SyncStore(ctx, db, vendorID, storeID, false, userName) // address原来的userName 因为storeMap无法保存address,所以美团暂时使用该参数代替 //updateCourierStores(ctx, storeID) } diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index b41d49b3e..4b080d6d7 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -237,11 +237,8 @@ func (v *VendorSync) SyncStore2(ctx *jxcontext.Context, db *dao.DaoDB, vendorIDs loopMapInfo := batchItemList[0].(*LoopStoreMapInfo) var failedList []*partner.StoreSkuInfoWithErr handler := v.GetStoreHandler(loopMapInfo.VendorID) - globals.SugarLogger.Debugf("==============handler %d", loopMapInfo.VendorID) if handler != nil { - globals.SugarLogger.Debugf("==============handler %s", "11111111111") if len(loopMapInfo.StoreMapList) > 1 { - globals.SugarLogger.Debugf("==============handler2 %s", "11111111111") loopStoreTask := tasksch.NewParallelTask(fmt.Sprintf("处理平台%s", model.VendorChineseNames[loopMapInfo.VendorID]), tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx, func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { var resultList []interface{} @@ -251,9 +248,7 @@ func (v *VendorSync) SyncStore2(ctx *jxcontext.Context, db *dao.DaoDB, vendorIDs if len(loopMapInfo.StoreMapList) > 1 { db2 = dao.GetDB() } - globals.SugarLogger.Debugf("==============storeMap %s", utils.Format4Output(storeMap, false)) if model.IsSyncStatusNew(storeMap.SyncStatus) { - globals.SugarLogger.Debugf("==============storeMap.SyncStatus1 %d", storeMap.SyncStatus) storeDetail, _ := dao.GetStoreDetail(db, storeMap.StoreID, storeMap.VendorID, storeMap.VendorOrgCode) if vendorStoreID, err = handler.CreateStore2(db2, storeMap.StoreID, userName, nil, storeDetail); err == nil { resultList = append(resultList, 1) @@ -261,14 +256,12 @@ func (v *VendorSync) SyncStore2(ctx *jxcontext.Context, db *dao.DaoDB, vendorIDs failedList = putils.GetErrMsg2FailedSingleList(nil, err, storeMap.StoreID, model.VendorChineseNames[storeMap.VendorID], "创建门店") } } else if model.IsSyncStatusDelete(storeMap.SyncStatus) { - globals.SugarLogger.Debugf("==============storeMap.SyncStatus2 %d", storeMap.SyncStatus) if err = handler.DeleteStore(db2, storeMap.StoreID, userName); err == nil { resultList = append(resultList, 1) } else { failedList = putils.GetErrMsg2FailedSingleList(nil, err, storeMap.StoreID, model.VendorChineseNames[storeMap.VendorID], "删除门店") } } else { - globals.SugarLogger.Debugf("==============storeMap.SyncStatus3 %d", storeMap.SyncStatus) if err = handler.UpdateStore(db2, storeMap.StoreID, userName); err == nil { resultList = append(resultList, 1) } else { diff --git a/business/model/dao/store.go b/business/model/dao/store.go index 6d08fc6e6..de0441184 100644 --- a/business/model/dao/store.go +++ b/business/model/dao/store.go @@ -62,7 +62,7 @@ type StoreDetail struct { YbAppID string `orm:"column(yb_app_id)" json:"ybAppID"` YbAppKey string `json:"ybAppKey"` - YbStorePrefix string `json:"ybStorePrefix"` //vendorID=14 暂存打包费 + YbStorePrefix string `json:"ybStorePrefix"` //vendorID=14 暂存打包费 / vendorID = 1 暂存美团门店地址 MtwmToken string `json:"mtwmToken"` // 当vendor为美团时存储美团token,为抖店时存储抖店token,也储存淘鲜达token,其他品牌门店授权时appkey相同时token不相同 EbaiSupplierID string `json:"ebaiSupplierID"` diff --git a/business/partner/purchase/mtwm/store.go b/business/partner/purchase/mtwm/store.go index 402936939..42346874b 100644 --- a/business/partner/purchase/mtwm/store.go +++ b/business/partner/purchase/mtwm/store.go @@ -263,8 +263,8 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin //TODO 美团暂时不用那个电话 phone := storeDetail.Tel1 params := map[string]interface{}{ - "name": name, //jxutils.ComposeStoreName(storeDetail.Store.Name, model.VendorIDMTWM), - "address": storeDetail.Address, // 美团好像地址也不能改的? + "name": name, //jxutils.ComposeStoreName(storeDetail.Store.Name, model.VendorIDMTWM), + // "address": storeDetail.Address, // 美团好像地址也不能改的? "longitude": jxutils.IntCoordinate2Standard(int(remoteStoreInfo.Longitude)), "latitude": jxutils.IntCoordinate2Standard(int(remoteStoreInfo.Latitude)), "phone": phone, @@ -275,6 +275,10 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin "third_tag_name": remoteStoreInfo.ThirdTagName, "promotion_info": storeDetail.PromoteInfo, } + if storeDetail.Address != storeDetail.YbStorePrefix && storeDetail.YbStorePrefix != "" { + params["address"] = storeDetail.YbStorePrefix + } + if globals.EnableMtwmStoreWrite { errList.AddErr(mtapi.PoiSave(storeDetail.VendorStoreID, params)) }