- 饿百与美团外卖尽量同步手机与地址信息

This commit is contained in:
gazebo
2019-09-06 18:06:37 +08:00
parent 90232c2a26
commit c78b456143
2 changed files with 35 additions and 30 deletions

View File

@@ -83,7 +83,7 @@ func (p *PurchaseHandler) ReadStore(ctx *jxcontext.Context, vendorStoreID string
baiduShopID := utils.Str2Int64(vendorStoreID)
result, err := api.EbaiAPI.ShopGet("", baiduShopID)
if err == nil {
globals.SugarLogger.Debug(utils.Format4Output(result, false))
// globals.SugarLogger.Debug(utils.Format4Output(result, false))
retVal := &dao.StoreDetail{
Store: model.Store{
Address: utils.Interface2String(result["address"]),
@@ -370,21 +370,25 @@ func ebaiOpTime2Jx(businessTime interface{}) (opTimeList []int16) {
func genStoreMapFromStore(store *tEbaiStoreInfo) map[string]interface{} {
params := fillOpTimeParams(nil, store.GetOpTimeList())
// if store.Tel2 != "" {
// params["ivr_phone"] = store.Tel2
// }
// params["phone"] = store.Tel1
tel := store.Tel1
if tel == "" {
tel = store.Tel2
}
if tel != "" {
params["phone"] = tel
params["ivr_phone"] = tel
}
if store.VendorStoreID != "" {
params["baidu_shop_id"] = store.VendorStoreID
}
if store.SyncStatus&(model.SyncFlagNewMask /*|model.SyncFlagStoreName*/) != 0 {
params["name"] = jxutils.ComposeStoreName(store.Name, model.VendorIDEBAI)
}
params["address"] = store.Address
// todo 饿百 开店审核通过后不允许修改商户信息
if store.SyncStatus&(model.SyncFlagNewMask /*|model.SyncFlagStoreAddress*/) != 0 {
params["longitude"] = jxutils.IntCoordinate2Standard(store.Lng)
params["latitude"] = jxutils.IntCoordinate2Standard(store.Lat)
params["address"] = store.Address
params["coord_type"] = ebaiapi.CoordTypeAutonavi
if deliveryRegion := JxDeliveryRegion2Ebai(&store.Store); deliveryRegion != nil {
params["delivery_region"] = deliveryRegion

View File

@@ -107,31 +107,32 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin
return err
}
errList := errlist.New()
// remoteStoreInfo, err := api.MtwmAPI.PoiGet(storeDetail.VendorStoreID)
// if err != nil {
// return err
// }
// params := map[string]interface{}{
// "name": utils.Interface2String(remoteStoreInfo["name"]), //jxutils.ComposeStoreName(storeDetail.Store.Name, model.VendorIDMTWM),
// "phone": storeDetail.Tel1,
// "shipping_fee": jxutils.IntPrice2Standard(int64(storeDetail.DeliveryFee)),
// "shipping_time": openTimeJX2Mtwm(openTime),
// "third_tag_name": "蔬菜",
// }
// if true { //storeDetail.SyncStatus&(model.SyncFlagNewMask|model.SyncFlagStoreAddress) != 0 {
// params["address"] = storeDetail.Address
// params["longitude"] = jxutils.IntCoordinate2Standard(storeDetail.Lng)
// params["latitude"] = jxutils.IntCoordinate2Standard(storeDetail.Lat)
// }
// params["open_level"] = openLevel
// params["is_online"] = isOnline
// globals.SugarLogger.Debug(utils.Format4Output(params, false))
// if globals.EnableMtwmStoreWrite {
// err = api.MtwmAPI.PoiSave(storeDetail.VendorStoreID, params)
// }
if storeDetail.SyncStatus&(model.SyncFlagNewMask|model.SyncFlagStoreStatus) != 0 {
errList.AddErr(p.UpdateStoreStatus(jxcontext.AdminCtx, storeID, storeDetail.VendorStoreID, jxutils.MergeStoreStatus(storeDetail.Status, storeDetail.VendorStatus)))
remoteStoreInfo, err := api.MtwmAPI.PoiGet(storeDetail.VendorStoreID)
if err != nil {
return err
}
openLevel, isOnline := bizStatusJX2Mtwm(storeDetail.Status)
params := map[string]interface{}{
"name": remoteStoreInfo.Name, //jxutils.ComposeStoreName(storeDetail.Store.Name, model.VendorIDMTWM),
"address": storeDetail.Address,
"longitude": jxutils.IntCoordinate2Standard(storeDetail.Lng),
"latitude": jxutils.IntCoordinate2Standard(storeDetail.Lat),
"phone": storeDetail.Tel1,
"shipping_fee": jxutils.IntPrice2Standard(int64(storeDetail.DeliveryFee)),
"shipping_time": remoteStoreInfo.ShippingTime,
"open_level": openLevel,
"is_online": isOnline,
"third_tag_name": remoteStoreInfo.ThirdTagName,
}
// globals.SugarLogger.Debug(utils.Format4Output(params, false))
if globals.EnableMtwmStoreWrite {
errList.AddErr(api.MtwmAPI.PoiSave(storeDetail.VendorStoreID, params))
}
// if storeDetail.SyncStatus&(model.SyncFlagNewMask|model.SyncFlagStoreStatus) != 0 {
// errList.AddErr(p.UpdateStoreStatus(jxcontext.AdminCtx, storeID, storeDetail.VendorStoreID, jxutils.MergeStoreStatus(storeDetail.Status, storeDetail.VendorStatus)))
// }
errList.AddErr(p.UpdateStoreOpTime(jxcontext.AdminCtx, storeID, storeDetail.VendorStoreID, storeDetail.GetOpTimeList()))
return errList.GetErrListAsOne()
}