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

33 lines
865 B

  1. package playlet_kujiang
  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. )
  9. func SendPost(method string, token string, param map[string]string) (string, error) {
  10. url := "https://api.dpxkjw.com/" + method
  11. arr := map[string]string{
  12. "timestamp": param["timestamp"],
  13. "apiKey": param["apiKey"],
  14. }
  15. param["sign"] = GetSign(arr, token)
  16. get, err := zhios_third_party_utils.CurlPost(url, param, nil)
  17. fmt.Println(string(get))
  18. fmt.Println(err)
  19. return string(get), err
  20. }
  21. func GetSign(param map[string]string, signSecret string) string {
  22. str := ""
  23. keys := comm.KsortToStr(param)
  24. for _, k := range keys {
  25. str += param[k]
  26. }
  27. str += signSecret
  28. return strings.ToUpper(php2go.Md5(str))
  29. }