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.
pinduoduo/pdd.ddk.goods.promotion.url...

70 lines
3.8 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package pinduoduo
import (
"context"
"encoding/json"
"go.dtapp.net/gorequest"
)
type GoodsPromotionUrlGenerateResponse struct {
GoodsPromotionUrlGenerateResponse struct {
GoodsPromotionUrlList []struct {
MobileShortUrl string `json:"mobile_short_url,omitempty"` // 对应出参mobile_url的短链接与mobile_url功能一致。
MobileUrl string `json:"mobile_url,omitempty"` // 使用此推广链接用户安装微信的情况下默认拉起拼多多福利券微信小程序否则唤起H5页面
QqAppInfo struct {
AppId string `json:"app_id,omitempty"` // 拼多多小程序id
BannerUrl string `json:"banner_url,omitempty"` // Banner图
Desc string `json:"desc,omitempty"` // 描述
PagePath string `json:"page_path,omitempty"` // 小程序path值
QqAppIconUrl string `json:"qq_app_icon_url,omitempty"` // 小程序icon
SourceDisplayName string `json:"source_display_name,omitempty"` // 来源名
Title string `json:"title,omitempty"` // 小程序标题
UserName string `json:"user_name,omitempty"` // 用户名
} `json:"qq_app_info"`
SchemaUrl string `json:"schema_url,omitempty"` // 使用此推广链接用户安装拼多多APP的情况下会唤起APP需客户端支持schema跳转协议
ShortUrl string `json:"short_url,omitempty"` // 对应出参url的短链接与url功能一致
Url string `json:"url,omitempty"` // 普通推广长链接唤起H5页面
WeAppInfo struct {
AppId string `json:"app_id,omitempty"` // 小程序id
BannerUrl string `json:"banner_url,omitempty"` // Banner图
Desc string `json:"desc,omitempty"` // 描述
PagePath string `json:"page_path,omitempty"` // 小程序path值
SourceDisplayName string `json:"source_display_name,omitempty"` // 来源名
Title string `json:"title,omitempty"` // 小程序标题
UserName string `json:"user_name,omitempty"` // 用户名
WeAppIconUrl string `json:"we_app_icon_url,omitempty"` // 小程序图片
} `json:"we_app_info"`
WeixinCode string `json:"weixin_code"`
WeAppWebViewUrl string `json:"we_app_web_view_url"`
WeAppWebViewShortUrl string `json:"we_app_web_view_short_url"`
TzSchemaUrl string `json:"tz_schema_url"`
WeixinShortLink string `json:"weixin_short_link"`
} `json:"goods_promotion_url_list"`
} `json:"goods_promotion_url_generate_response"`
}
type GoodsPromotionUrlGenerateResult struct {
Result GoodsPromotionUrlGenerateResponse // 结果
Body []byte // 内容
Http gorequest.Response // 请求
Err error // 错误
}
func newGoodsPromotionUrlGenerateResult(result GoodsPromotionUrlGenerateResponse, body []byte, http gorequest.Response, err error) *GoodsPromotionUrlGenerateResult {
return &GoodsPromotionUrlGenerateResult{Result: result, Body: body, Http: http, Err: err}
}
// GoodsPromotionUrlGenerate 多多进宝推广链接生成
// https://jinbao.pinduoduo.com/third-party/api-detail?apiName=pdd.ddk.goods.promotion.url.generate
func (c *Client) GoodsPromotionUrlGenerate(ctx context.Context, notMustParams ...Params) *GoodsPromotionUrlGenerateResult {
// 参数
params := NewParamsWithType("pdd.ddk.goods.promotion.url.generate", notMustParams...)
params.Set("p_id", c.GetPid())
// 请求
request, err := c.request(ctx, params)
// 定义
var response GoodsPromotionUrlGenerateResponse
err = json.Unmarshal(request.ResponseBody, &response)
return newGoodsPromotionUrlGenerateResult(response, request.ResponseBody, request, err)
}