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

29 rivejä
833 B

  1. package recharge
  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. "github.com/syyongx/php2go"
  6. "strings"
  7. )
  8. func send(method string, apiKey string, param map[string]string) (string, error) {
  9. url := "http://8.130.97.197/yrapi.php/" + method
  10. param["sign"] = GetRechargeSign(apiKey, param)
  11. post, err := zhios_third_party_utils.CurlPost(url, param, map[string]string{})
  12. return string(post), err
  13. }
  14. func GetRechargeSign(apiKey string, param map[string]string) string {
  15. str := ""
  16. keys := comm.KsortToStr(param)
  17. for _, k := range keys {
  18. if str != "" {
  19. str += "&" + k + "=" + param[k]
  20. } else {
  21. str += k + "=" + param[k]
  22. }
  23. }
  24. str += "&apikey=" + apiKey
  25. return strings.ToUpper(php2go.Md5(str))
  26. }