-
Notifications
You must be signed in to change notification settings - Fork 21
/
ddk_pid.go
55 lines (46 loc) · 1.33 KB
/
ddk_pid.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
package pdd
import (
"encoding/json"
)
type PidQueryListResponse struct {
PIDList []*PidQuery `json:"p_id_list"`
TotalCount int `json:"total_count"`
}
type PidQuery struct {
PId string `json:"p_id"`
PName string `json:"pid_name"`
CreateTime int64 `json:"create_time"`
}
// 分页查询生成的推广位信息
func (d *DDK) GoodsPidQuery(notMustparams ...Params) (res *PidQueryListResponse, err error) {
params := NewParamsWithType(DDK_GoodsPidQuery, notMustparams...)
r, err := Call(d.Context, params)
if err != nil {
return
}
bytes, err := GetResponseBytes(r, "p_id_query_response")
res = new(PidQueryListResponse)
err = json.Unmarshal(bytes, res)
return
}
type PIdGenerateListResponse struct {
PIDList []*PIdGenerate `json:"p_id_list"`
}
type PIdGenerate struct {
PId string `json:"p_id"`
PIdName string `json:"pid_name"`
CreateTime int64 `json:"create_time"`
}
// 创建推广位
func (d *DDK) GoodsPidGenerate(number int, notMustparams ...Params) (res *PIdGenerateListResponse, err error) {
params := NewParamsWithType(DDK_GoodsPidGenerate, notMustparams...)
params.Set("number", number)
r, err := Call(d.Context, params)
if err != nil {
return
}
bytes, err := GetResponseBytes(r, "p_id_generate_response")
res = new(PIdGenerateListResponse)
err = json.Unmarshal(bytes, res)
return
}