使用可以直接:
go get github.com/wosyuyuda/gosf
client :=sf.F新建链接("QQB********pcUCKV", "HdOrk7Wu9uQiX********BBYV40emI7dN", "7551234567", V沙箱环境)
order := sf.SFOrder{
IsReturnRoutelabel: 1,
CargoDetails: []sf.CargoDetail{
{Name: "苹果手机"},
},
ContactInfoList: []sf.ContactInfo{
{ContactType: sf.V寄件人, Address: "十堰市丹江口市公园路155号", City: "十堰市", Contact: "张三丰",
County: "武当山风景区", Mobile: "17888888888", Province: "湖北省"},
{ContactType: sf.V收件人, Address: "湖北省襄阳市襄城区环城东路122号", City: "襄阳市", Contact: "郭襄阳",
County: "襄城区", Mobile: "18963828829", Province: "湖北省"},
},
}
//json.Unmarshal([]byte(body), &order)
res, err := client.F下单(&order)
if err != nil {
fmt.Println("err:", err.Error())
return
}
fmt.Println("res:", res)
其它方法请直接使用
client.F发送请求(服务code,请求数据)
请求数据建议为str或者map结构,服务code请自行查看
可以把整个client初始化抽出来,直接调用会更方便一些