-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRoutePushService.go
More file actions
55 lines (47 loc) · 1.7 KB
/
RoutePushService.go
File metadata and controls
55 lines (47 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// @description 顺丰接口的sdk封装
// @link https://github.com/chenghuama/sf
// @license https://github.com/chenghuama/sf/blob/master/LICENSE
// @authors chenghuama(chenghuama@vip.qq.com)
// @team yl10/忆零
package sf
import (
// "encoding/xml"
// "github.com/astaxie/beego"
//"strconv"
//"time"
//"github.com/astaxie/beego/httplib"
)
//路由推送
type WaybillRoute struct {
Id string `xml:"id,attr"` //路由编号,每一个 id 代表一条不同的路由
Mailno string `xml:"mailno,attr"` //运单号
Orderid string `xml:"orderid,attr"` //订单号
AcceptTime string `xml:"acceptTime,attr"` //路由产生时间
AcceptAddress string `xml:"acceptAddress,attr"` //路由发生城市
Remark string `xml:"remark,attr"` //路由说明
OpCode string `xml:"opCode,attr"` //操作码
}
type WaybillRouteRequest struct {
Service string `xml:"service,attr"`
Lang string `xml:"lang,attr"`
Routes []WaybillRoute `xml:"Body>WaybillRoute"`
}
//返回值
type WaybillRouteResponse struct {
Id string `xml:"id,attr"` //成功接收的路由编号,如果有多个路由编 号 , 以 逗 号 分 隔
IdError string `xml:"id_error,attr"` //未成功接收的路由编号,如果有多个路由 编 号 , 以 逗 号 分 隔
}
func CallRoutePush(WaybillRoute *WaybillRoute) interface{} {
req := NewRequest("RoutePushService", &WaybillRoute)
str, err := req.send()
if err != nil {
return ""
}
return str
}
func RouteError(msg string) []byte {
str := `<Response service=”RoutePushService”>
<Head>ERR</Head>
<ERROR code="NNNN">` + msg + "</ERROR></Response>"
return []byte(str)
}