aa
This commit is contained in:
@@ -6,14 +6,34 @@ const (
|
|||||||
cthMediaID = 9180924964
|
cthMediaID = 9180924964
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type GoodsOPidGenerateResult struct {
|
||||||
|
PIDGenerateResponse struct {
|
||||||
|
PIDList []struct {
|
||||||
|
CreateTime int `json:"create_time"`
|
||||||
|
MediaID int64 `json:"media_id"`
|
||||||
|
PidName string `json:"pid_name"`
|
||||||
|
PID string `json:"p_id"`
|
||||||
|
} `json:"p_id_list"`
|
||||||
|
RemainPidCount int `json:"remain_pid_count"`
|
||||||
|
RequestID string `json:"request_id"`
|
||||||
|
} `json:"p_id_generate_response"`
|
||||||
|
}
|
||||||
|
|
||||||
//创建推广位
|
//创建推广位
|
||||||
func (a *API) GoodsOPidGenerate(name string) (err error) {
|
func (a *API) GoodsOPidGenerate(name string) (pid string, err error) {
|
||||||
_, err = a.AccessAPI("pdd.ddk.goods.pid.generate", false, map[string]interface{}{
|
result, err := a.AccessAPI("pdd.ddk.goods.pid.generate", false, map[string]interface{}{
|
||||||
"number": 1,
|
"number": 1,
|
||||||
"p_id_name_list": []string{"\"" + name + "\""},
|
"p_id_name_list": []string{"\"" + name + "\""},
|
||||||
"media_id": cthMediaID,
|
"media_id": cthMediaID,
|
||||||
})
|
})
|
||||||
return err
|
if err == nil {
|
||||||
|
goodsOPidGenerateResult := &GoodsOPidGenerateResult{}
|
||||||
|
utils.Map2StructByJson(result, &goodsOPidGenerateResult, false)
|
||||||
|
if goodsOPidGenerateResult != nil {
|
||||||
|
pid = goodsOPidGenerateResult.PIDGenerateResponse.PIDList[0].PID
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return pid, err
|
||||||
}
|
}
|
||||||
|
|
||||||
type ActivityOperationListResult struct {
|
type ActivityOperationListResult struct {
|
||||||
|
|||||||
@@ -6,11 +6,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestGoodsOPidGenerate(t *testing.T) {
|
func TestGoodsOPidGenerate(t *testing.T) {
|
||||||
err := api.GoodsOPidGenerate("冲天猴儿")
|
result, err := api.GoodsOPidGenerate("冲天猴儿5")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
//t.Log(utils.Format4Output(result, false))
|
t.Log(utils.Format4Output(result, false))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestActivityOperationList(t *testing.T) {
|
func TestActivityOperationList(t *testing.T) {
|
||||||
|
|||||||
Reference in New Issue
Block a user