/
pdd.ddk.oauth.goods.pid.query.go
82 lines (77 loc) · 3.67 KB
/
pdd.ddk.oauth.goods.pid.query.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
package pinduoduo
import (
"context"
"go.dtapp.net/gojson"
"go.dtapp.net/gorequest"
)
type PddDdkOauthGoodsPidQueryResponse struct {
OrderDetailResponse struct {
SepMarketFee int `json:"sep_market_fee"`
GoodsPrice int `json:"goods_price"`
SepDuoId int `json:"sep_duo_id"`
Pid string `json:"pid"`
PromotionRate int `json:"promotion_rate"`
CpsSign string `json:"cps_sign"`
Type int `json:"type"`
SubsidyDuoAmountLevel int `json:"subsidy_duo_amount_level"`
OrderStatus int `json:"order_status"`
CatIds []int `json:"cat_ids"`
OrderCreateTime int64 `json:"order_create_time"`
IsDirect int `json:"is_direct"`
OrderGroupSuccessTime int `json:"order_group_success_time"`
MallId int `json:"mall_id"`
OrderAmount int64 `json:"order_amount"`
PriceCompareStatus int `json:"price_compare_status"`
MallName string `json:"mall_name"`
OrderModifyAt int `json:"order_modify_at"`
AuthDuoId int `json:"auth_duo_id"`
CpaNew int `json:"cpa_new"`
GoodsName string `json:"goods_name"`
BatchNo string `json:"batch_no"`
RedPacketType int `json:"red_packet_type"`
UrlLastGenerateTime int `json:"url_last_generate_time"`
GoodsQuantity int `json:"goods_quantity"`
GoodsId int64 `json:"goods_id"`
SepParameters string `json:"sep_parameters"`
SepRate int `json:"sep_rate"`
SubsidyType int `json:"subsidy_type"`
ShareRate int `json:"share_rate"`
CustomParameters string `json:"custom_parameters"`
GoodsThumbnailUrl string `json:"goods_thumbnail_url"`
PromotionAmount int64 `json:"promotion_amount"`
OrderPayTime int `json:"order_pay_time"`
GroupId int64 `json:"group_id"`
SepPid string `json:"sep_pid"`
ReturnStatus int `json:"return_status"`
OrderStatusDesc string `json:"order_status_desc"`
ShareAmount int `json:"share_amount"`
GoodsCategoryName string `json:"goods_category_name"`
RequestId string `json:"request_id"`
GoodsSign string `json:"goods_sign"`
OrderSn string `json:"order_sn"`
ZsDuoId int `json:"zs_duo_id"`
} `json:"order_detail_response"`
}
type PddDdkOauthGoodsPidQueryResult struct {
Result PddDdkOauthGoodsPidQueryResponse // 结果
Body []byte // 内容
Http gorequest.Response // 请求
}
func newPddDdkOauthGoodsPidQueryResult(result PddDdkOauthGoodsPidQueryResponse, body []byte, http gorequest.Response) *PddDdkOauthGoodsPidQueryResult {
return &PddDdkOauthGoodsPidQueryResult{Result: result, Body: body, Http: http}
}
// PidQuery 多多客已生成推广位信息查询
// https://jinbao.pinduoduo.com/third-party/api-detail?apiName=pdd.ddk.oauth.goods.pid.query
func (c *PddDdkOauthGoodsApi) PidQuery(ctx context.Context, notMustParams ...gorequest.Params) (*PddDdkOauthGoodsPidQueryResult, error) {
// 参数
params := NewParamsWithType("pdd.ddk.oauth.goods.pid.query", notMustParams...)
// 请求
request, err := c.client.request(ctx, params)
if err != nil {
return newPddDdkOauthGoodsPidQueryResult(PddDdkOauthGoodsPidQueryResponse{}, request.ResponseBody, request), err
}
// 定义
var response PddDdkOauthGoodsPidQueryResponse
err = gojson.Unmarshal(request.ResponseBody, &response)
return newPddDdkOauthGoodsPidQueryResult(response, request.ResponseBody, request), err
}