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

10 kuukautta sitten
12345678910111213141516171819202122232425262728293031323334353637383940
  1. package cinema_5bms
  2. import (
  3. "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/comm"
  4. zhios_third_party_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils"
  5. "fmt"
  6. "github.com/syyongx/php2go"
  7. "strings"
  8. "time"
  9. )
  10. func SendPost(method string, signSecret string, param map[string]string) (string, error) {
  11. url := "https://www.5bms.com/" + method
  12. param["time"] = zhios_third_party_utils.Int64ToStr(time.Now().Unix())
  13. param["sign"] = GetSign(param, signSecret)
  14. for k, v := range param {
  15. if strings.Contains(url, "?") {
  16. url += "&" + k + "=" + php2go.URLEncode(v)
  17. } else {
  18. url += "?" + k + "=" + php2go.URLEncode(v)
  19. }
  20. }
  21. get, err := zhios_third_party_utils.CurlPost(url, param, nil)
  22. fmt.Println(string(get))
  23. fmt.Println(err)
  24. return string(get), err
  25. }
  26. func GetSign(param map[string]string, signSecret string) string {
  27. str := ""
  28. keys := comm.KsortToStr(param)
  29. for _, k := range keys {
  30. if str != "" {
  31. str += "&" + k + "=" + param[k]
  32. } else {
  33. str += k + "=" + param[k]
  34. }
  35. }
  36. str += "&app-secret=" + signSecret
  37. return strings.ToUpper(php2go.Md5(str))
  38. }