Documentation
¶
Index ¶
- Constants
- Variables
- type CardType
- type CompanyCode
- type CustomParams
- type DeliveryService
- type Express
- type ExpressType
- type MonitorStatus
- type PayType
- type Query
- type QueryMapResponse
- type QueryMapResponseData
- type QueryParams
- type QueryPostageParams
- type QueryPostageResponse
- type QueryResponse
- type SendParcelParams
- type SendParcelResponse
- type Sort
- type State
- type SubscribeCallbackMapPush
- type SubscribeCallbackPush
- type SubscribeParams
- type Track
Constants ¶
View Source
const ( StateInTransit = 0 // 在途 StatePickUp = 1 // 揽件 StateDifficult = 2 // 疑难件 StateSign = 3 // 签收 StateReject = 4 // 退签 StateDispatch = 5 // 派件 StateClearance = 8 // 清关 StateRefuse = 14 // 拒签 )
View Source
const ( SortDesc = "desc" // 降序 SortAsc = "asc" // 升序 )
View Source
const ( PayTypeSender = iota + 1 // 寄付 PayTypeRecipient // 到付 )
View Source
const ( ExpressTypeDomesiticExpress = iota + 1 // 国内快递 ExpressTypeInternationalExpress // 国际快递 ExpressTypeDomesiticLogistics // 国内物流 ExpressTypeInternationalLogistics // 国际物流 )
Variables ¶
View Source
var MonitorStatusMap = map[MonitorStatus]string{ Polling: "polling", Shutdown: "shutdown", Abort: "abort", UpdateAll: "updateall", }
View Source
var MonitorStatusReverseMap = map[string]MonitorStatus{ "polling": Polling, "shutdown": Shutdown, "abort": Abort, "updateall": UpdateAll, }
Functions ¶
This section is empty.
Types ¶
type CustomParams ¶
type CustomParams map[string]interface{}
type DeliveryService ¶ added in v1.12.10
type DeliveryService interface {
BSendParcel(params *SendParcelParams) (*SendParcelResponse, error) // B端寄件
QueryPostage(params *QueryPostageParams) (*QueryPostageResponse, error) // 查询运费
}
type ExpressType ¶ added in v1.12.10
type ExpressType uint8
type MonitorStatus ¶ added in v1.12.10
type MonitorStatus uint8
MonitorStatus 监控状态
const ( Polling MonitorStatus = iota // 监控中 Shutdown // 结束 Abort // 中止 UpdateAll // 重新推送 )
func ReverseString ¶ added in v1.12.10
func ReverseString(monitor string) MonitorStatus
func (MonitorStatus) String ¶ added in v1.12.10
func (s MonitorStatus) String() string
type Query ¶
type Query interface {
Query(params *QueryParams) (*QueryResponse, error) // 实时查询
QueryMapTrack(params *QueryParams) (*QueryMapResponse, error) // 实时查询地图轨迹
Subscribe(params *SubscribeParams) error // 订阅轨迹
VerifyCallbackPush(data, sign string) (*SubscribeCallbackPush, error) // 验证回调推送数据
SubscribeMapTrack(params *SubscribeParams) error // 订阅地图轨迹
VerifyCallbackMapPush(data, sign string) (*SubscribeCallbackMapPush, error) // 验证地图轨迹回调推送数据
}
type QueryMapResponse ¶
type QueryMapResponse struct {
State State `json:"state"` // 快递单当前状态
IsSigned bool `json:"is_signed"` // 是否签收
CompCode CompanyCode `json:"comp_code"` // 快递公司编码
ExpNo string `json:"exp_no"` // 快递单号
TrailUrl string `json:"trail_url"` // 轨迹地图链接
ArrivalTime time.Time `json:"arrival_time"` // 预计到达时间
TotalTime string `json:"total_time"` // 平均耗时
RemainTime string `json:"remain_time"` // 剩余时间
Data *QueryMapResponseData `json:"data"` // 轨迹数据
}
type QueryMapResponseData ¶
type QueryMapResponseData struct {
Describe string `json:"describe"` // 物流事件的描述
Time time.Time `json:"time"` // 物流事件发生的时间
Status string `json:"status"` // 物流事件的状态
Area string `json:"area"` // 物流事件发生的区域
StatusCode string `json:"status_code"` // 物流事件的状态码
Coordinate string `json:"coordinate"` // 物流事件的城市经纬度坐标
Location string `json:"location"` // 物流事件的城市
}
type QueryParams ¶
type QueryParams struct {
CompCode CompanyCode // 快递公司编码
ExpNo string // 快递单号
Phone string // 快递对应收件/寄件人手机号
From string // 出发地城市
To string // 目的地城市
Sort Sort // 排序 desc asc
CustomParams CustomParams // 自定义参数
}
QueryParams 查询参数
type QueryPostageParams ¶
type QueryPostageParams struct {
CompCode CompanyCode // 快递公司编码
SenderAddr string // 寄件人地址
ReceiverAddr string // 收件人地址
Weight float64 // 物品重量
ExpType ExpressType // 快递类型
}
QueryPostageParams 查询运费参数
type QueryPostageResponse ¶
type QueryPostageResponse struct {
FirstWeight float64 // 首重价格
ContinuedWeight float64 // 续重价格
TotalPrice float64 // 总价格
ExpType ExpressType // 快递类型
}
QueryPostageResponse 查询运费响应
type QueryResponse ¶
type QueryResponse struct {
State State `json:"state"` // 快递单当前状态
IsSigned bool `json:"is_signed"` // 是否签收
CompCode CompanyCode `json:"comp_code"` // 快递公司编码
ExpNo string `json:"exp_no"` // 快递单号
Tracks []*Track `json:"tracks"` // 轨迹数据
}
QueryResponse 查询响应
type SendParcelParams ¶ added in v1.12.10
type SendParcelParams struct {
CompCode CompanyCode // 快递公司编码
Recipient string // 收件人姓名
RecipientPhone string // 收件人手机号
RecipientAddr string // 收件人地址
SenderName string // 寄件人姓名
SenderPhone string // 寄件人手机号
SenderAddr string // 寄件人地址
ItemName string // 物品名称
PayType PayType // 付款方式 1-寄付 2-到付 3-第三方付
ServiceType string // 服务类型 1-标准快递 2-同城快递 3-当日快递 4-次晨快递 5-即时快递 6-国际快递
Weight float64 // 物品重量
Remark string // 备注
DayType string // 预约时间
StartTime string // 预约开始时间
EndTime string // 预约结束时间
ValinsPay float64 // 保价金额
RealName string // 实名认证姓名
SenderIdCardType CardType // 寄件人证件类型
SenderIdCard string // 寄件人证件号
PwdSigning string // 密码签收
TradeNo string // 平台交易号
}
SendParcelParams 寄件参数
type SendParcelResponse ¶ added in v1.12.10
type SubscribeCallbackMapPush ¶
type SubscribeCallbackMapPush struct {
// 监控状态
Status MonitorStatus `json:"status"` // 物流事件的状态
Message string `json:"message"` // 物流事件的描述
ShouldResubscribe bool `json:"should_resubscribe"` // 是否需要重新订阅
// 快递信息
State State `json:"state"` // 快递单当前状态
IsSigned bool `json:"is_signed"` // 是否检查
CompCode CompanyCode `json:"comp_code"` // 快递公司编码
ExpNo string `json:"exp_no"` // 快递单号
TrailUrl string `json:"trail_url"` // 轨迹地图链接
ArrivalTime time.Time `json:"arrival_time"` // 预计到达时间
TotalTime string `json:"total_time"` // 平均耗时
RemainTime string `json:"remain_time"` // 剩余时间
Data *QueryMapResponseData `json:"data"` // 轨迹数据
}
type SubscribeCallbackPush ¶
type SubscribeCallbackPush struct {
// 监控状态
Status MonitorStatus `json:"status"` // 物流事件的状态
Message string `json:"message"` // 物流事件的描述
ShouldResubscribe bool `json:"should_resubscribe"` // 是否需要重新订阅
// 快递信息
State State `json:"state"` // 快递单当前状态
IsSigned bool `json:"is_signed"` // 是否检查
CompCode CompanyCode `json:"comp_code"` // 快递公司编码
ExpNo string `json:"exp_no"` // 快递单号
Tracks []*Track `json:"tracks"` // 轨迹数据
}
SubscribeCallbackPush 订阅回调推送
type SubscribeParams ¶
type SubscribeParams struct {
CompCode CompanyCode // 快递公司编码
ExpNo string // 快递单号
Phone string // 快递对应收件/寄件人手机号
From string // 出发地城市
CallbackUrl string // 回调地址
To string // 目的地城市
Sort Sort // 排序 desc asc
CustomParams CustomParams // 自定义参数
}
SubscribeParams 订阅参数
type Track ¶
type Track struct {
Description string `json:"description"` // 物流事件的描述
Time time.Time `json:"time"` // 物流事件发生的时间, 原始格式
Area string `json:"area"` // 物流事件发生的区域
Status State `json:"status"` // 物流事件的状态
Location string `json:"location"` // 物流事件的城市
Coordinates string `json:"coordinates"` // 物流事件的城市经纬度坐标
}
Track 物流轨迹
Click to show internal directories.
Click to hide internal directories.