kdniao

package module
v0.0.0-...-9f5c5aa Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2017 License: MIT Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	EXPRESS_SF     = "SF"     // 顺丰
	EXPRESS_HTKY   = "HTKY"   // 百世快递
	EXPRESS_ZTO    = "ZTO"    // 中通
	EXPRESS_STO    = "STO"    // 申通
	EXPRESS_YTO    = "YTO"    // 圆通
	EXPRESS_YD     = "YD"     // 韵达
	EXPRESS_YZPY   = "YZPY"   // 邮政平邮
	EXPRESS_EMS    = "EMS"    // EMS
	EXPRESS_HHTT   = "HHTT"   // 天天快递
	EXPRESS_JD     = "JD"     // 京东
	EXPRESS_QFKD   = "QFKD"   // 全峰快递
	EXPRESS_GTO    = "GTO"    // 国通
	EXPRESS_UC     = "UC"     // 优速
	EXPRESS_DBL    = "DBL"    // 德邦
	EXPRESS_FAST   = "FAST"   // 快捷
	EXPRESS_AMAZON = "AMAZON" // 亚马逊
	EXPRESS_ZJS    = "ZJS"    // 宅急送
)
View Source
const (
	PayTypeSpot           = "1" // 现付
	PayTypeFreightCollect = "2" // 到付
	PayTypeMonthly        = "3" // 月结
	PayTypeThirdpary      = "4" // 第三方支付
)
View Source
const (
	StatusNone            = "0" // 无轨迹
	StatusTook            = "1" // 已揽收
	StatusInTransit       = "2" // 在途中
	StatusSignedFor       = "3" // 签收
	StatusProblemShipment = "4" // 问题件
)
View Source
const (
	ReqCreateEOder      = "1007"
	ReqSubscribeTracing = "1008"

	PushTracing = "101"
	PushPayment = "107"
)
View Source
const (
	ErrSuccess                = "100" // 成功
	ErrInsufficientParameters = "101" // 缺少必要参数
	ErrVerifyFailure          = "102" // 校验问题
	ErrInvalidFormat          = "103" // 格式问题
	ErrUserProblem            = "104" // 用户问题
	ErrOtherError             = "105" // 其他错误
	ErrReqInvalidFormat       = "401" // RequestData格式有误
	ErrNoOrder                = "402" // 缺少快递单号
	ErrSpecialChars           = "403" // 快递单号有特殊字符
	ErrOrderWrongLength       = "404" // 快递单号长度不符
	ErrExceedQueryFrequence   = "405" // 超出查询次数限制(日查询次数<=3万)
)
View Source
const (
	BASE_URL      = "http://api.kdniao.cc/api"
	TEST_BASE_URL = "http://testapi.kdniao.cc:8081/api"
)
View Source
const (
	ExpTypeStandard = "1"
)

Variables

This section is empty.

Functions

func PrintHandler

func PrintHandler(c *mel.Context, client *Client)

func PushHandler

func PushHandler(c *mel.Context, tracingHandler func([]TracingData))

Types

type AddService

type AddService struct {
	Name       string `json:"Name,omitempty"`       // 增值服务名称
	Value      string `json:"Value,omitempty"`      // 增值服务值
	CustomerID string `json:"CustomerID,omitempty"` // 客户标识(选填)
}

type Client

type Client struct {
	EBusinessID string
	AppKey      string
	*http.Client
}

func NewClient

func NewClient(eid, appKey string, httpClient ...*http.Client) *Client

func (*Client) CreateEOrder

func (c *Client) CreateEOrder(order *EOrderReq) (*EOrderRep, error)

func (*Client) SubscribeTracing

func (c *Client) SubscribeTracing(sub *SubscribeTracingReq) error

type Commodity

type Commodity struct {
	GoodsName     string `json:"GoodsName"`     // 商品名称
	GoodsCode     string `json:"GoodsCode"`     // 商品编码
	Goodsquantity string `json:"Goodsquantity"` // 件数
	GoodsPrice    string `json:"GoodsPrice"`    // 商品价格
	GoodsWeight   string `json:"GoodsWeight"`   // 商品重量kg
	GoodsDesc     string `json:"GoodsDesc"`     // 商品描述
	GoodsVol      string `json:"GoodsVol"`      // 商品体积m3
}

type EOrderRep

type EOrderRep struct {
	EBusinessID string `json:"EBusinessID"` // 电商用户ID
	Order       struct {
		OrderCode       string `json:"OrderCode"`                 // 订单编号
		ShipperCode     string `json:"ShipperCode"`               // 快递公司编码
		LogisticCode    string `json:"LogisticCode"`              // 快递单号
		MarkDestination string `json:"MarkDestination,omitempty"` // 大头笔
		OriginCode      string `json:"OriginCode,omitempty"`      // 始发地区域编码
		OriginName      string `json:"OriginName,omitempty"`      // 始发地/始发网点
		DestinatioCode  string `json:"DestinatioCode,omitempty"`  // 目的地区域编码
		DestinatioName  string `json:"DestinatioName,omitempty"`  // 目的地/到达网点
		SortingCode     string `json:"SortingCode,omitempty"`     // 分拣编码
		PackageCode     string `json:"PackageCode,omitempty"`     // 集包编码
	} `json:"Order"`
	Success               bool   `json:"Success"`                         // 成功与否
	ResultCode            string `json:"ResultCode"`                      // 错误编码
	Reason                string `json:"Reason,omitempty"`                // 失败原因
	UniquerRequestNumber  string `json:"UniquerRequestNumber"`            // 唯一标识
	PrintTemplate         string `json:"PrintTemplate,omitempty"`         // 面单打印模板
	EstimatedDeliveryTime string `json:"EstimatedDeliveryTime,omitempty"` // 订单预计到货时间yyyy-mm-dd
	Callback              string `json:"Callback,omitempty"`              // 用户自定义回调信息
	SubCount              int    `json:"SubCount,omitempty"`              // 子单数量
	SubOrders             string `json:"SubOrders,omitempty"`             // 子单号
	SubPrintTemplates     string `json:"SubPrintTemplates,omitempty"`     // 子单模板
	ReceiverSafePhone     string `json:"ReceiverSafePhone,omitempty"`     // 收件人安全电话
	SenderSafePhone       string `json:"SenderSafePhone,omitempty"`       // 寄件人安全电话
	DialPage              string `json:"DialPage"`                        // 拨号页面网址(转换成二维码可扫描拨号)
}

type EOrderReq

type EOrderReq struct {
	CallBack              string      `json:"Callback"`               // 用户自定义回调信息
	MemberID              string      `json:"MemberID"`               // 会员标识,平台方与快递鸟统一用户标识的商家ID
	CustomerName          string      `json:"CustomerName"`           // 电子面单客户账号,(与快递网点申请或通过快递鸟官网申请或通过申请电子面单客户号申请)
	CustomerPwd           string      `json:"CustomerPwd"`            // 电子面单密码
	SendSite              string      `json:"SendSite"`               // 收件网点标识
	ShipperCode           string      `json:"ShipperCode"`            // 快递公司编码
	LogisticCode          string      `json:"LogisticCode"`           // 快递单号
	ThrOrderCode          string      `json:"ThrOrderCode,omitempty"` // 第三方订单号
	OrderCode             string      `json:"OrderCode"`              // 订单编号
	MonthCode             string      `json:"MonthCode"`              // 月结编码
	PayType               string      `json:"PayType"`                // 邮费支付方式: 1-现付,2-到付,3-月结,4-第三方支付
	ExpType               string      `json:"ExpType"`                // 快递类型:1-标准快件
	IsNotice              string      `json:"IsNotice"`               // 是否通知快递员上门揽件:0-通知;1-不通知;不填则默认为1
	Cost                  string      `json:"Cost"`                   // 寄件费(运费)
	OtherCost             string      `json:"OtherCost"`              // 其他费用
	Receiver              Receiver    `json:"Receiver"`
	Sender                Sender      `json:"Sender"`
	StartDate             string      `json:"StartDate"` // 上门取货时间段: "yyyy-MM-dd HH:mm:ss"格式化,本文中所有时间格式相同
	EndDate               string      `json:"EndDate"`
	Weight                string      `json:"Weight"`   // 物品总重量kg
	Quantity              string      `json:"Quantity"` // 件数/包裹数
	Volume                string      `json:"Volume"`   // 物品总体积m3
	Remark                string      `json:"Remark"`   // 备注
	AddService            *AddService `json:"AddService,omitempty"`
	Commodity             []Commodity `json:"Commodity"`
	IsReturnPrintTemplate string      `json:"IsReturnPrintTemplate"`   // 返回电子面单模板:0-不需要;1-需要
	IsSendMessage         string      `json:"IsSendMessage,omitempty"` // 是否订阅短信:0-不需要;1-需要
	TemplateSize          string      `json:"TemplateSize,omitempty"`  // 模板尺寸
}

type Receiver

type Receiver struct {
	Company      string `json:"Company,omitempty"` // 收件人公司
	Name         string `json:"Name"`              // 收件人
	Tel          string `json:"Tel,omitempty"`     // 电话与手机,必填一个
	Mobile       string `json:"Mobile,omitempty"`
	PostCode     string `json:"PostCode,omitempty"`    // 收件人邮编
	ProvinceName string `json:"ProvinceName"`          // 收件省(如广东省,不要缺少“省”)
	CityName     string `json:"CityName"`              // 收件市(如深圳市,不要缺少“市”)
	ExpAreaName  string `json:"ExpAreaName,omitempty"` // 收件区(如福田区,不要缺少“区”或“县”)
	Address      string `json:"Address"`               // 收件人详细地址
}

type Sender

type Sender struct {
	Company      string `json:"Company,omitempty"` // 发件人公司
	Name         string `json:"Name"`              // 发件人
	Tel          string `json:"Tel,omitempty"`     // 电话与手机,必填一个
	Mobile       string `json:"Mobile,omitempty"`
	PostCode     string `json:"PostCode,omitempty"`    //	发件人邮编
	ProvinceName string `json:"ProvinceName"`          // 发件省(如广东省,不要缺少“省”)
	CityName     string `json:"CityName"`              // 发件市(如深圳市,不要缺少“市”)
	ExpAreaName  string `json:"ExpAreaName,omitempty"` // 发件区(如福田区,不要缺少“区”或“县”)
	Address      string `json:"Address"`               // 发件详细地址
}

type Server

type Server struct {
	*mel.Mel
}

func NewServer

func NewServer(pushURL string, tracingHandler func([]TracingData), logger *zap.SugaredLogger) *Server

func (*Server) HandlePrint

func (s *Server) HandlePrint(printURL string, client *Client)

type SubscribeTracingReq

type SubscribeTracingReq struct {
	ShipperCode  string `json:"ShipperCode"`  // 快递公司编码
	LogisticCode string `json:"LogisticCode"` // 快递单号
}

type TracingData

type TracingData struct {
	EBusinessID           string        `json:"EBusinessID,omitemtpy"`           // 电商用户ID
	OrderCode             string        `json:"OrderCode,omitempty"`             // 订单编号
	ShipperCode           string        `json:"ShipperCode"`                     // 快递公司编码
	LogisticCode          string        `json:"LogisticCode"`                    // 物流运单号
	Success               bool          `json:"Success"`                         // 成功与否
	Reason                string        `json:"Reason,omitempty"`                // 失败原因
	State                 string        `json:"State"`                           // 物流状态: 0-无轨迹 1-已揽收 2-在途中 3-签收 4-问题件
	CallBack              string        `json:"CallBack,omitempty"`              // 订阅接口的Bk值
	Traces                []TracingItem `json:"Traces"`                          // 物流轨迹详情
	EstimatedDeliveryTime string        `json:"EstimatedDeliveryTime,omitempty"` // 预计到达时间yyyy-mm-dd
	PickerInfo            struct {
		PersonName     string `json:"PersonName,omitempty"`     // 快递员姓名
		PersonTel      string `json:"PersonTel,omitempty"`      // 快递员电话
		PersonCode     string `json:"PersonCode,omitempty"`     // 快递员工号
		StationName    string `json:"StationName,omitempty"`    // 网点名称
		StationAddress string `json:"StationAddress,omitempty"` // 网点地址
		StationTel     string `json:"StationTel,omitempty"`     // 网点电话
	} `json:"PickerInfo,omitempty"` // 收件员信息
	SenderInfo struct {
		PersonName     string `json:"PersonName,omitempty"`     // 派件员姓名
		PersonTel      string `json:"PersonTel,omitempty"`      // 派件员快递员电话
		PersonCode     string `json:"PersonCode,omitempty"`     // 派件员快递员工号
		StationName    string `json:"StationName,omitempty"`    // 派件员网点名称
		StationAddress string `json:"StationAddress,omitempty"` // 派件员网点地址
		StationTel     string `json:"StationTel,omitempty"`     // 派件员网点电话
	} `json:"SenderInfo,omitempty"` // 派件员信息
}

type TracingItem

type TracingItem struct {
	AcceptTime    string `json:"AcceptTime"`       // 时间
	AcceptStation string `json:"AcceptStation"`    // 描述
	Remark        string `json:"Remark,omitempty"` // 备注
}

Jump to

Keyboard shortcuts

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