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

@@ -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 {