-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathddk_order.go
88 lines (78 loc) · 2.99 KB
/
ddk_order.go
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
package pdd
import (
"encoding/json"
)
type OrderListResponse struct {
OrderList []*Order `json:"order_list"`
TotalCount int `json:"total_count"`
}
type Order struct {
OrderSn string `json:"order_sn"`
GoodsId int `json:"goods_id"`
GoodsName string `json:"goods_name"`
GoodsThumbnailUrl string `json:"goods_thumbnail_url"`
GoodsQuantity int `json:"goods_quantity"`
GoodsPrice int `json:"goods_price"`
OrderAmount int `json:"order_amount"`
OrderCreateTime int `json:"order_create_time"`
OrderSettleTime int `json:"order_settle_time"` // 结算时间
OrderVerifyTime int `json:"order_verify_time"` // 审核时间
OrderReceiveTime int `json:"order_receive_time"` // 收货时间
OrderPayTime int `json:"order_pay_time"`
PromotionRate int `json:"promotion_rate"`
PromotionAmount int `json:"promotion_amount"`
BatchNo string `json:"batch_no"`
OrderID string `json:"order_id"`
OrderStatus int `json:"order_status"`
OrderStatusDesc string `json:"order_status_desc"`
VerifyTime int `json:"verify_time"`
OrderGroupSuccessTime int `json:"order_group_success_time"`
OrderModifyAt int `json:"order_modify_at"`
Type int `json:"type"`
GroupId int `json:"group_id"`
AuthDuoId int `json:"auth_duo_id"`
ZsDuoId int `json:"zs_duo_id"`
CustomParameters string `json:"custom_parameters"`
Pid string `json:"pid"` // common use pid
PId string `json:"p_id"`
MatchChannel int `json:"match_channel"`
DuoCouponAmount int `json:"duo_coupon_amount"`
}
// page_size default 100
// page default 1
func (d *DDK) OrderListIncrementGet(startUpdateTime, endUpdateTime int64, notMustparams ...Params) (res *OrderListResponse, err error) {
res = new(OrderListResponse)
params := NewParamsWithType(DDK_OrderListIncrementGet, notMustparams...)
params.Set("start_update_time", startUpdateTime)
params.Set("end_update_time", endUpdateTime)
r, err := Call(d.Context, params)
if err != nil {
return
}
bytes, err := GetResponseBytes(r, "order_list_get_response")
err = json.Unmarshal(bytes, res)
for _, ord := range res.OrderList {
if ord.Pid == "" {
ord.Pid = ord.PId
}
}
return
}
func (d *DDK) ColorOrderIncrementGet(startUpdateTime, endUpdateTime int64, notMustparams ...Params) (res *OrderListResponse, err error) {
params := NewParamsWithType(DDK_ColorOrderIncrementGet, notMustparams...)
params.Set("start_update_time", startUpdateTime)
params.Set("end_update_time", endUpdateTime)
r, err := Call(d.Context, params)
if err != nil {
return
}
bytes, err := GetResponseBytes(r, "order_list_get_response")
res = new(OrderListResponse)
err = json.Unmarshal(bytes, res)
for _, ord := range res.OrderList {
if ord.Pid == "" {
ord.Pid = ord.PId
}
}
return
}