This commit is contained in:
邹宗楠
2023-09-08 11:28:05 +08:00
parent e75f8d737e
commit 5c3f250abe
6 changed files with 45 additions and 9 deletions

View File

@@ -40,7 +40,7 @@ func (a *API) GetCyclingPlan(origin, destination string) ([]string, int64, int64
}
}
distance = utils.Str2Int64(v.Distance)
duration = utils.Str2Int64(v.Duration) + 600
duration = utils.Str2Int64(v.Duration) + 300
}
return polyLineList, distance, duration, nil

View File

@@ -2,11 +2,11 @@ package autonavi
// 高德骑行计划账号配置
const (
AMAPCyclingPlanKey1 = "e44ae2850c0ac930b65c9652d2db0321" // 高德地图 成都若溪科技有限公司 18048531223 Rosy201507
AMAPCyclingPlanKey2 = "e44ae2850c0ac930b65c9652d2db0321" // 高德地图 成都京西到家网络科技有限公司 18080188338 Rosy201507
AMAPCyclingPlanKey3 = "e44ae2850c0ac930b65c9652d2db0321" // 高德地图 冲天猴儿(成都)科技有限公司 19802843833 Rosy201507
AMAPCyclingPlanKey4 = "e44ae2850c0ac930b65c9652d2db0321" // 高德地图 京西(成都)科技有限公司 18884789801 Rosy201507
AMAPCyclingPlanKey5 = "e44ae2850c0ac930b65c9652d2db0321" // 高德地图 京西菜市(北京)科技有限公司 17723303721 Rosy201507
AMAPCyclingPlanKey1 = "cb4ea3516f88c0fd8fed73f92aeddffa" // 高德地图 成都京西到家网络科技有限公司 18080188338 Rosy201507
AMAPCyclingPlanKey2 = "e44ae2850c0ac930b65c9652d2db0321" // 高德地图 成都若溪科技有限公司 18048531223 Rosy201507
AMAPCyclingPlanKey3 = "9805128688b11d011219e76e960e0feb" // 高德地图 冲天猴儿(成都)科技有限公司 19802843833 Rosy201507
AMAPCyclingPlanKey4 = "727130840c0466c5a79494eca9b7cf98" // 高德地图 京西(成都)科技有限公司 18884789801 Rosy201507
AMAPCyclingPlanKey5 = "962667fb03713cf9bcfce849b4c2ece1" // 高德地图 京西菜市(北京)科技有限公司 17723303721 Rosy201507
)
// 错误码

View File

@@ -6,7 +6,7 @@ import (
)
func TestGetCyclingPlan(t *testing.T) {
key := "e44ae2850c0ac930b65c9652d2db0321"
key := "cb4ea3516f88c0fd8fed73f92aeddffa"
a := New(key)
data1, dada2, dada3, err := a.GetCyclingPlan("104.045460,30.693001", "104.045474,30.693344")
fmt.Println(data1)

View File

@@ -20,13 +20,13 @@ func init() {
baseapi.Init(sugarLogger)
// 菜市
//api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "", "")
api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "", "")
// 果园
//api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "")
//商超
api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_stuXR8Sf8XhvNz4f9A9Bxw") //token_n4TwqCntWWuvQwAawzxC0w
//api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_izAHEkoEl4lV-w4JdJFNww") //token_n4TwqCntWWuvQwAawzxC0w
//api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_r36FEse6_ywebQI65FNNWA") //token_n4TwqCntWWuvQwAawzxC0w
cookieStr := `
acctId=57396785; token=0bWbK5VbK50E2BmIhIH2zHB-am_y7mB37yXHm6RLZWx4*; wmPoiId=-1;

View File

@@ -358,6 +358,17 @@ type RiderRealPhoneNumberInfo struct {
RiderRealPhoneNumber string `json:"rider_real_phone_number"` // 骑手真实手机号
}
// GetRiderDeliveryPath 获取骑手坐标
type GetRiderDeliveryPath struct {
//Code int64 `json:"code"`
//Msg string `json:"msg"`
//Data []struct {
Longitude int `json:"longitude"`
Latitude int `json:"latitude"`
Time int64 `json:"time"`
//} `json:"data"`
}
func (a *API) OrderReceived(orderID int64) (err error) {
_, err = a.AccessAPI("order/poi_received", true, map[string]interface{}{
KeyOrderID: orderID,
@@ -570,6 +581,27 @@ func (a *API) OrderLogisticsStatus(orderID int64) (status *utils.RiderInfo, err
return logistics, err
}
func (a *API) GetDeliveryPath(orderId int64, appPoiCode string) (lng, lat int, err error) {
result, err := a.AccessAPI("order/getDeliveryPath", true, map[string]interface{}{
KeyOrderID: orderId,
KeyAppPoiCode: appPoiCode,
})
if err != nil {
return 0, 0, err
}
if result == nil {
return 0, 0, nil
}
path, _ := json.Marshal(result)
riderPath := make([]*GetRiderDeliveryPath, 0, 0)
if err := json.Unmarshal(path, &riderPath); err != nil {
return 0, 0, err
}
return riderPath[len(riderPath)-1].Longitude, riderPath[len(riderPath)-1].Latitude, nil
}
// OrderLogisticsFee 获取订单配送费
func (a *API) OrderLogisticsFee(orderID int64) (payFee float64, err error) {
result, err := a.AccessAPI("order/logistics/status", true, map[string]interface{}{

View File

@@ -87,6 +87,10 @@ func TestOrderLogisticsStatus(t *testing.T) {
t.Log(utils.Format4Output(result, false))
}
func TestGetDeliveryPath(t *testing.T) {
api.GetDeliveryPath(1000713330160837459, "7821254")
}
func TestOrderLogisticsFee(t *testing.T) {
result, err := api.OrderLogisticsFee(1100709560902354698)
if err != nil {