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

getGzmiRealData.go 1.1 KiB

11 months ago
1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package gzmiyuan
  2. import (
  3. zhios_third_party_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils"
  4. "encoding/json"
  5. "fmt"
  6. "time"
  7. )
  8. func GetGzmiRealData(pageSize, pageId, openType string) ([]GzmiRealNewsResponse, error) {
  9. url := "https://api.gzmiyuan.com/api/business/sharerange/xianbao/findShareXianBaoByOpenType"
  10. params := map[string]string{
  11. "page": pageId,
  12. "rows": pageSize,
  13. "openType": openType,
  14. "version": fmt.Sprintf("%d", time.Now().UnixNano()/1e6),
  15. }
  16. fmt.Println(zhios_third_party_utils.Serialize(params))
  17. resp, err := SendReq(url, params)
  18. zhios_third_party_utils.FilePutContents("miyuan", string(resp))
  19. if err != nil {
  20. zhios_third_party_utils.FilePutContents("miyuan", err.Error())
  21. return nil, err
  22. }
  23. var responseData struct {
  24. Msg string `json:"msg"`
  25. Data []GzmiRealNewsResponse `json:"data"`
  26. Code string `json:"code"`
  27. }
  28. err = json.Unmarshal(resp, &responseData)
  29. if err != nil {
  30. zhios_third_party_utils.FilePutContents("miyuan", err.Error())
  31. return nil, err
  32. }
  33. return responseData.Data, nil
  34. }