|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- package wph
-
- import (
- "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/md/wph"
- zhios_third_party_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils"
- "encoding/json"
- "fmt"
- "github.com/tidwall/gjson"
- "strings"
- )
-
- func GetUrl(serviceParam map[string]string, param string) wph.UrlInfoList {
- post, err := SendPost("com.vip.adp.api.open.service.UnionUrlService", "genByGoodsIdWithOauth", serviceParam, param)
- fmt.Println(post)
- fmt.Println(err)
- UrlInfoList := gjson.Get(post, "result.urlInfoList").String()
- list := make([]wph.UrlInfoList, 0)
- json.Unmarshal([]byte(UrlInfoList), &list)
- data := wph.UrlInfoList{}
- for _, v := range list {
- if strings.Contains(v.Url, "t.vip.com") {
- v.Url = strings.ReplaceAll(v.Url, "t.vip.com", "click.union.vip.com")
- }
- data = wph.UrlInfoList{
- Url: v.Url,
- DeeplinkUrl: v.DeeplinkUrl,
- VipWxUrl: v.VipWxUrl,
- }
- }
- fmt.Println(zhios_third_party_utils.SerializeStr(data))
- return data
- }
- func GetActUrl(serviceParam map[string]string, param string) wph.UrlInfoList {
- post, err := SendPost("com.vip.adp.api.open.service.UnionUrlService", "genByVIPUrlWithOauth", serviceParam, param)
- fmt.Println(post)
- fmt.Println(err)
- UrlInfoList := gjson.Get(post, "result.urlInfoList").String()
- list := make([]wph.UrlInfoList, 0)
- json.Unmarshal([]byte(UrlInfoList), &list)
- data := wph.UrlInfoList{}
- for _, v := range list {
- if strings.Contains(v.Url, "t.vip.com") {
- v.Url = strings.ReplaceAll(v.Url, "t.vip.com", "click.union.vip.com")
- }
- data = wph.UrlInfoList{
- Url: v.Url,
- DeeplinkUrl: v.DeeplinkUrl,
- VipWxUrl: v.VipWxUrl,
- }
- }
- return data
- }
- func GetParseUrl(serviceParam map[string]string, param string) map[string]interface{} {
- post, err := SendPost("com.vip.adp.api.open.service.UnionUrlService", "vipLinkCheckWithOuth", serviceParam, param)
- fmt.Println(post)
- fmt.Println(err)
- successMap := gjson.Get(post, "result.successMap").String()
- var list = make(map[string]interface{})
- json.Unmarshal([]byte(successMap), &list)
- url := gjson.Get(param, "vipLinkCheckReq.content").String()
- _, ok := list[url]
- data := map[string]interface{}{}
- if ok {
- urlData, ok1 := list[url].(map[string]interface{})
- if ok1 {
- data = urlData
- }
- }
- fmt.Println(zhios_third_party_utils.SerializeStr(data))
- return data
- }
|