第三方api接口
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

72 líneas
2.3 KiB

  1. package wph
  2. import (
  3. "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/md/wph"
  4. zhios_third_party_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils"
  5. "encoding/json"
  6. "fmt"
  7. "github.com/tidwall/gjson"
  8. "strings"
  9. )
  10. func GetUrl(serviceParam map[string]string, param string) wph.UrlInfoList {
  11. post, err := SendPost("com.vip.adp.api.open.service.UnionUrlService", "genByGoodsIdWithOauth", serviceParam, param)
  12. fmt.Println(post)
  13. fmt.Println(err)
  14. UrlInfoList := gjson.Get(post, "result.urlInfoList").String()
  15. list := make([]wph.UrlInfoList, 0)
  16. json.Unmarshal([]byte(UrlInfoList), &list)
  17. data := wph.UrlInfoList{}
  18. for _, v := range list {
  19. if strings.Contains(v.Url, "t.vip.com") {
  20. v.Url = strings.ReplaceAll(v.Url, "t.vip.com", "click.union.vip.com")
  21. }
  22. data = wph.UrlInfoList{
  23. Url: v.Url,
  24. DeeplinkUrl: v.DeeplinkUrl,
  25. VipWxUrl: v.VipWxUrl,
  26. }
  27. }
  28. fmt.Println(zhios_third_party_utils.SerializeStr(data))
  29. return data
  30. }
  31. func GetActUrl(serviceParam map[string]string, param string) wph.UrlInfoList {
  32. post, err := SendPost("com.vip.adp.api.open.service.UnionUrlService", "genByVIPUrlWithOauth", serviceParam, param)
  33. fmt.Println(post)
  34. fmt.Println(err)
  35. UrlInfoList := gjson.Get(post, "result.urlInfoList").String()
  36. list := make([]wph.UrlInfoList, 0)
  37. json.Unmarshal([]byte(UrlInfoList), &list)
  38. data := wph.UrlInfoList{}
  39. for _, v := range list {
  40. if strings.Contains(v.Url, "t.vip.com") {
  41. v.Url = strings.ReplaceAll(v.Url, "t.vip.com", "click.union.vip.com")
  42. }
  43. data = wph.UrlInfoList{
  44. Url: v.Url,
  45. DeeplinkUrl: v.DeeplinkUrl,
  46. VipWxUrl: v.VipWxUrl,
  47. }
  48. }
  49. return data
  50. }
  51. func GetParseUrl(serviceParam map[string]string, param string) map[string]interface{} {
  52. post, err := SendPost("com.vip.adp.api.open.service.UnionUrlService", "vipLinkCheckWithOuth", serviceParam, param)
  53. fmt.Println(post)
  54. fmt.Println(err)
  55. successMap := gjson.Get(post, "result.successMap").String()
  56. var list = make(map[string]interface{})
  57. json.Unmarshal([]byte(successMap), &list)
  58. url := gjson.Get(param, "vipLinkCheckReq.content").String()
  59. _, ok := list[url]
  60. data := map[string]interface{}{}
  61. if ok {
  62. urlData, ok1 := list[url].(map[string]interface{})
  63. if ok1 {
  64. data = urlData
  65. }
  66. }
  67. fmt.Println(zhios_third_party_utils.SerializeStr(data))
  68. return data
  69. }