diff --git a/pdd_union/extend_url.go b/pdd_union/extend_url.go index 655e0cc..028f4fa 100644 --- a/pdd_union/extend_url.go +++ b/pdd_union/extend_url.go @@ -168,6 +168,46 @@ func RpUrl(keyArr map[string]string, param map[string]interface{}) map[string]st } return tmp } +func OwnRpUrl(keyArr map[string]string, param map[string]interface{}) map[string]string { + send, _ := Send(keyArr, "pdd.ddk.rp.prom.url.generate", param) + var res cps_pdd.RpUrl + json.Unmarshal([]byte(send), &res) + tmp := map[string]string{ + "url": "", + "open_app_url": "", + "no_open_app_url": "", + "page_path": "", + "schema_url": "", + "user_name": "", + "app_id": "", + } + if param["open_app"] == "" || param["open_app"] == nil { + param["open_app"] = "" + } + if param["link_type"] == "" || param["link_type"] == nil { + param["link_type"] = "" + } + for _, v := range res.RpPromotionUrlGenerateResponse.UrlList { + tmp["url"] = v.ShortUrl + tmp["open_app_url"] = v.MobileUrl + tmp["no_open_app_url"] = v.ShortUrl + tmp["short_open_url"] = v.MobileShortUrl + tmp["page_path"] = v.WeAppInfo.PagePath + tmp["user_name"] = v.WeAppInfo.UserName + tmp["app_id"] = v.WeAppInfo.AppId + tmp["schema_url"] = v.SchemaUrl + if param["open_app"] == "" && param["link_type"] != "" { + tmp["url"] = v.Url + } + if param["open_app"] != "" { + tmp["url"] = v.MobileShortUrl + } + if param["open_app"] != "" && param["link_type"] != "" { + tmp["url"] = v.MobileUrl + } + } + return tmp +} // https://open.pinduoduo.com/application/document/api?id=pdd.ddk.oauth.cms.prom.url.generate func PromUrl(keyArr map[string]string, param map[string]interface{}) map[string]string {