Documentation ¶
Index ¶
- Constants
- Variables
- func GetExpressCode(abbrName string) string
- func IsRequiredPhone(expCom string) bool
- type Data
- type ExpCom
- type Express
- type Option
- type Options
- type PushResp
- type QueryExpressResp
- type QueryParams
- type QueryReqConfig
- type QueryRequest
- type Result
- type SubscribeParam
- type SubscribeParameters
- type SubscribePush
- type SubscribeReq
- type SubscribeReqConfig
- type SubscribeResp
Constants ¶
View Source
const ( YTO = "yuantong" // 圆通 YD = "yunda" // 韵达 ZTO = "zhongtong" // 中通 STO = "shentong" // 申通 JTEX = "jtexpress" // 极兔速递 SF = "shunfeng" // 顺丰速运 EMS = "ems" // EMS YZPY = "youzhengguonei" // 邮政包裹 JD = "jd" // 京东 YZBK = "youzhengbk" // 邮政标准快递 DBL = "debangkuaidi" // 德邦快递 SFKY = "shunfengkuaiyun" // 顺丰快运 DN = "danniao" // 丹鸟 DB = "debangwuliu" // 德邦物流 JDKY = "jingdongkuaiyun" // 京东快运 ZTKY = "zhongtongkuaiyun" // 中通快运 HTKY = "huitongkuaidi" // 百世快递 FWSY = "fengwang" // 丰网速运 )
View Source
const ( ResultTypeClose = "0" // 关闭,即时查询 ResultTypeSimple = "1" // 开通行政区域解析功能以及物流轨迹增加物流状态名称 ResultTypeFull = "4" // 开通行政解析功能以及物流轨迹增加物流高级状态名称、状态值并且返回出发、目的及当前城市信息 )
Variables ¶
View Source
var ExpComAbbrMap = map[string]string{
"yuantong": "YTO",
"yunda": "YD",
"zhongtong": "ZTO",
"shentong": "STO",
"jtexpress": "JTEX",
"shunfeng": "SF",
"ems": "EMS",
"youzhengguonei": "YZPY",
"jd": "JD",
"youzhengbk": "YZBK",
"debangkuaidi": "DBL",
"shunfengkuaiyun": "SFKY",
"danniao": "DN",
"debangwuliu": "DB",
"jingdongkuaiyun": "JDKY",
"zhongtongkuaiyun": "ZTKY",
"huitongkuaidi": "HTKY",
"fengwang": "FWSY",
}
ExpComAbbrMap 快递公司简称
View Source
var ExpComFullNameMap = map[string]string{
"YTO": "yuantong",
"YD": "yunda",
"ZTO": "zhongtong",
"STO": "shentong",
"JTEX": "jtexpress",
"SF": "shunfeng",
"EMS": "ems",
"YZPY": "youzhengguonei",
"JD": "jd",
"YZBK": "youzhengbk",
"DBL": "debangkuaidi",
"SFKY": "shunfengkuaiyun",
"DN": "danniao",
"DB": "debangwuliu",
"JDKY": "jingdongkuaiyun",
"ZTKY": "zhongtongkuaiyun",
"HTKY": "huitongkuaidi",
"FWSY": "fengwang",
}
ExpComFullNameMap 快递公司全称
View Source
var ExpComNameMap = map[string]string{
"yuantong": "圆通",
"yunda": "韵达",
"zhongtong": "中通",
"shentong": "申通",
"jtexpress": "极兔速递",
"shunfeng": "顺丰速运",
"ems": "EMS",
"youzhengguonei": "邮政包裹",
"jd": "京东",
"youzhengbk": "邮政标准快递",
"debangkuaidi": "德邦快递",
"shunfengkuaiyun": "顺丰快运",
"danniao": "丹鸟",
"debangwuliu": "德邦物流",
"jingdongkuaiyun": "京东快运",
"zhongtongkuaiyun": "中通快运",
"huitongkuaidi": "百世快递",
"fengwang": "丰网速运",
}
ExpComNameMap 快递公司名称
Functions ¶
Types ¶
type Data ¶
type Data struct { Time string `json:"time"` // 物流事件发生的时间 Context string `json:"context"` // 物流事件的描述 Ftime string `json:"ftime"` // 物流事件发生的时间 AreaCode string `json:"areaCode"` // 物流事件发生的区域编码 AreaName string `json:"areaName"` // 物流事件发生的区域名称 Status string `json:"status"` // 物流事件的状态 Location string `json:"location"` // 物流事件的城市 AreaCenter string `json:"areaCenter"` // 物流事件的城市 AreaPinYin string `json:"areaPinYin"` // 物流事件的城市 StatusCode string `json:"statusCode"` // 物流事件的状态编码 }
type Express ¶
type Express struct {
// contains filtered or unexported fields
}
Express 快递100 SDK
func (*Express) AnalyticalPushData ¶
func (exp *Express) AnalyticalPushData(data, sign string) (*SubscribePush, error)
AnalyticalPushData 解析推送数据 https://api.kuaidi100.com/document/5f0ffa8f2977d50a94e1023c
func (*Express) QueryExpress ¶
func (exp *Express) QueryExpress(conf *QueryReqConfig) (*QueryExpressResp, error)
QueryExpress 快递查询 https://api.kuaidi100.com/document/5f0ffb5ebc8da837cbd8aefc
func (*Express) Subscription ¶
func (exp *Express) Subscription(conf *SubscribeReqConfig) error
Subscription 订阅快递 https://api.kuaidi100.com/document/5f0ffa8f2977d50a94e1023c
type Option ¶
type Option func(*Options)
func WithBaseUrl ¶
func WithCustomer ¶
func WithNotifyUrl ¶
func WithSecret ¶
type PushResp ¶
type PushResp struct { Result bool `json:"result"` // 推送处理结果 ReturnCode string `json:"returnCode"` // 推送处理结果编码 Message string `json:"message"` // 推送处理结果描述 }
PushResp 推送响应
type QueryExpressResp ¶
type QueryExpressResp struct { Message string `json:"message"` // 消息体, 可以忽略 State string `json:"state"` // 快递单当前状态,默认为0在途,1揽收,2疑难,3签收,4退签,5派件,8清关,14拒签等10个基础物流状态,如需要返回高级物流状态,请参考 resultv2 传值 Status string `json:"status"` // 通讯状态, 可以忽略 Condition string `json:"condition"` // 快递单明细状态标记,暂未实现,可以忽略 Nu string `json:"nu"` // 快递单号 Ischeck string `json:"ischeck"` // 是否签收标记 0:未签收 1:已签收 Com string `json:"com"` // 快递公司编码 Data []struct { Context string `json:"context"` // 物流事件的描述 Time string `json:"time"` // 物流事件发生的时间, 原始格式 Ftime string `json:"ftime"` // 物流事件发生的时间, 格式化后的 AreaCode string `json:"areaCode"` // 物流事件发生的区域编码 AreaName string `json:"areaName"` // 物流事件发生的区域名称 Status string `json:"status"` // 物流事件的状态 Location string `json:"location"` // 物流事件的城市 AreaCenter string `json:"areaCenter"` // 物流事件的城市 AreaPinYin string `json:"areaPinYin"` // 物流事件的城市 StatusCode string `json:"statusCode"` // 物流事件的状态编码 } `json:"data"` RouteInfo struct { From struct { Number string `json:"number"` // 出发地编码 Name string `json:"name"` // 出发地名称 } `json:"from"` Cur struct { Number string `json:"number"` // 当前所在地编码 Name string `json:"name"` // 当前所在地名称 } `json:"cur"` To interface{} `json:"to"` // 目的地 } `json:"routeInfo"` IsLoop bool `json:"isLoop"` // 是否循环推送 // 错误处理 Result bool `json:"result"` // 查询结果 ReturnCode string `json:"returnCode"` // 查询结果编码 }
QueryExpressResp 查询响应
type QueryParams ¶
type QueryParams struct { Com string `json:"com"` // 快递公司编码 Num string `json:"num"` // 快递单号 Phone string `json:"phone"` // 手机号 From string `json:"from"` // 出发地城市 To string `json:"to"` // 目的地城市 Resultv2 string `json:"resultv2"` // 开通行政区域解析功能:0-关闭(默认),1-开通 Show string `json:"show"` // 返回数据格式:0-json(默认),1-xml,2-html,3-text Order string `json:"order"` // 排序:desc-降序(默认),asc-升序 }
QueryParams 查询请求参数
type QueryReqConfig ¶
type QueryReqConfig struct { Com string // 快递公司编码 Num string // 快递单号 Phone string // 手机号 From string // 出发地城市 To string // 目的地城市 Resultv2 string // 开通行政区域解析功能:0-关闭(默认),1-开通 Show string // 返回数据格式:0-json(默认),1-xml,2-html,3-text Order string // 排序:desc-降序(默认),asc-升序 }
QueryReqConfig 查询请求配置
type QueryRequest ¶
type QueryRequest struct { Customer string `json:"customer"` Sign string `json:"sign"` Param *QueryParams `json:"param"` }
QueryRequest 查询请求
type Result ¶
type Result struct { Message string `json:"message"` // 监控状态相关消息,如:3天查询无记录,60天无变化 Nu string `json:"nu"` // 快递单号 Ischeck string `json:"ischeck"` // 是否签收标记 0:未签收 1:已签收 Com ExpCom `json:"com"` // 快递公司编码 Status string `json:"status"` // 快递单当前的状态 :0:在途,即货物处于运输过程中;1:揽件,货物已由快递公司揽收并且产生了第一条跟踪信息; Data []*Data `json:"data"` // 快递单明细状态标记,多行 State string `json:"state"` // 快递单当前状态,默认为0在途,1揽收,2疑难,3签收,4退签,5派件,8清关,14拒签等10个基础物流状态,如需要返回高级物流状态,请参考 resultv2 传值 Condition string `json:"condition"` // 快递单明细状态标记,多行 RouteInfo struct { From struct { Number string `json:"number"` Name string `json:"name"` } `json:"from"` Cur struct { Number string `json:"number"` Name string `json:"name"` } `json:"cur"` To interface{} `json:"to"` // 目的地 } `json:"routeInfo"` IsLoop bool `json:"isLoop"` // 是否循环推送 }
type SubscribeParam ¶
type SubscribeParam struct { Company string `json:"company"` // 快递公司编码 Number string `json:"number"` // 快递单号 From string `json:"from,omitempty"` // 出发地城市 To string `json:"to,omitempty"` // 目的地城市 Key string `json:"key"` // 授权key Parameters *SubscribeParameters `json:"parameters"` // 可选参数 }
SubscribeParam 请求参数
type SubscribeParameters ¶
type SubscribeParameters struct { CallbackUrl string `json:"callbackurl"` // 回调地址 Salt string `json:"salt,omitempty"` // MD5加密串 Resultv2 string `json:"resultv2"` // 开通行政区域解析功能:0-关闭(默认),1-开通 AutoCom string `json:"autoCom"` // 开通智能单号识别功能:0-关闭(默认),1-开通 InterCom string `json:"interCom"` // 开通国际版功能:0-关闭(默认),1-开通 DepartureCountry string `json:"departureCountry"` // 出发国 DepartureCom string `json:"departureCom"` // 出发国快递公司编码 DestinationCountry string `json:"destinationCountry"` // 目的国 DestinationCom string `json:"destinationCom"` // 目的国快递公司编码 Phone string `json:"phone"` // 手机号 顺丰速运、顺丰快运和丰网速运必填 }
SubscribeParameters 可选参数
type SubscribePush ¶
type SubscribePush struct { Status string `json:"status"` // 监控状态:polling:监控中,shutdown:结束,abort:中止,updateall:重新推送 Billstatus string `json:"billstatus"` // 包括got、sending、check三个状态,由于意义不大,已弃用,请忽略 Message string `json:"message"` // 监控状态相关消息,如:3天查询无记录,60天无变化 AutoCheck string `json:"autoCheck"` // 是否开启智能判断功能,当快递单号识别出多个快递公司时,是否开启智能判断功能,默认值0,0:关闭智能判断,1:开启智能判断 ComOld string `json:"comOld"` // 识别出的快递公司编码 ComNew string `json:"comNew"` // 智能判断出的快递公司编码 LastResult *Result `json:"lastResult"` // 最新查询结果,包括:comNew、nuNew、ischeck、condition、status、state、data、message、autoCheck、comOld、nuOld }
type SubscribeReq ¶
type SubscribeReq struct { Schema string `json:"schema"` // 返回的数据格式, json(默认),xml Param *SubscribeParam `json:"param"` // 请求参数 }
SubscribeReq 订阅请求
type SubscribeReqConfig ¶
type SubscribeReqConfig struct { Schema string // 返回的数据格式, json(默认),xml Company string // 快递公司编码 Number string // 快递单号 From string // 出发地城市 To string // 目的地城市 CallbackUrl string // 回调地址 Salt string // MD5加密串 Resultv2 string // 开通行政区域解析功能:0-关闭(默认),1-开通 AutoCom string // 开通智能单号识别功能:0-关闭(默认),1-开通 InterCom string // 开通国际版功能:0-关闭(默认),1-开通 DepartureCountry string // 出发国 DepartureCom string // 出发国快递公司编码 DestinationCountry string // 目的国 DestinationCom string // 目的国快递公司编码 Phone string // 手机号 顺丰速运、顺丰快运和丰网速运必填 }
type SubscribeResp ¶
Click to show internal directories.
Click to hide internal directories.