This commit is contained in:
邹宗楠
2022-10-31 17:48:48 +08:00
parent 6cf7948e6c
commit 04add8697e
3 changed files with 14 additions and 3 deletions

View File

@@ -8,7 +8,7 @@ import (
)
var token = `{"access_token":"c4afc5bc-7ddf-4244-b35a-0c393f3dca32","expires_in":1667203717,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"5a4f9dfe-306b-4bca-8b35-2ae9afc0245e","authority_id":""}`
var a = New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", token)
var a = New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", "")
// 查询售后单详情
func TestAfsOrder(t *testing.T) {

View File

@@ -96,3 +96,14 @@ func TestYearDay(t *testing.T) {
func TestApplyMarketAfterSale(t *testing.T) {
a.ApplyMarketAfterSale(4994383659114192282, 2, 3)
}
func TestOrderStatusAndPsInfo(t *testing.T) {
a := NewExpress("7153997323561879075", "3517d3ea-b96b-4379-a7a4-2d9389e8ffeb", "")
a.CreateToken()
param := make(map[string]interface{}, 0)
param["third_carrier_order_id"] = "1412943984034971648"
param["logistics_context"] = "骑手接单"
param["courier_name"] = "刘磊"
param["courier_phone"] = "18981810340"
a.OrderStatusAndPsInfo(param)
}

View File

@@ -127,7 +127,7 @@ func (a *APIExpress) OrderStatusAndPsInfo(param map[string]interface{}) error {
Traces: []logistics_indTrackPush_reqeust.TracesList{
{
Opcode: "ORDER_RECEIVED",
OpTime: utils.Time2TimeStr(time.Now()),
OpTime: utils.Time2Str(time.Now()),
Content: param["logistics_context"].(string),
Rider: logistics_indTrackPush_reqeust.ReiderInfo{
Name: param["courier_name"].(string),
@@ -148,7 +148,7 @@ func (a *APIExpress) OrderStatusAndPsInfo(param map[string]interface{}) error {
globals.SugarLogger.Debugf("OrderStatusAndPsInfo=========:%s", utils.Format4Output(request.Param, false))
if a.accessTokenObj == nil || a.accessTokenObj.CreateTokenData.AccessToken == "" {
a.CreateToken()
} else if a.accessTokenObj.CreateTokenData.ExpiresIn < time.Now().Unix() {
} else if a.expiresIn < time.Now().Unix() {
a.RefreshToken()
}
result, err := request.Execute(a.accessTokenObj)