提交 6e661735 authored 作者: zhanglibo's avatar zhanglibo

天猫物流

上级 93683086
...@@ -2,37 +2,37 @@ package tm ...@@ -2,37 +2,37 @@ package tm
import ( import (
"context" "context"
"encoding/json" "github.com/gogf/gf/encoding/gjson"
) )
type deliverTm struct { type logisticsTm struct {
} }
var Deliver = deliverTm{} var Logistics = logisticsTm{}
type DeliverInfoRes struct { type LogisticsTraceRes struct {
Code string `json:"Code"` Code string `json:"Code"`
Message string `json:"Message"` Message string `json:"Message"`
RequestId string `json:"RequestId"` RequestId string `json:"RequestId"`
Data struct { Data struct {
Data []struct { Data []struct {
DataProvider string `json:"DataProvider"` DataProvider string `json:"DataProvider"`
LogisticsDetailList struct { LogisticsCompanyName string `json:"LogisticsCompanyName"` //物流公司名称
MailNo string `json:"MailNo"` //运单号
LogisticsCompanyCode string `json:"LogisticsCompanyCode"` //物流公司Code
LogisticsDetailList struct {
LogisticsDetailList []struct { LogisticsDetailList []struct {
StanderdDesc string `json:"StanderdDesc"` //物流信息 StanderdDesc string `json:"StanderdDesc"`
OcurrTimeStr string `json:"OcurrTimeStr"` //发生时间 OcurrTimeStr string `json:"OcurrTimeStr"`
} `json:"LogisticsDetailList"` } `json:"LogisticsDetailList"`
} `json:"LogisticsDetailList"` } `json:"LogisticsDetailList"`
LogisticsCompanyName string `json:"LogisticsCompanyName"` //本单物流公司名称 DataProviderTitle string `json:"DataProviderTitle"`
LogisticsCompanyCode string `json:"logisticsCompanyCode"` //本单物流公司Code
MailNo string `json:"MailNo"` //运单号
DataProviderTitle string `json:"DataProviderTitle"` //数据来源说明,如:本数据由菜鸟裹裹提供
} `json:"Data"` } `json:"Data"`
} `json:"Data"` } `json:"Data"`
} }
//Info 物流查询接口 //Trace 物流查询接口
func (s *deliverTm) Info(ctx context.Context, UserId, LmOrderId string) (res *DeliverInfoRes, err error) { func (s *logisticsTm) Trace(ctx context.Context, UserId, LmOrderId string) (res *LogisticsTraceRes, err error) {
method := "queryLogistics" method := "queryLogistics"
...@@ -44,6 +44,6 @@ func (s *deliverTm) Info(ctx context.Context, UserId, LmOrderId string) (res *De ...@@ -44,6 +44,6 @@ func (s *deliverTm) Info(ctx context.Context, UserId, LmOrderId string) (res *De
} }
result, err := post(ctx, method, request) result, err := post(ctx, method, request)
_ = json.Unmarshal([]byte(result), &res) err = gjson.New(result).Scan(&res)
return return
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论