1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package tm
import (
"context"
"encoding/json"
link "github.com/alibabacloud-go/linkedmall-20220531/v2/client"
"github.com/alibabacloud-go/tea/tea"
"github.com/gogf/gf/encoding/gjson"
)
type logisticsTmNew struct {
}
var Logistics = logisticsTmNew{}
type LogisticsTraceRes struct {
Code string `json:"Code"`
Message string `json:"Message"`
RequestId string `json:"RequestId"`
Model []struct{
MailNo string `json:"MailNo"`
DataProvIDer string `json:"DataProvIDer"`
DataProvIDerTitle string `json:"DataProvIDerTitle"`
LogisticsCompanyCode string `json:"LogisticsCompanyCode"`
LogisticsCompanyName string `json:"LogisticsCompanyName"`
LogisticsDetailList []struct {
OcurrTimeStr string `json:"OcurrTimeStr"`
StanderdDesc string `json:"StanderdDesc"`
} `json:"LogisticsDetailList"`
Goods []struct {
GoodName string `json:"GoodName"`
Quantity interface{} `json:"Quantity"`
ItemID string `json:"ItemID"`
} `json:"Goods"`
} `json:"Model"`
}
//Trace 物流查询接口
func (s *logisticsTmNew) QueryLogistics4Distribution(ctx context.Context,orderSn string) (res *LogisticsTraceRes, err error) {
client,err :=initClient()
if err!=nil{
return
}
if client==nil{
return
}
result ,err :=client.QueryLogistics4Distribution(&link.QueryLogistics4DistributionRequest{
DistributorId: tea.String(server.DistributorId),
MainDistributionOrderId: tea.String(orderSn),
TenantId: tea.String(server.TenantId),
})
if result==nil{
return
}
log(ctx,gjson.New(orderSn).MustToJsonString(),result.Body,err)
if err!=nil{
return
}
a,_:=json.Marshal(result.Body)
err =json.Unmarshal([]byte(a),&res)
return
}