使用腾讯地图,百度和高德不在使用
This commit is contained in:
@@ -2,6 +2,7 @@ package jd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/platformapi/tencent_map"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -12,7 +13,6 @@ import (
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/tasksch"
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/autonavi"
|
||||
"git.rosy.net.cn/baseapi/platformapi/jdapi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||
@@ -306,10 +306,16 @@ func Map2Order(orderData map[string]interface{}) (order *model.GoodsOrder) {
|
||||
originalLng := utils.MustInterface2Float64(result["buyerLng"])
|
||||
originalLat := utils.MustInterface2Float64(result["buyerLat"])
|
||||
if coordinateType == 1 {
|
||||
lng, lat, err2 := api.AutonaviAPI.CoordinateConvert(originalLng, originalLat, autonavi.CoordSysGPS)
|
||||
if err2 == nil {
|
||||
originalLng = lng
|
||||
originalLat = lat
|
||||
//lng, lat, err2 := api.TencentMapAPI.TencentCoordinateChange(originalLng, originalLat, autonavi.CoordSysGPS)
|
||||
originalPoint, err2 := api.TencentMapAPI.TencentCoordinateChange(&tencent_map.TencentCoordinateChangeReq{
|
||||
Locations: fmt.Sprintf("%.6f,%.6f", originalLat, originalLng),
|
||||
Type: tencent_map.CoordinateChangeTypeGPS,
|
||||
})
|
||||
if err2 == nil && len(originalPoint) != 0 {
|
||||
//originalLng = lng
|
||||
//originalLat = lat
|
||||
originalLng = utils.Str2Float64(originalPoint[0].Lng)
|
||||
originalLat = utils.Str2Float64(originalPoint[0].Lat)
|
||||
} else {
|
||||
// 如果没有转成功,保留原始数据
|
||||
order.CoordinateType = model.CoordinateTypeGPS
|
||||
|
||||
@@ -98,7 +98,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
|
||||
|
||||
Reference in New Issue
Block a user