使用腾讯地图,百度和高德不在使用
This commit is contained in:
@@ -214,7 +214,7 @@ func StoreDetail2ShopInfo(storeDetail *dao.StoreDetail2) (shopInfo *dadaapi.Shop
|
||||
if dadaDistrictMap[districtName] != "" {
|
||||
if dadaDistrictMap[districtName] == "1" { // 区镇信息
|
||||
cityName = districtName
|
||||
districtName, _ = api.AutonaviAPI.GetCoordinateTownInfo(lng, lat)
|
||||
districtName, _ = api.TencentMapAPI.GetCoordinateTownInfo(lng, lat)
|
||||
}
|
||||
if dadaDistrictMap[districtName] != "" {
|
||||
districtName = dadaDistrictMap[storeDetail.DistrictName]
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ func (p *PurchaseHandler) ReadStore(ctx *jxcontext.Context, vendorOrgCode, vendo
|
||||
lng := jxutils.IntCoordinate2Standard(retVal.Lng)
|
||||
lat := jxutils.IntCoordinate2Standard(retVal.Lat)
|
||||
db := dao.GetDB()
|
||||
retVal.DistrictCode = api.AutonaviAPI.GetCoordinateDistrictCode(lng, lat)
|
||||
retVal.DistrictCode = api.TencentMapAPI.GetCoordinateDistrictCode(lng, lat)
|
||||
city, err := dao.GetPlaceByCode(db, result.CityID)
|
||||
retVal.CityName = city.Name
|
||||
retVal.CityCode = result.CityID
|
||||
|
||||
@@ -3,12 +3,12 @@ package tiktok_store
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/platformapi/tencent_map"
|
||||
instantShopping_reportRiderLocation_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/instantShopping_reportRiderLocation/request"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/autonavi"
|
||||
"git.rosy.net.cn/baseapi/platformapi/tiktok_shop/ascription_place"
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
|
||||
@@ -251,9 +251,18 @@ func (p *PurchaseHandler) GetOrderRider(vendorOrgCode, vendorStoreID string, par
|
||||
//return tiktokShop.NewExpress(appKey, appSecret, "").OrderStatusAndPsInfoNew(param)
|
||||
if param["latitude"].(string) != "" && param["longitude"].(string) != "" {
|
||||
if len(param["latitude"].(string)) > len("39.978573") && len(param["longitude"].(string)) > len("116.5031060") { // 是否为百度坐标
|
||||
lng, lat, _ := api.AutonaviAPI.CoordinateConvert(utils.Str2Float64(param["latitude"].(string)), utils.Str2Float64(param["longitude"].(string)), autonavi.CoordSysBaidu)
|
||||
param["latitude"] = utils.Float64ToStr(lat)
|
||||
param["longitude"] = utils.Float64ToStr(lng)
|
||||
//lng, lat, _ := api.AutonaviAPI.CoordinateConvert(utils.Str2Float64(param["latitude"].(string)), utils.Str2Float64(param["longitude"].(string)), autonavi.CoordSysBaidu)
|
||||
//param["latitude"] = utils.Float64ToStr(lat)
|
||||
//param["longitude"] = utils.Float64ToStr(lng)
|
||||
|
||||
lngAndLat, err := api.TencentMapAPI.TencentCoordinateChange(&tencent_map.TencentCoordinateChangeReq{
|
||||
Locations: fmt.Sprintf("%s,%s", param["latitude"].(string), param["longitude"].(string)),
|
||||
Type: tencent_map.CoordinateChangeTypeBaidu,
|
||||
})
|
||||
if err == nil && len(lngAndLat) != 0 {
|
||||
param["latitude"] = lngAndLat[0].Lat
|
||||
param["longitude"] = lngAndLat[0].Lng
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -961,7 +961,7 @@ func (P *PurchaseHandler) ReadStore(ctx *jxcontext.Context, vendorOrgCode, vendo
|
||||
lng := jxutils.IntCoordinate2Standard(retVal.Lng)
|
||||
lat := jxutils.IntCoordinate2Standard(retVal.Lat)
|
||||
db := dao.GetDB()
|
||||
retVal.DistrictCode = api.AutonaviAPI.GetCoordinateDistrictCode(lng, lat)
|
||||
retVal.DistrictCode = api.TencentMapAPI.GetCoordinateDistrictCode(lng, lat)
|
||||
city, err := dao.GetPlaceByCode(db, utils.Str2Int(vendorStore.StoreDetail.Store.CityCode))
|
||||
retVal.CityName = city.Name
|
||||
retVal.CityCode = utils.Str2Int(vendorStore.StoreDetail.Store.CityCode)
|
||||
|
||||
Reference in New Issue
Block a user