第三方api接口
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.

api.go 848 B

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1234567891011121314151617181920212223242526272829303132333435
  1. package zero_buy
  2. import (
  3. "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/comm"
  4. "github.com/syyongx/php2go"
  5. "strings"
  6. )
  7. func ZeroBuyUrl(appSecret string, param map[string]string) string {
  8. url := " http://h5.hlpay178.cn/#/"
  9. param["deviceID"] = strings.ReplaceAll(param["deviceID"], " ", "")
  10. for k, v := range param {
  11. if strings.Contains(url, "?") == false {
  12. url += "?" + k + "=" + php2go.URLEncode(v)
  13. } else {
  14. url += "&" + k + "=" + php2go.URLEncode(v)
  15. }
  16. }
  17. sign := GetSign(appSecret, param)
  18. url += "&sign=" + sign
  19. return url
  20. }
  21. func GetSign(appSecret string, param map[string]string) string {
  22. keys := comm.KsortToStr(param)
  23. str := ""
  24. for _, k := range keys {
  25. if str == "" {
  26. str += k + "=" + param[k]
  27. } else {
  28. str += "|" + k + "=" + param[k]
  29. }
  30. }
  31. str += "|" + appSecret
  32. return php2go.Md5(str)
  33. }