- 饿百与美团外卖尽量同步手机与地址信息
This commit is contained in:
@@ -83,7 +83,7 @@ func (p *PurchaseHandler) ReadStore(ctx *jxcontext.Context, vendorStoreID string
|
|||||||
baiduShopID := utils.Str2Int64(vendorStoreID)
|
baiduShopID := utils.Str2Int64(vendorStoreID)
|
||||||
result, err := api.EbaiAPI.ShopGet("", baiduShopID)
|
result, err := api.EbaiAPI.ShopGet("", baiduShopID)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
globals.SugarLogger.Debug(utils.Format4Output(result, false))
|
// globals.SugarLogger.Debug(utils.Format4Output(result, false))
|
||||||
retVal := &dao.StoreDetail{
|
retVal := &dao.StoreDetail{
|
||||||
Store: model.Store{
|
Store: model.Store{
|
||||||
Address: utils.Interface2String(result["address"]),
|
Address: utils.Interface2String(result["address"]),
|
||||||
@@ -370,21 +370,25 @@ func ebaiOpTime2Jx(businessTime interface{}) (opTimeList []int16) {
|
|||||||
|
|
||||||
func genStoreMapFromStore(store *tEbaiStoreInfo) map[string]interface{} {
|
func genStoreMapFromStore(store *tEbaiStoreInfo) map[string]interface{} {
|
||||||
params := fillOpTimeParams(nil, store.GetOpTimeList())
|
params := fillOpTimeParams(nil, store.GetOpTimeList())
|
||||||
// if store.Tel2 != "" {
|
tel := store.Tel1
|
||||||
// params["ivr_phone"] = store.Tel2
|
if tel == "" {
|
||||||
// }
|
tel = store.Tel2
|
||||||
// params["phone"] = store.Tel1
|
}
|
||||||
|
if tel != "" {
|
||||||
|
params["phone"] = tel
|
||||||
|
params["ivr_phone"] = tel
|
||||||
|
}
|
||||||
if store.VendorStoreID != "" {
|
if store.VendorStoreID != "" {
|
||||||
params["baidu_shop_id"] = store.VendorStoreID
|
params["baidu_shop_id"] = store.VendorStoreID
|
||||||
}
|
}
|
||||||
if store.SyncStatus&(model.SyncFlagNewMask /*|model.SyncFlagStoreName*/) != 0 {
|
if store.SyncStatus&(model.SyncFlagNewMask /*|model.SyncFlagStoreName*/) != 0 {
|
||||||
params["name"] = jxutils.ComposeStoreName(store.Name, model.VendorIDEBAI)
|
params["name"] = jxutils.ComposeStoreName(store.Name, model.VendorIDEBAI)
|
||||||
}
|
}
|
||||||
|
params["address"] = store.Address
|
||||||
// todo 饿百 开店审核通过后不允许修改商户信息
|
// todo 饿百 开店审核通过后不允许修改商户信息
|
||||||
if store.SyncStatus&(model.SyncFlagNewMask /*|model.SyncFlagStoreAddress*/) != 0 {
|
if store.SyncStatus&(model.SyncFlagNewMask /*|model.SyncFlagStoreAddress*/) != 0 {
|
||||||
params["longitude"] = jxutils.IntCoordinate2Standard(store.Lng)
|
params["longitude"] = jxutils.IntCoordinate2Standard(store.Lng)
|
||||||
params["latitude"] = jxutils.IntCoordinate2Standard(store.Lat)
|
params["latitude"] = jxutils.IntCoordinate2Standard(store.Lat)
|
||||||
params["address"] = store.Address
|
|
||||||
params["coord_type"] = ebaiapi.CoordTypeAutonavi
|
params["coord_type"] = ebaiapi.CoordTypeAutonavi
|
||||||
if deliveryRegion := JxDeliveryRegion2Ebai(&store.Store); deliveryRegion != nil {
|
if deliveryRegion := JxDeliveryRegion2Ebai(&store.Store); deliveryRegion != nil {
|
||||||
params["delivery_region"] = deliveryRegion
|
params["delivery_region"] = deliveryRegion
|
||||||
|
|||||||
@@ -107,31 +107,32 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
errList := errlist.New()
|
errList := errlist.New()
|
||||||
// remoteStoreInfo, err := api.MtwmAPI.PoiGet(storeDetail.VendorStoreID)
|
|
||||||
// if err != nil {
|
remoteStoreInfo, err := api.MtwmAPI.PoiGet(storeDetail.VendorStoreID)
|
||||||
// return err
|
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)))
|
|
||||||
}
|
}
|
||||||
|
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()))
|
errList.AddErr(p.UpdateStoreOpTime(jxcontext.AdminCtx, storeID, storeDetail.VendorStoreID, storeDetail.GetOpTimeList()))
|
||||||
return errList.GetErrListAsOne()
|
return errList.GetErrListAsOne()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user