Documentation ¶
Index ¶
- Constants
- func ErrorWrap(code int, message string) error
- type AccountProfile
- type Courier
- type CreateResult
- type CreateTrackRequest
- type DeleteTrackRequest
- type DeleteTrackRequests
- type DeleteTrackResult
- type Information
- type NormalResponse
- type RefreshResultError
- type RefreshResultSuccess
- type RefreshTrackRequest
- type RefreshTrackRequests
- type RemoteDetectionRequest
- type RemoteDetectionResult
- type StatusStatistic
- type StatusStatisticRequest
- type StopUpdateResultError
- type StopUpdateResultSuccess
- type StopUpdateTrackRequest
- type StopUpdateTrackRequests
- type Track
- type TrackInformation
- type Tracking51
- type TracksQueryParams
- type TransitTime
- type TransitTimeRequest
- type TransitTimeRequests
- type UpdateResult
- type UpdateTrackRequest
- type Webhook
- type WebhookRequest
Constants ¶
View Source
const ( Success = 200 // 无错误 PaymentRequiredError = 203 // API 服务只提供给付费账户,请付费购买单号以解锁 API 服务 NoContent = 204 // 请求成功,但未获取到数据,可能是该单号、所查询目标数据不存在 BadRequestError = 400 // 请求类型错误 NotFoundError = 404 // 请求的资源不存在 TimeOutError = 408 // 请求超时 RequestParametersTooLongError = 411 // 请求参数长度超过限制 RequestParametersFormatError = 412 // 请求参数格式不合要求 RequestParametersExceededLimitError = 413 // 请求参数数量超过限制 LostRequestParametersOrParseError = 417 // 缺少请求参数或者请求参数无法解析 ParametersInvalidError = 421 // 部分必填参数为空 CourierCodeInvalidError = 422 // 物流商简码无法识别或者不支持该物流商 TrackingNumberIsExistsError = 423 // 跟踪单号已存在,无需再次创建 TrackingNumberIsNotExistsError = 424 // 跟踪单号不存在 TooManyRequestsError = 429 // API 请求频率次数限制,请稍后再试 InternalError = 511 // 系统错误 )
https://www.51tracking.com/v3/api-index?language=Golang#%E5%93%8D%E5%BA%94
View Source
const ( StatusPending = "pending" // 查询中 StatusNotFound = "notfound" // 查询不到 StatusTransit = "transit" // 运输中 StatusPickup = "pickup" // 到达待取 StatusDelivered = "delivered" // 成功签收 StatusExpired = "notfound" // 运输过久 StatusUndelivered = "undelivered" // 投递失败 StatusException = "exception" // 可能异常 StatusInfoReceived = "inforeceived" // 待上网 )
View Source
const ( ChineseLanguage = "cn" EnglishLanguage = "en" )
View Source
const (
Version = "0.0.1"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AccountProfile ¶
type Courier ¶
type CreateResult ¶
type CreateTrackRequest ¶
type CreateTrackRequest struct { TrackingNumber string `json:"tracking_number"` // 包裹物流单号 CourierCode string `json:"courier_code"` // 物流商对应的唯一简码 OrderNumber string `json:"order_number,omitempty"` // 包裹的订单号,由商家/平台所产生的订单编号 Title string `json:"title,omitempty"` // 包裹名称 DestinationCode string `json:"destination_code,omitempty"` // 目的国的二字简码 LogisticsChannel string `json:"logistics_channel,omitempty"` // 自定义字段,用于填写物流渠道(比如某货代商) Note string `json:"note,omitempty"` // 备注 CustomerName string `json:"customer_name,omitempty"` // 客户姓名 CustomerEmail string `json:"customer_email,omitempty"` // 客户邮箱 CustomerPhone string `json:"customer_phone,omitempty"` // 顾客接收短信的手机号码。手机号码的格式应该为:“+区号手机号码”(例子:+8612345678910) ShippingDate string `json:"shipping_date,omitempty"` // 包裹发货时间(例子:2020-09-17 16:51) TrackingShippingDate string `json:"tracking_shipping_date,omitempty"` // 包裹的发货时间,其格式为:YYYYMMDD,有部分的物流商(如 deutsch-post)需要这个参数(例子:20200102) TrackingPostalCode string `json:"tracking_postal_code,omitempty"` // 收件人所在地邮编,仅有部分的物流商(如 postnl-3s)需要这个参数 TrackingDestinationCode string `json:"tracking_destination_code,omitempty"` // 目的国对应的二字简码,部分物流商(如postnl-3s)需要这个参数 TrackingCourierAccount string `json:"tracking_courier_account,omitempty"` // 物流商的官方账号,仅有部分的物流商(如 dynamic-logistics)需要这个参数 }
func (CreateTrackRequest) Validate ¶
func (m CreateTrackRequest) Validate() error
type DeleteTrackRequest ¶
type DeleteTrackRequest trackingNumberCourierCode
type DeleteTrackRequests ¶
type DeleteTrackRequests []DeleteTrackRequest
func (DeleteTrackRequests) Validate ¶
func (m DeleteTrackRequests) Validate() error
type DeleteTrackResult ¶
type DeleteTrackResult trackingNumberCourierCode
type Information ¶
type Information struct { CourierCode string `json:"courier_code"` // 物流商对应的唯一简码 CourierPhone string `json:"courier_phone"` // 物流商官网上的电话 Weblink string `json:"weblink"` // 物流商的官网的链接 ReferenceNumber string `json:"reference_number"` // 包裹对应的另一个单号,作用与当前单号相同(仅有少部分物流商提供) ReceivedDate string `json:"received_date"` // 物流商接收包裹的时间(也称为上 网时间) DispatchedDate string `json:"dispatched_date"` // 包裹封发时间,封发指将多个小包裹打包成一个货物(方便运输) DepartedAirportDate string `json:"departed_airport_date"` // 包裹离开此出发机场的时间 ArrivedAbroadDate string `json:"arrived_abroad_date"` // 包裹达到目的国的时间 CustomsReceivedDate string `json:"customs_received_date"` // 包裹移交给海关的时间 ArrivedDestinationDate string `json:"arrived_destination_date"` // 包裹达到目的国、目的城市的时间 TrackInfo []TrackInformation `json:"trackinfo"` // 详细物流信息 }
type NormalResponse ¶
type RefreshResultError ¶
type RefreshResultSuccess ¶
type RefreshResultSuccess struct {
// contains filtered or unexported fields
}
type RefreshTrackRequest ¶
type RefreshTrackRequest trackingNumberCourierCode
func (RefreshTrackRequest) Validate ¶
func (m RefreshTrackRequest) Validate() error
type RefreshTrackRequests ¶
type RefreshTrackRequests []RefreshTrackRequest
func (RefreshTrackRequests) Validate ¶
func (m RefreshTrackRequests) Validate() error
type RemoteDetectionRequest ¶
type RemoteDetectionRequest struct { PostalCode string `json:"postal_code"` // 该偏远地区所对应的邮编 Country string `json:"country,omitempty"` // 城市名称或者国家二字简码 CourierCode string `json:"courier_code,omitempty"` // 物流商简码 }
func (RemoteDetectionRequest) Validate ¶
func (m RemoteDetectionRequest) Validate() error
type RemoteDetectionResult ¶
type StatusStatistic ¶
type StatusStatistic struct { Pending int `json:"pending"` // 查询中:新增包裹正在查询中,请等待 NotFound int `json:"notfound"` // 查询不到:包裹信息目前查询不到 Transit int `json:"transit"` // 运输途中:物流商已揽件,包裹正被发往目的地 Pickup int `json:"pickup"` // 到达待取:包裹正在派送中,或到达当地收发点 Delivered int `json:"delivered"` // 成功签收:包裹已被成功投递 Expired int `json:"expired"` // 运输过久:包裹在很长时间内都未投递成功。快递包裹超过30天、邮政包裹超过60天未投递成功,该查询会被识别为此状态 Undelivered int `json:"undelivered"` // 投递失败:快递员投递失败(通常会留有通知并再次尝试投递) Exception int `json:"exception"` // 可能异常:包裹退回、包裹丢失、清关失败等异常情况 InfoReceived int `json:"infoReceived"` // 待上网:包裹正在等待被揽件 }
type StatusStatisticRequest ¶
type StatusStatisticRequest struct { CourierCode string `url:"courier_code,omitempty"` // 物流商对应的唯一简码 CreatedDateMin int64 `url:"created_date_min,omitempty"` // 创建查询的起始时间(时间戳格式) CreatedDateMax int64 `url:"created_date_max,omitempty"` // 创建查询的结束时间(时间戳格式) ShippingDateMin int64 `url:"shipping_date_min,omitempty"` // 发货的起始时间(时间戳格式) ShippingDateMax int64 `url:"shipping_date_max,omitempty"` // 发货的结束时间(时间戳格式) }
func (StatusStatisticRequest) Validate ¶
func (m StatusStatisticRequest) Validate() error
type StopUpdateResultError ¶
type StopUpdateResultError trackingNumberCourierCode
type StopUpdateResultSuccess ¶
type StopUpdateResultSuccess trackingNumberCourierCode
type StopUpdateTrackRequest ¶
type StopUpdateTrackRequest trackingNumberCourierCode
type StopUpdateTrackRequests ¶
type StopUpdateTrackRequests []StopUpdateTrackRequest
func (StopUpdateTrackRequests) Validate ¶
func (m StopUpdateTrackRequests) Validate() error
type Track ¶
type Track struct { TrackingNumber string `json:"tracking_number"` // 包裹物流单号 CourierCode string `json:"courier_code"` // 物流商对应的唯一简码 LogisticsChannel string `json:"logistics_channel"` // 自定义字段,用于填写物流渠道(比如某货代商) Destination string `json:"destination"` // 目的国的二字简码 TrackUpdate bool `json:"track_update"` // 自动更新查询功能的状态,“true”代表系统会自动更新查询结果,“false”则反之 Consignee string `json:"consignee"` // 签收人 Updating bool `json:"updating"` // “true”表示该单号会被继续更新,“false”表示该单号已停止更新 CreatedAt string `json:"created_at"` // 创建查询的时间 UpdateDate string `json:"update_date"` // 系统最后更新查询的时间 OrderCreateTime string `json:"order_create_time"` // 包裹发货时间 CustomerEmail string `json:"customer_email"` // 客户邮箱 CustomerPhone string `json:"customer_phone"` // 顾客接收短信的手机号码 Title string `json:"title"` // 包裹名称 OrderNumber string `json:"order_number"` // 包裹的订单号,由商家/平台所产生的订单编号 Note string `json:"note"` // 备注,可自定义 CustomerName string `json:"customer_name"` // 客户姓名 Archived bool `json:"archived"` // “true”表示该单号已被归档,“false”表示该单号处于未归档状态 Original string `json:"original"` // 发件国的名称 DestinationCountry string `json:"destination_country"` // 目的国的名称 TransitTime int `json:"transit_time"` // 包裹的从被揽收至被送达的时长(天) StayTime int `json:"stay_time"` // 物流信息未更新的时长(单位:天),由当前时间减去物流信息最近更新时间得到 DestinationTrackNumber string `json:"destination_track_number"` // 该包裹在目的国的物流单号 ExchangeNumber string `json:"exchangeNumber"` // 该包裹在中转站的物流商单号 ServiceCode string `json:"service_code"` // 快递服务类型,比如次日达(部分物流商返回) StatusInfo string `json:"status_info"` // 最新的一条物流信息 Weight string `json:"weight"` // 该货物的重量(多个包裹会被打包成一个“货物”) DestinationInfo Information `json:"destination_info"` // 目的国的物流信息 LatestEvent string `json:"latest_event"` // 最新物流信息的梗概,包括以下信息:状态、地址、时间 LatestCheckpointTime string `json:"lastest_checkpoint_time"` // 最新物流信息的更新时间 OriginInfo Information `json:"origin_info"` // 发件国的物流信息 }
type TrackInformation ¶
type TrackInformation struct { CheckpointDate string `json:"checkpoint_date"` // 本条物流信息的更新时间,由物流商提供(包裹被扫描时,物流信息会被更新) TrackingDetail string `json:"tracking_detail"` // 具体的物流情况 Location string `json:"location"` // 物流信息更新的地址(该包裹被扫描时,所在的地址) CheckpointDeliveryStatus string `json:"checkpoint_delivery_status"` // 根据具体物流情况所识别出来的物流状态 CheckpointDeliverySubStatus string `json:"checkpoint_delivery_substatus"` // 物流状态的子状态(物流状态) }
TrackInformation 详细物流信息
type Tracking51 ¶
type Tracking51 struct { Services services // API Services // contains filtered or unexported fields }
func NewTracking51 ¶
func NewTracking51(config config.Config) *Tracking51
type TracksQueryParams ¶
type TracksQueryParams struct { TrackingNumbers string `url:"tracking_numbers,omitempty"` // 查询单号,每次不得超过40个,单号间以逗号分隔 OrderNumbers string `url:"order_numbers,omitempty"` // 订单号,每次查询不得超过40个,订单号间以逗号分隔 DeliveryStatus string `url:"delivery_status,omitempty"` // 发货状态 ArchivedStatus string `url:"archived_status,omitempty"` // 指定该单号是否被归档。如果参数为字符串“true”,该单号将处于“归档”状态;如果参数为“false”,该单号处于“未归档”状态 ItemsAmount int `url:"items_amount,omitempty"` // 每页展示的单号个数 PagesAmount int `url:"pages_amount,omitempty"` // 返回结果的页数 CreatedDateMin int64 `url:"created_date_min,omitempty"` // 创建查询的起始时间(时间戳格式) CreatedDateMax int64 `url:"created_date_max,omitempty"` // 创建查询的结束时间(时间戳格式) ShippingDateMin int64 `url:"shipping_date_min,omitempty"` // 发货的起始时间(时间戳格式) ShippingDateMax int64 `url:"shipping_date_max,omitempty"` // 发货的结束时间(时间戳格式) UpdatedDateMin int64 `url:"updated_date_min,omitempty"` // 查询更新的起始时间(时间戳格式) UpdatedDateMax int64 `url:"updated_date_max,omitempty"` // 查询更新的结束时间(时间戳格式) Lang string `url:"lang,omitempty"` // 查询结果的语言(例子:cn, en),若未指定该参数,结果会以英文或中文呈现。 注意:只有物流商支持多语言查询结果时,该指定才会生效 }
func (TracksQueryParams) Validate ¶
func (m TracksQueryParams) Validate() error
type TransitTime ¶
type TransitTime struct { CourierCode string `json:"courier_code"` // 物流商对应的唯一简码 OriginalCode string `json:"original_code"` // 发件国二字简码 DestinationCode string `json:"destination_code"` // 目的国二字简码 Total int `json:"total"` // 未签收的总单号数量 Delivered int `json:"delivered"` // 已签收的总单号数量 Range1To7 float64 `json:"range_1_7"` // 送达时间为0~7天的单号的占比 Range8To15 float64 `json:"range_8_15"` // 送达时间为7~15天的单号的占比 Range16To30 float64 `json:"range_16_30"` // 送达时间为16~30天的单号的占比 Range31To60 float64 `json:"range_31_60"` // 送达时间为31~60天的单号的占比 Range60Up float64 `json:"range_60_up"` // 送达时间大于60天的单号的占比 AverageDeliveryTime float64 `json:"average_delivery_time"` // 平均送达时间(单位:天) }
type TransitTimeRequest ¶
type TransitTimeRequests ¶
type TransitTimeRequests []TransitTimeRequest
func (TransitTimeRequests) Validate ¶
func (m TransitTimeRequests) Validate() error
type UpdateResult ¶
type UpdateResult CreateResult
type UpdateTrackRequest ¶
type UpdateTrackRequest = CreateTrackRequest
type WebhookRequest ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.