使用腾讯地图,百度和高德不在使用
This commit is contained in:
@@ -150,22 +150,22 @@ func result2Orders(msg *jdshopapi.CallBackResult) (order *model.GoodsOrder, err
|
||||
cityCode = place.Code
|
||||
}
|
||||
}
|
||||
lng, lat, err2 := api.AutonaviAPI.GetCoordinateFromAddressByPage(order.ConsigneeAddress, cityCode)
|
||||
if err = err2; err != nil {
|
||||
globals.SugarLogger.Infof("高德page err: %v", err)
|
||||
}
|
||||
lng2, lat2, _ := api.AutonaviAPI.GetCoordinateFromAddress(order.ConsigneeAddress, "")
|
||||
distance := jxutils.EarthDistance(lng, lat, lng2, lat2)
|
||||
if distance > 1 {
|
||||
order.OrderType = model.OrderTypeAddressErr
|
||||
lng, lat, _, _, err := api.TencentMapAPI.GetCoordinateFromAddress(order.ConsigneeAddress, utils.Int2Str(cityCode))
|
||||
if err != nil {
|
||||
globals.SugarLogger.Infof("腾讯地图 GetCoordinateFromAddress err: %v", err)
|
||||
}
|
||||
//lng2, lat2, _, err := api.TencentMapAPI.GetCoordinateFromAddress(order.ConsigneeAddress, "")
|
||||
//distance := jxutils.EarthDistance(lng, lat, lng2, lat2)
|
||||
//if distance > 1 {
|
||||
// order.OrderType = model.OrderTypeAddressErr
|
||||
//}
|
||||
if err == nil && lng != 0 && lat != 0 {
|
||||
order.ConsigneeLng = jxutils.StandardCoordinate2Int(lng)
|
||||
order.ConsigneeLat = jxutils.StandardCoordinate2Int(lat)
|
||||
} else {
|
||||
} /*else {
|
||||
order.ConsigneeLng = jxutils.StandardCoordinate2Int(lng2)
|
||||
order.ConsigneeLat = jxutils.StandardCoordinate2Int(lat2)
|
||||
}
|
||||
}*/
|
||||
order.CoordinateType = model.CoordinateTypeMars
|
||||
}
|
||||
// storeList, err := common.GetStoreListByLocation(jxcontext.AdminCtx, jxutils.IntCoordinate2Standard(order.ConsigneeLng), jxutils.IntCoordinate2Standard(order.ConsigneeLat), 3000, false, true, 0)
|
||||
|
||||
@@ -340,23 +340,22 @@ func (p *PurchaseHandler) CreateStore2(db *dao.DaoDB, storeID int, userName stri
|
||||
}
|
||||
//证明这个店可能隶属直辖市或者东莞
|
||||
if model.ZXCityCodeMap[store.CityCode] != "" {
|
||||
result, _ := api.AutonaviAPI.GetCoordinateAreaInfo(jxutils.IntCoordinate2Standard(store.Lng), jxutils.IntCoordinate2Standard(store.Lat))
|
||||
if result["regeocode"] != nil {
|
||||
street := result["regeocode"].(map[string]interface{})["addressComponent"].(map[string]interface{})["township"].(string)
|
||||
if street != "" {
|
||||
result1, _ := api.JdShopAPI.GetProvince()
|
||||
for _, v := range result1 {
|
||||
if strings.Contains(store.CityName, v.AreaName) {
|
||||
result2, _ := api.JdShopAPI.GetCity(v.AreaID)
|
||||
for _, vv := range result2 {
|
||||
if strings.Contains(store.DistrictName, vv.AreaName) {
|
||||
result3, _ := api.JdShopAPI.GetCounty(vv.AreaID)
|
||||
for _, vvv := range result3 {
|
||||
if street == vvv.AreaName {
|
||||
createEntityStoreParam.AddCode = vvv.AreaID
|
||||
param.AddCode3 = vvv.AreaID
|
||||
break
|
||||
}
|
||||
//result, _ := api.AutonaviAPI.GetCoordinateAreaInfo(jxutils.IntCoordinate2Standard(store.Lng), jxutils.IntCoordinate2Standard(store.Lat))
|
||||
street, _ := api.TencentMapAPI.GetCoordinateTownInfo(jxutils.IntCoordinate2Standard(store.Lng), jxutils.IntCoordinate2Standard(store.Lat))
|
||||
//street := result["regeocode"].(map[string]interface{})["addressComponent"].(map[string]interface{})["township"].(string)
|
||||
if street != "" {
|
||||
result1, _ := api.JdShopAPI.GetProvince()
|
||||
for _, v := range result1 {
|
||||
if strings.Contains(store.CityName, v.AreaName) {
|
||||
result2, _ := api.JdShopAPI.GetCity(v.AreaID)
|
||||
for _, vv := range result2 {
|
||||
if strings.Contains(store.DistrictName, vv.AreaName) {
|
||||
result3, _ := api.JdShopAPI.GetCounty(vv.AreaID)
|
||||
for _, vvv := range result3 {
|
||||
if street == vvv.AreaName {
|
||||
createEntityStoreParam.AddCode = vvv.AreaID
|
||||
param.AddCode3 = vvv.AreaID
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user