diff --git a/pdd_union/extend_url.go b/pdd_union/extend_url.go index 028f4fa..f95bd0b 100644 --- a/pdd_union/extend_url.go +++ b/pdd_union/extend_url.go @@ -126,6 +126,43 @@ func WnMainThemeUrl(keyArr map[string]string, param map[string]interface{}) map[ } return tmp } +func OwnWnMainThemeUrl(keyArr map[string]string, param map[string]interface{}) map[string]string { + send, _ := Send(keyArr, "pdd.ddk.goods.zs.unit.url.gen", param) + var res cps_pdd.WnMainThemeUrl + json.Unmarshal([]byte(send), &res) + tmp := map[string]string{ + "url": "", + "open_app_url": "", + "no_open_app_url": "", + "page_path": "", + "schema_url": "", + } + tmp["url"] = res.GoodsZsUnitGenerateResponse.ShortUrl + tmp["open_app_url"] = res.GoodsZsUnitGenerateResponse.MobileUrl + tmp["short_open_url"] = res.GoodsZsUnitGenerateResponse.MobileShortUrl + tmp["no_open_app_url"] = res.GoodsZsUnitGenerateResponse.ShortUrl + tmp["page_path"] = res.GoodsZsUnitGenerateResponse.WeAppInfo.PagePath + tmp["schema_url"] = res.GoodsZsUnitGenerateResponse.SchemaUrl + if param["open_app"] == "" || param["open_app"] == nil { + param["open_app"] = "" + } + if param["link_type"] == "" || param["link_type"] == nil { + param["link_type"] = "" + } + if param["open_app"] == "" && param["link_type"] != "" { + tmp["url"] = res.GoodsZsUnitGenerateResponse.Url + } + if param["open_app"] != "" { + tmp["url"] = res.GoodsZsUnitGenerateResponse.MobileShortUrl + } + if param["open_app"] != "" && param["link_type"] != "" { + tmp["url"] = res.GoodsZsUnitGenerateResponse.MobileUrl + } + if res.GoodsZsUnitGenerateResponse.WeAppInfo.PagePath == "" { + tmp["page_path"] = res.GoodsZsUnitGenerateResponse.WeAppPagePath + } + return tmp +} // https://open.pinduoduo.com/application/document/api?id=pdd.ddk.oauth.rp.prom.url.generate func RpUrl(keyArr map[string]string, param map[string]interface{}) map[string]string {