diff --git a/business/partner/purchase/mtwm/store.go b/business/partner/purchase/mtwm/store.go index b7a5207cc..b19fc2013 100644 --- a/business/partner/purchase/mtwm/store.go +++ b/business/partner/purchase/mtwm/store.go @@ -37,13 +37,13 @@ func (p *PurchaseHandler) ReadStore(vendorStoreID string) (retVal *model.Store, if err == nil { // globals.SugarLogger.Debug(utils.Format4Output(result, false)) retVal = &model.Store{ - Address: utils.Interface2String(result["address"]), - Tel1: utils.Interface2String(result["phone"]), + Address: result.Address, + Tel1: result.Phone, } - retVal.OriginalName = utils.Interface2String(result["name"]) + retVal.OriginalName = result.Name _, retVal.Name = jxutils.SplitStoreName(retVal.OriginalName, partner.StoreNameSeparator, VendorStorePrefix) - openTimes := openTimeMtwm2JX(result["shipping_time"].(string)) + openTimes := openTimeMtwm2JX(result.ShippingTime) if len(openTimes) > 0 { retVal.OpenTime1 = openTimes[0][0] retVal.CloseTime1 = openTimes[0][1] @@ -52,15 +52,15 @@ func (p *PurchaseHandler) ReadStore(vendorStoreID string) (retVal *model.Store, retVal.CloseTime2 = openTimes[1][1] } } - retVal.Status = bizStatusMtwm2JX(int(utils.MustInterface2Int64(result["open_level"])), int(utils.MustInterface2Int64(result["is_online"]))) + retVal.Status = bizStatusMtwm2JX(result.OpenLevel, result.IsOnline) - tel2 := utils.Interface2String(result["standby_tel"]) + tel2 := result.StandbyTel if tel2 != "" && tel2 != retVal.Tel1 { retVal.Tel2 = tel2 } - retVal.Lng = int(utils.MustInterface2Float64(result["longitude"])) - retVal.Lat = int(utils.MustInterface2Float64(result["latitude"])) + retVal.Lng = int(result.Longitude) + retVal.Lat = int(result.Latitude) lng := jxutils.IntCoordinate2Standard(retVal.Lng) lat := jxutils.IntCoordinate2Standard(retVal.Lat) @@ -69,7 +69,7 @@ func (p *PurchaseHandler) ReadStore(vendorStoreID string) (retVal *model.Store, if district, err := dao.GetPlaceByCode(db, retVal.DistrictCode); err == nil { retVal.CityCode = district.ParentCode } - poiCode := utils.Interface2String(result["app_poi_code"]) + poiCode := result.AppPoiCode retVal.ID = int(utils.Str2Int64WithDefault(poiCode, 0)) retVal.DeliveryRangeType = model.DeliveryRangeTypePolygon var deliveryRangeInfo []map[string]interface{} @@ -140,7 +140,7 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin if err = err2; err != nil { return err } - if int(utils.MustInterface2Int64(remoteStoreInfo["is_online"])) == mtwmapi.PoiStatusOnline { + if remoteStoreInfo.IsOnline == mtwmapi.PoiStatusOnline { if openLevel == mtwmapi.PoiOpenLevelHaveRest { err = api.MtwmAPI.PoiClose(storeDetail.VendorStoreID) } else { @@ -186,7 +186,7 @@ func (p *PurchaseHandler) onStoreStatusChanged(msg *mtwmapi.CallbackMsg) (respon func (p *PurchaseHandler) GetStoreStatus(ctx *jxcontext.Context, vendorStoreID string) (storeStatus int, err error) { result, err := api.MtwmAPI.PoiGet(vendorStoreID) if err == nil { - return bizStatusMtwm2JX(int(utils.MustInterface2Int64(result["open_level"])), int(utils.MustInterface2Int64(result["is_online"]))), nil + return bizStatusMtwm2JX(result.OpenLevel, result.IsOnline), nil } return 0, err }