使用腾讯地图,百度和高德不在使用

This commit is contained in:
邹宗楠
2024-07-31 11:09:07 +08:00
parent d6e1893671
commit 4cf9001c9a
20 changed files with 287 additions and 212 deletions

View File

@@ -2,9 +2,9 @@ package ebai
import (
"fmt"
"git.rosy.net.cn/baseapi/platformapi/tencent_map"
"strings"
"git.rosy.net.cn/baseapi/platformapi/autonavi"
"git.rosy.net.cn/baseapi/platformapi/ebaiapi"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/jxcallback/scheduler"
@@ -201,9 +201,17 @@ func (p *PurchaseHandler) ReadStore(ctx *jxcontext.Context, vendorOrgCode, vendo
lat := getCoordintate(result["latitude"])
if utils.Interface2String(result["coord_type"]) == ebaiapi.CoordTypeBaidu {
var err2 error
if lng, lat, err2 = api.AutonaviAPI.CoordinateConvert(lng, lat, autonavi.CoordSysBaidu); err2 != nil {
lngAndLat, err2 := api.TencentMapAPI.TencentCoordinateChange(&tencent_map.TencentCoordinateChangeReq{
Locations: fmt.Sprintf("%.6f,%.6f", lat, lng),
Type: tencent_map.CoordinateChangeTypeBaidu,
})
if err2 != nil {
globals.SugarLogger.Debugf("CoordinateConvert err : %v", err)
}
if len(lngAndLat) != 0 {
lng = utils.Str2Float64(lngAndLat[0].Lng)
lat = utils.Str2Float64(lngAndLat[0].Lat)
}
}
retVal.Lng = jxutils.StandardCoordinate2Int(lng)
retVal.Lat = jxutils.StandardCoordinate2Int(lat)
@@ -220,7 +228,7 @@ func (p *PurchaseHandler) ReadStore(ctx *jxcontext.Context, vendorOrgCode, vendo
}
}
if retVal.DistrictCode == 0 {
retVal.DistrictCode = api.AutonaviAPI.GetCoordinateDistrictCode(lng, lat)
retVal.DistrictCode = api.TencentMapAPI.GetCoordinateDistrictCode(lng, lat)
if retVal.CityCode == 0 {
if district, err := dao.GetPlaceByCode(db, retVal.DistrictCode); err == nil {
retVal.CityCode = district.ParentCode