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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
package yonghui
import (
"context"
"github.com/gogf/gf/encoding/gjson"
)
var Order = new(order)
type order struct {
}
type OrderCreateGoodsInfo struct {
GoodsCode string `json:"goodsCode"`
GoodsPrice string `json:"goodsPrice"`
GoodsQty int `json:"goodsQty"`
}
type OrderCreateReq struct {
DeliveryType int `json:"deliveryType"`
ThirdOrderCode string `json:"thirdOrderCode"`
CreateMode int `json:"createMode"`
ReceiveDate string `json:"receiveDate"`
OrderAmount string `json:"orderAmount"`
GoodsAmount string `json:"goodsAmount"`
FreightAmount string `json:"freightAmount"`
OrderRemark string `json:"orderRemark"`
UseCreditPay int `json:"useCreditPay"`
UserTelephone string `json:"userTelephone"`
GoodsInfos []*OrderCreateGoodsInfo `json:"goodsInfos"`
ReceiverInfo struct {
Name string `json:"name"`
Prov string `json:"prov"`
City string `json:"city"`
Area string `json:"area"`
Address string `json:"address"`
Telephone string `json:"telephone"`
} `json:"receiverInfo"`
}
type OrderCreateRes struct {
Success bool `json:"success"`
Code string `json:"code"`
Message string `json:"message"`
Data interface{} `json:"data"`
}
/**
创建订单
*/
func (s *order) Create(ctx context.Context, req *OrderCreateReq) (res *OrderCreateRes, err error) {
result, err := post(ctx, "com.csx.order-save.do", req)
if nil != err {
return
}
err = gjson.New(result).Scan(&res)
return
}
type OrderConfirmReq struct {
OrderCode string `json:"orderCode"`
ThirdOrderCode string `json:"thirdOrderCode"`
UseCreditPay string `json:"useCreditPay"`
}
type OrderConfirmRes struct {
Success bool `json:"success"`
Code string `json:"code"`
Message string `json:"message"`
Data string `json:"data"`
}
/**
确认订单
*/
func (s *order) Confirm(ctx context.Context, req *OrderConfirmReq) (res *OrderConfirmRes, err error) {
result, err := post(ctx, "com.csx.order-confirm.do", req)
if nil != err {
return
}
err = gjson.New(result).Scan(&res)
return
}
type OrderDetailReq struct {
OrderCode string `json:"orderCode"`
ThirdOrderCode string `json:"thirdOrderCode"`
}
type OrderDetailRes struct {
Success bool `json:"success"`
Code string `json:"code"`
Message string `json:"message"`
Data struct {
CreateTime string `json:"createTime"`
Freight int `json:"freight"`
GoodsDetails []struct {
ClassCode string `json:"classCode"`
ClassName string `json:"className"`
GoodsCode string `json:"goodsCode"`
GoodsQty int `json:"goodsQty"`
GoodsImage string `json:"goodsImage"`
GoodsName string `json:"goodsName"`
GoodsPrice int `json:"goodsPrice"`
GoodsSpec string `json:"goodsSpec"`
GoodsUnit string `json:"goodsUnit"`
NetPrice float64 `json:"netPrice"`
TaxPrice int `json:"taxPrice"`
TaxRate int `json:"taxRate"`
TotalPrice int `json:"totalPrice"`
} `json:"goodsDetails"`
CsxOrderCode string `json:"csxOrderCode"`
OrderPrice int `json:"orderPrice"`
OrderStatus string `json:"orderStatus"`
OrderType int `json:"orderType"`
PayDetails []struct {
PayAmount int `json:"payAmount"`
PayCode string `json:"payCode"`
PayType string `json:"payType"`
} `json:"payDetails"`
PayTime string `json:"payTime"`
PushType string `json:"pushType"`
ReceiverAddress string `json:"receiverAddress"`
ReceiverName string `json:"receiverName"`
ReceiverPhone string `json:"receiverPhone"`
ShipTime string `json:"shipTime"`
UserName string `json:"userName"`
UserTelephone string `json:"userTelephone"`
SubOrderDetails []struct {
CsxSubOrderCode string `json:"csxSubOrderCode"`
OrderStatus string `json:"orderStatus"`
GoodsDetails []struct {
ClassCode string `json:"classCode"`
ClassName string `json:"className"`
GoodsCode string `json:"goodsCode"`
GoodsQty int `json:"goodsQty"`
GoodsImage string `json:"goodsImage"`
GoodsName string `json:"goodsName"`
GoodsPrice float64 `json:"goodsPrice"`
GoodsSpec string `json:"goodsSpec"`
GoodsUnit string `json:"goodsUnit"`
NetPrice float64 `json:"netPrice"`
TaxPrice float64 `json:"taxPrice"`
TaxRate int `json:"taxRate"`
TotalPrice float64 `json:"totalPrice"`
} `json:"goodsDetails"`
} `json:"subOrderDetails"`
} `json:"data"`
}
/**
订单详情
*/
func (s *order) Detail(ctx context.Context, req *OrderDetailReq) (res *OrderDetailRes, err error) {
result, err := post(ctx, "com.csx.order-detail.do", req)
if nil != err {
return
}
err = gjson.New(result).Scan(&res)
return
}
type OrderQueryReq struct {
ThirdOrderCode string `json:"thirdOrderCode"`
}
type OrderQueryRes struct {
Success bool `json:"success"`
Code string `json:"code"`
Message string `json:"message"`
Data int64 `json:"data"`
}
/**
反查订单
*/
func (s *order) Query(ctx context.Context, req *OrderQueryReq) (res *OrderQueryRes, err error) {
result, err := post(ctx, "com.csx.order-query.do", req)
if nil != err {
return
}
err = gjson.New(result).Scan(&res)
return
}
type OrderReceiveReq struct {
CsxOrderCode string `json:"csxOrderCode"`
ThirdOrderCode string `json:"thirdOrderCode"`
}
type OrderReceiveRes struct {
Success bool `json:"success"`
Code string `json:"code"`
Message string `json:"message"`
Data interface{} `json:"data"`
}
/**
签收订单
*/
func (s *order) Receive(ctx context.Context, req *OrderReceiveReq) (res *OrderReceiveRes, err error) {
result, err := post(ctx, "com.csx.order-sign.do", req)
if nil != err {
return
}
err = gjson.New(result).Scan(&res)
return
}
type OrderCancelReq struct {
ThirdOrderCode string `json:"thirdOrderCode "`
CsxOrderCode string `json:"csxOrderCode"`
CsxSubOrderCode string `json:"csxSubOrderCode "`
}
type OrderCancelRes struct {
Success bool `json:"success"`
Code string `json:"code"`
Message string `json:"message"`
Data struct {
ThirdOrderCode string `json:"thirdOrderCode"`
OrderCode string `json:"orderCode"`
SubOrderCode string `json:"subOrderCode"`
GoodsInfo []struct {
GoodsCode string `json:"goodsCode"`
GoodsQty int `json:"goodsQty"`
} `json:"goodsInfo"`
} `json:"data"`
}
/**
取消订单
*/
func (s *order) Cancel(ctx context.Context, req *OrderCancelReq) (res *OrderCancelRes, err error) {
result, err := post(ctx, "com.csx.order-cancel.do", req)
if nil != err {
return
}
err = gjson.New(result).Scan(&res)
return
}
type OrderLogisticsReq struct {
ThirdOrderCode string `json:"thirdOrderCode"`
CsxOrderCode string `json:"csxOrderCode"`
LogisticCode string `json:"logisticCode"`
}
type OrderLogisticsRes struct {
Success bool `json:"success"`
Code string `json:"code"`
Message string `json:"message"`
Data []struct {
ThirdOrderCode string `json:"thirdOrderCode"`
CsxOrderCode string `json:"csxOrderCode"`
LogisticCode string `json:"logisticCode"`
ItemList []struct {
LogisticsCompany string `json:"logisticsCompany"`
LogisticsCode string `json:"logisticsCode"`
State string `json:"state"`
StateEx string `json:"stateEx"`
Location string `json:"location"`
Traces []struct {
AcceptTime string `json:"acceptTime"`
AcceptStation string `json:"acceptStation"`
Location string `json:"location"`
Action string `json:"action"`
Remark string `json:"remark,omitempty"`
} `json:"traces"`
GoodsInfos []struct {
GoodsCode string `json:"goodsCode"`
GoodsName string `json:"goodsName"`
OutCount string `json:"outCount"`
} `json:"goodsInfos"`
} `json:"itemList"`
} `json:"data"`
}
/**
查询物流
*/
func (s *order) Logistics(ctx context.Context, req *OrderLogisticsReq) (res *OrderLogisticsRes, err error) {
result, err := post(ctx, "com.csx.logistics-query.do", req)
if nil != err {
return
}
err = gjson.New(result).Scan(&res)
return
}
type OrderFreightGoodsInfos struct {
GoodsCode string `json:"goodsCode"`
GoodsQty int `json:"goodsQty"`
}
type OrderFreightReq struct {
DeliveryType int `json:"deliveryType"`
GoodsInfos []*OrderFreightGoodsInfos `json:"goodsInfos"`
ReceiverAddress struct {
Prov string `json:"prov"`
City string `json:"city"`
Area string `json:"area"`
Address string `json:"address"`
} `json:"receiverAddress"`
}
type OrderFreightRes struct {
Success bool `json:"success"`
Code string `json:"code"`
Message string `json:"message"`
Data struct {
Freight string `json:"freight"`
Weight float64 `json:"weight"`
FreightInfoDetail struct {
Field1 []struct {
GoodsFreightType string `json:"goodsFreightType"`
FreightInfo struct {
FreightStandard string `json:"freightStandard"`
FreeShipPrice string `json:"freeShipPrice"`
FreightNeedAddOn bool `json:"freightNeedAddOn"`
FreightAddOnMsg string `json:"freightAddOnMsg"`
GoodsAmount string `json:"goodsAmount"`
AddOnAmount string `json:"addOnAmount"`
FreightAmount string `json:"freightAmount"`
} `json:"freightInfo"`
GoodsInfo []struct {
GoodsCode string `json:"goodsCode"`
GoodsWight string `json:"goodsWight"`
} `json:"goodsInfo"`
} `json:"0"`
} `json:"freightInfoDetail"`
} `json:"data"`
}
/**
订单运费
*/
func (s *order) Freight(ctx context.Context, req *OrderFreightReq) (res *OrderFreightRes, err error) {
result, err := post(ctx, "com.csx.order-freight-compute.do", req)
if nil != err {
return
}
err = gjson.New(result).Scan(&res)
return
}