kuaidi100

package
v1.0.215 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 11, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogTable = "kuaidi100"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client 实例

func NewClient

func NewClient(config *ClientConfig) (*Client, error)

NewClient 创建实例化

func (*Client) Config

func (c *Client) Config(customer string) *Client

func (*Client) ConfigSLogClientFun added in v1.0.162

func (c *Client) ConfigSLogClientFun(apiSLogFun golog.ApiSLogFun)

ConfigSLogClientFun 日志配置

func (*Client) DefaultHttp added in v1.0.177

func (c *Client) DefaultHttp()

DefaultHttp 默认请求

func (*Client) GetCustomer

func (c *Client) GetCustomer() string

func (*Client) GetKey

func (c *Client) GetKey() string

func (*Client) Poll

func (c *Client) Poll(ctx context.Context, notMustParams ...gorequest.Params) (*PollResult, error)

Poll 实时快递查询接口 https://api.kuaidi100.com/document/5f0ffb5ebc8da837cbd8aefc

func (*Client) PollQuery

func (c *Client) PollQuery(ctx context.Context, notMustParams ...gorequest.Params) (*PollQueryResult, error)

PollQuery 实时快递查询接口 https://api.kuaidi100.com/document/5f0ffb5ebc8da837cbd8aefc

func (*Client) SetHttp added in v1.0.177

func (c *Client) SetHttp(app *gorequest.App)

SetHttp 配置请求

type ClientConfig

type ClientConfig struct {
	Customer string // 授权码
	Key      string // 密钥
}

ClientConfig 实例配置

type PollQueryResponse

type PollQueryResponse struct {
	Message string `json:"message"` // 消息体,请忽略
	Nu      string `json:"nu"`      // 单号
	Ischeck string `json:"ischeck"` // 是否签收标记,0未签收,1已签收,请忽略,明细状态请参考state字段
	Com     string `json:"com"`     // 快递公司编码,一律用小写字母
	Status  string `json:"status"`  // 通讯状态,请忽略
	Data    []struct {
		Time       string `json:"time"`       // 时间,原始格式
		Context    string `json:"context"`    // 内容
		Ftime      string `json:"ftime"`      // 格式化后时间
		AreaCode   string `json:"areaCode"`   // 本数据元对应的行政区域的编码,实时查询接口中提交resultv2=1或者resultv2=4标记后才会出现
		AreaName   string `json:"areaName"`   // 本数据元对应的行政区域的名称,实时查询接口中提交resultv2=1或者resultv2=4标记后才会出现
		Status     string `json:"status"`     // 本数据元对应的物流状态名称或者高级状态名称,实时查询接口中提交resultv2=1或者resultv2=4标记后才会出现
		Location   string `json:"location"`   // 本数据元对应的快件当前地点,实时查询接口中提交resultv2=4标记后才会出现
		AreaCenter string `json:"areaCenter"` // 本数据元对应的行政区域经纬度,实时查询接口中提交resultv2=4标记后才会出现
		AreaPinYin string `json:"areaPinYin"` // 本数据元对应的行政区域拼音,实时查询接口中提交resultv2=4标记后才会出现
		StatusCode string `json:"statusCode"` // 本数据元对应的高级物流状态值,实时查询接口中提交resultv2=4标记后才会出现
	} `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 PollQueryResult

type PollQueryResult struct {
	Result PollQueryResponse  // 结果
	Body   []byte             // 内容
	Http   gorequest.Response // 请求
}

type PollResponse

type PollResponse struct {
	Result     bool   `json:"result"`
	ReturnCode string `json:"returnCode"`
	Message    string `json:"message"`
}

type PollResult

type PollResult struct {
	Result PollResponse       // 结果
	Body   []byte             // 内容
	Http   gorequest.Response // 请求
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL