Merge branch 'jdshop' of e.coding.net:rosydev/jx-callback into jdshop

This commit is contained in:
邹宗楠
2023-11-30 09:20:27 +08:00

View File

@@ -286,6 +286,12 @@ func (c *DeliveryHandler) GetRidderPosition(ctx *jxcontext.Context, vendorOrgCod
//辅助函数
func getOrderPrice(order *model.GoodsOrder) (orderPrice *uuptapi.GetOrderPriceResp, err error) {
var (
fromLat float64
fromLng float64
toLat float64
toLng float64
)
store, err := dao.GetStoreDetail(dao.GetDB(), getReallyStoreID(order.StoreID, order.JxStoreID), 0, "")
if err != nil {
return nil, err
@@ -300,6 +306,18 @@ func getOrderPrice(order *model.GoodsOrder) (orderPrice *uuptapi.GetOrderPriceRe
Lng: jxutils.IntCoordinate2Standard(order.ConsigneeLng),
})
coords, err = api.BaiDuNaviAPI.BatchCoordinateConvert(coords, baidunavi.CoordSysGCJ02, baidunavi.CoordSysBaiDu)
if err != nil || len(coords) == 0 {
fromLat = jxutils.IntCoordinate2Standard(store.Lng)
fromLng = jxutils.IntCoordinate2Standard(store.Lat)
toLat = jxutils.IntCoordinate2Standard(order.ConsigneeLat)
toLng = jxutils.IntCoordinate2Standard(order.ConsigneeLng)
} else {
fromLat = coords[0].Lat
fromLng = coords[0].Lng
toLat = coords[1].Lat
toLng = coords[1].Lng
}
weight := 4
tempWeight := 0
if order.Weight/1000 >= weight {
@@ -316,10 +334,10 @@ func getOrderPrice(order *model.GoodsOrder) (orderPrice *uuptapi.GetOrderPriceRe
"to_address": order.ConsigneeAddress,
"city_name": store.CityName,
"send_type": uuptapi.SendTypeHelpMeDeliver,
"from_lat": coords[0].Lat,
"from_lng": coords[0].Lng,
"to_lat": coords[1].Lat,
"to_lng": coords[1].Lng,
"from_lat": fromLat,
"from_lng": fromLng,
"to_lat": toLat,
"to_lng": toLng,
"goods_weight": tempWeight,
}