-
Notifications
You must be signed in to change notification settings - Fork 7
/
订单-订单搜索.go
executable file
·65 lines (55 loc) · 1.79 KB
/
订单-订单搜索.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
package apis
import (
"encoding/json"
)
// 订单搜索
// 文档:https://developers.weixin.qq.com/doc/channels/API/order/search.html
type ReqOrderSearch struct {
NextKey string `json:"next_key"`
OnAftersaleOrderExist *int `json:"on_aftersale_order_exist,omitempty"`
PageSize int `json:"page_size"`
SearchCondition ReqOrderSearchSearchCondition `json:"search_condition"`
Status int `json:"status,omitempty"`
}
type ReqOrderSearchSearchCondition struct {
CustomerNotes string `json:"customer_notes,omitempty"`
MerchantNotes string `json:"merchant_notes,omitempty"`
OrderID string `json:"order_id,omitempty"`
SkuCode string `json:"sku_code,omitempty"`
TelNumber string `json:"tel_number,omitempty"`
Title string `json:"title,omitempty"`
UserName string `json:"user_name,omitempty"`
}
var _ bodyer = ReqOrderSearch{}
func (x ReqOrderSearch) intoBody() ([]byte, error) {
result, err := json.Marshal(x)
if err != nil {
return nil, err
}
return result, nil
}
type RespOrderSearch struct {
CommonResp
HasMore bool `json:"has_more"`
NextKey string `json:"next_key"`
Orders []string `json:"orders"`
}
var _ bodyer = RespOrderSearch{}
func (x RespOrderSearch) intoBody() ([]byte, error) {
result, err := json.Marshal(x)
if err != nil {
return nil, err
}
return result, nil
}
func (c *ApiClient) ExecOrderSearch(req ReqOrderSearch) (RespOrderSearch, error) {
var resp RespOrderSearch
err := c.executeWXApiPost("/channels/ec/order/search", req, &resp, true)
if err != nil {
return RespOrderSearch{}, err
}
if bizErr := resp.TryIntoErr(); bizErr != nil {
return RespOrderSearch{}, bizErr
}
return resp, nil
}