From c78b45614397e59e5a65ef5d2166a4dfca31cc4d Mon Sep 17 00:00:00 2001 From: gazebo Date: Fri, 6 Sep 2019 18:06:37 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E9=A5=BF=E7=99=BE=E4=B8=8E=E7=BE=8E?= =?UTF-8?q?=E5=9B=A2=E5=A4=96=E5=8D=96=E5=B0=BD=E9=87=8F=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E6=89=8B=E6=9C=BA=E4=B8=8E=E5=9C=B0=E5=9D=80=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/ebai/store.go | 16 +++++--- business/partner/purchase/mtwm/store.go | 49 +++++++++++++------------ 2 files changed, 35 insertions(+), 30 deletions(-) diff --git a/business/partner/purchase/ebai/store.go b/business/partner/purchase/ebai/store.go index b78d81846..63e74d57c 100644 --- a/business/partner/purchase/ebai/store.go +++ b/business/partner/purchase/ebai/store.go @@ -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 diff --git a/business/partner/purchase/mtwm/store.go b/business/partner/purchase/mtwm/store.go index 64e34366d..cad39cacc 100644 --- a/business/partner/purchase/mtwm/store.go +++ b/business/partner/purchase/mtwm/store.go @@ -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() }