aa
This commit is contained in:
@@ -205,3 +205,31 @@ func (a *API) ResourceURLGen(pid string, resourceType int) (resourceURLGenResult
|
||||
}
|
||||
return resourceURLGenResult, err
|
||||
}
|
||||
|
||||
//生成商品推广链接
|
||||
func (a *API) GoodsPromotionURLGen(pid string, goodsID string) (resourceURLGenResult *ResourceURLGenResult, err error) {
|
||||
result, err := a.AccessAPI("pdd.ddk.goods.promotion.url.generate", false, map[string]interface{}{
|
||||
"p_id": pid,
|
||||
//"generate_short_url": true,
|
||||
"goods_sign_list": []string{"\"" + goodsID + "\""},
|
||||
})
|
||||
if err == nil {
|
||||
utils.Map2StructByJson(result["resource_url_response"], &resourceURLGenResult, false)
|
||||
}
|
||||
return resourceURLGenResult, err
|
||||
}
|
||||
|
||||
//查询是否绑定备案
|
||||
func (a *API) MemberAuthorityQuery(pid string) (bool bool, err error) {
|
||||
result, err := a.AccessAPI("pdd.ddk.member.authority.query", false, map[string]interface{}{
|
||||
"pid": pid,
|
||||
})
|
||||
if err == nil {
|
||||
if utils.MustInterface2Int64(result["authority_query_response"].(map[string]interface{})["bind"]) == 0 {
|
||||
return false, err
|
||||
} else {
|
||||
return true, err
|
||||
}
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
|
||||
@@ -36,3 +36,19 @@ func TestResourceURLGen(t *testing.T) {
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
func TestGoodsPromotionURLGen(t *testing.T) {
|
||||
result, err := api.GoodsPromotionURLGen("14501219_204919171", "Y9j2gIZ_GQ1KWDjRwfbZd9rMFl_x9NJ4_JQmOjnZyb5")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
func TestMemberAuthorityQuery(t *testing.T) {
|
||||
result, err := api.MemberAuthorityQuery("14501219_204919171")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user