This commit is contained in:
邹宗楠
2024-01-12 11:44:21 +08:00
parent e4608f3106
commit fa4a730529
4 changed files with 11 additions and 11 deletions

View File

@@ -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)
}

View File

@@ -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 {

View File

@@ -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"`

View File

@@ -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))
}