- get city and district info from coordinate correctly.
This commit is contained in:
@@ -122,8 +122,10 @@ func (p *PurchaseHandler) ReadStore(vendorStoreID string) (*model.Store, error)
|
||||
retVal.DistrictCode = district.Code
|
||||
}
|
||||
}
|
||||
if retVal.DistrictCode == 0 {
|
||||
retVal.DistrictCode = api.AutonaviAPI.GetCoordinateDistrictCode(lng, lat)
|
||||
}
|
||||
if retVal.DistrictCode == 0 {
|
||||
retVal.DistrictCode = api.AutonaviAPI.GetCoordinateDistrictCode(lng, lat)
|
||||
if retVal.CityCode == 0 {
|
||||
if district, err := dao.GetPlaceByCode(db, retVal.DistrictCode); err == nil {
|
||||
retVal.CityCode = district.ParentCode
|
||||
}
|
||||
|
||||
@@ -65,8 +65,10 @@ func (p *PurchaseHandler) ReadStore(vendorStoreID string) (*model.Store, error)
|
||||
retVal.DistrictCode = district.Code
|
||||
}
|
||||
}
|
||||
if retVal.DistrictCode == 0 {
|
||||
retVal.DistrictCode = api.AutonaviAPI.GetCoordinateDistrictCode(lng, lat)
|
||||
}
|
||||
if retVal.DistrictCode == 0 {
|
||||
retVal.DistrictCode = api.AutonaviAPI.GetCoordinateDistrictCode(lng, lat)
|
||||
if retVal.CityCode == 0 {
|
||||
if district, err := dao.GetPlaceByCode(db, retVal.DistrictCode); err == nil {
|
||||
retVal.CityCode = district.ParentCode
|
||||
}
|
||||
@@ -118,11 +120,15 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin
|
||||
"coordinateType": 3, // 一直用高德
|
||||
"lng": jxutils.IntCoordinate2Standard(store.Lng),
|
||||
"lat": jxutils.IntCoordinate2Standard(store.Lat),
|
||||
"city": store.JdCityCode,
|
||||
"county": store.JdDistrictCode,
|
||||
"phone": store.Tel1,
|
||||
"mobile": store.Tel2,
|
||||
}
|
||||
if store.JdCityCode != 0 {
|
||||
params["city"] = store.JdCityCode
|
||||
}
|
||||
if store.JdDistrictCode != 0 {
|
||||
params["county"] = store.JdDistrictCode
|
||||
}
|
||||
if store.DeliveryRangeType == model.DeliveryRangeTypePolygon {
|
||||
params["coordinatePoints"] = store.DeliveryRange
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user