- get place code from autonavi api if necessary.
This commit is contained in:
@@ -55,19 +55,30 @@ func (p *PurchaseHandler) ReadStore(vendorStoreID string) (*model.Store, error)
|
||||
if tel2 != "" && tel2 != retVal.Tel1 {
|
||||
retVal.Tel2 = tel2
|
||||
}
|
||||
lng := utils.MustInterface2Float64(result["lng"])
|
||||
lat := utils.MustInterface2Float64(result["lat"])
|
||||
retVal.Lng = jxutils.StandardCoordinate2Int(lng)
|
||||
retVal.Lat = jxutils.StandardCoordinate2Int(lat)
|
||||
|
||||
cityCode := int(utils.MustInterface2Int64(result["city"]))
|
||||
if cityCode != 0 {
|
||||
db := dao.GetDB()
|
||||
if city, err2 := dao.GetPlaceByJdCode(db, cityCode); err2 == nil {
|
||||
retVal.CityCode = city.Code
|
||||
districtName := utils.Interface2String(result["countyName"]) // 京东的市区号码与通用数据完全无法关联,只有通过名字来关联
|
||||
if district, err2 := dao.GetPlaceByName(db, districtName, 3, city.Code); err2 == nil {
|
||||
retVal.DistrictCode = district.Code
|
||||
if retVal.CityCode != 0 && districtName != "" {
|
||||
if district, err2 := dao.GetPlaceByName(db, districtName, 3, city.Code); err2 == nil {
|
||||
retVal.DistrictCode = district.Code
|
||||
}
|
||||
}
|
||||
if retVal.DistrictCode == 0 {
|
||||
retVal.DistrictCode = api.AutonaviAPI.GetCoordinateDistrictCode(lng, lat)
|
||||
if district, err := dao.GetPlaceByCode(db, retVal.DistrictCode); err == nil {
|
||||
retVal.CityCode = district.ParentCode
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
retVal.Lng = jxutils.StandardCoordinate2Int(utils.MustInterface2Float64(result["lng"]))
|
||||
retVal.Lat = jxutils.StandardCoordinate2Int(utils.MustInterface2Float64(result["lat"]))
|
||||
|
||||
retVal.ID = int(utils.Str2Int64WithDefault(utils.Interface2String(result["outSystemId"]), 0))
|
||||
result, err2 := api.JdAPI.GetDeliveryRangeByStationNo(vendorStoreID)
|
||||
|
||||
Reference in New Issue
Block a user