第三方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 1.0 KiB

8 months ago
8 months ago
8 months ago
12345678910111213141516171819202122232425262728293031
  1. package story
  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, appId string, param map[string]string) (string, error) {
  10. url := "https://androidapi4.yc.ifeng.com/" + method
  11. header := map[string]string{
  12. "appId": appId,
  13. }
  14. get, err := zhios_third_party_utils.CurlPost(url, param, header)
  15. fmt.Println(string(get))
  16. fmt.Println(err)
  17. return string(get), err
  18. }
  19. func SendPostSecond(method string, appId string, param map[string]string) (string, error) {
  20. url := "https://openapis.yanxiangbook.com/" + method
  21. param["app_key"] = appId
  22. paramJson := comm.GetSortJson(param)
  23. paramJson = strings.ReplaceAll(paramJson, "\n", "")
  24. param["sign"] = php2go.Md5(paramJson + "&salt=" + appId)
  25. get, err := zhios_third_party_utils.CurlPost(url, zhios_third_party_utils.SerializeStr(param), nil)
  26. fmt.Println(string(get))
  27. fmt.Println(err)
  28. return string(get), err
  29. }