You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.5 KiB
43 lines
1.5 KiB
3 years ago
|
package pinduoduo
|
||
|
|
||
2 years ago
|
import (
|
||
|
"encoding/json"
|
||
2 years ago
|
"go.dtapp.net/library/gorequest"
|
||
2 years ago
|
)
|
||
3 years ago
|
|
||
|
type GoodsPidGenerateResponse struct {
|
||
3 years ago
|
PIdGenerateResponse struct {
|
||
|
PIdList []struct {
|
||
|
CreateTime int `json:"create_time,omitempty"` // 推广位创建时间
|
||
|
PidName string `json:"pid_name,omitempty"` // 推广位名称
|
||
|
PId string `json:"p_id,omitempty"` // 调用方推广位ID
|
||
|
MediaId int `json:"media_id,omitempty"` // 媒体id
|
||
|
} `json:"p_id_list"`
|
||
|
RemainPidCount int `json:"remain_pid_count"` // PID剩余数量
|
||
|
} `json:"p_id_generate_response"`
|
||
|
}
|
||
|
|
||
3 years ago
|
type GoodsPidGenerateResult struct {
|
||
|
Result GoodsPidGenerateResponse // 结果
|
||
|
Body []byte // 内容
|
||
2 years ago
|
Http gorequest.Response // 请求
|
||
3 years ago
|
Err error // 错误
|
||
|
}
|
||
|
|
||
2 years ago
|
func NewGoodsPidGenerateResult(result GoodsPidGenerateResponse, body []byte, http gorequest.Response, err error) *GoodsPidGenerateResult {
|
||
|
return &GoodsPidGenerateResult{Result: result, Body: body, Http: http, Err: err}
|
||
3 years ago
|
}
|
||
|
|
||
|
// GoodsPidGenerate 创建多多进宝推广位
|
||
|
// https://jinbao.pinduoduo.com/third-party/api-detail?apiName=pdd.ddk.goods.pid.generate
|
||
|
func (app *App) GoodsPidGenerate(notMustParams ...Params) *GoodsPidGenerateResult {
|
||
3 years ago
|
// 参数
|
||
|
params := NewParamsWithType("pdd.ddk.goods.pid.generate", notMustParams...)
|
||
|
// 请求
|
||
2 years ago
|
request, err := app.request(params)
|
||
3 years ago
|
// 定义
|
||
|
var response GoodsPidGenerateResponse
|
||
2 years ago
|
err = json.Unmarshal(request.ResponseBody, &response)
|
||
|
return NewGoodsPidGenerateResult(response, request.ResponseBody, request, err)
|
||
3 years ago
|
}
|