1
This commit is contained in:
@@ -26,7 +26,7 @@ func init() {
|
||||
//api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "")
|
||||
|
||||
//商超
|
||||
api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_r36FEse6_ywebQI65FNNWA") //token_n4TwqCntWWuvQwAawzxC0w
|
||||
api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_n_YVCkjFuV_0-76UFfNKCg") //token_n4TwqCntWWuvQwAawzxC0w
|
||||
cookieStr := `
|
||||
acctId=57396785; token=0bWbK5VbK50E2BmIhIH2zHB-am_y7mB37yXHm6RLZWx4*; wmPoiId=-1;
|
||||
`
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -555,16 +554,20 @@ func (a *API) OrderLogisticsCancel(orderID int64, reason string) (err error) {
|
||||
}
|
||||
|
||||
// OrderLogisticsStatus 获取订单状态
|
||||
func (a *API) OrderLogisticsStatus(orderID int64) (status int64, err error) {
|
||||
func (a *API) OrderLogisticsStatus(orderID int64) (status *utils.RiderInfo, err error) {
|
||||
result, err := a.AccessAPI("order/logistics/status", true, map[string]interface{}{
|
||||
KeyOrderID: orderID,
|
||||
})
|
||||
if err != nil {
|
||||
return 0, err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
logistics := &utils.RiderInfo{}
|
||||
data := result.(map[string]interface{})
|
||||
return utils.Interface2Int64WithDefault(data["logistics_status"], 0), err
|
||||
logistics.LogisticsStatus = int(utils.Interface2Int64WithDefault(data["logistics_status"], 0))
|
||||
logistics.CourierName = utils.Interface2String(data["dispatcher_name"])
|
||||
logistics.CourierPhone = utils.Interface2String(data["dispatcher_mobile"])
|
||||
return logistics, err
|
||||
}
|
||||
|
||||
// OrderLogisticsFee 获取订单配送费
|
||||
@@ -572,7 +575,6 @@ func (a *API) OrderLogisticsFee(orderID int64) (payFee float64, err error) {
|
||||
result, err := a.AccessAPI("order/logistics/status", true, map[string]interface{}{
|
||||
KeyOrderID: orderID,
|
||||
})
|
||||
globals.SugarLogger.Debugf("=resutl := %s", utils.Format4Output(result, false))
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
@@ -81,14 +81,14 @@ func TestOrderLogisticsStatus(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if result == 0 {
|
||||
if result == nil {
|
||||
t.Fatal("result should have value")
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
func TestOrderLogisticsFee(t *testing.T) {
|
||||
result, err := api.OrderLogisticsFee(900699454211738469)
|
||||
result, err := api.OrderLogisticsFee(1100709560902354698)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user