@@ -0,0 +1,9 @@ | |||||
package gzmiyuan | |||||
import ( | |||||
zhios_third_party_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils" | |||||
) | |||||
func SendReq(urls string, params map[string]string) ([]byte, error) { | |||||
return zhios_third_party_utils.CurlPost(urls, zhios_third_party_utils.Serialize(params), map[string]string{"content-type": "application/json"}) | |||||
} |
@@ -0,0 +1,41 @@ | |||||
package gzmiyuan | |||||
import ( | |||||
zhios_third_party_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils" | |||||
"encoding/json" | |||||
"fmt" | |||||
"time" | |||||
) | |||||
func GetGzmiRealData(pageSize, pageId, openType string) ([]GzmiRealNewsResponse, error) { | |||||
url := "https://api.gzmiyuan.com/api/business/sharerange/xianbao/findShareXianBaoByOpenType" | |||||
params := map[string]string{ | |||||
"page": pageId, | |||||
"rows": pageSize, | |||||
"openType": openType, | |||||
"version": fmt.Sprintf("%d", time.Now().UnixNano()/1e6), | |||||
} | |||||
fmt.Println(zhios_third_party_utils.Serialize(params)) | |||||
resp, err := SendReq(url, params) | |||||
zhios_third_party_utils.FilePutContents("miyuan", string(resp)) | |||||
if err != nil { | |||||
zhios_third_party_utils.FilePutContents("miyuan", err.Error()) | |||||
return nil, err | |||||
} | |||||
var responseData struct { | |||||
Msg string `json:"msg"` | |||||
Data []GzmiRealNewsResponse `json:"data"` | |||||
Code string `json:"code"` | |||||
} | |||||
err = json.Unmarshal(resp, &responseData) | |||||
if err != nil { | |||||
zhios_third_party_utils.FilePutContents("miyuan", err.Error()) | |||||
return nil, err | |||||
} | |||||
return responseData.Data, nil | |||||
} |
@@ -0,0 +1,26 @@ | |||||
package gzmiyuan | |||||
type GzmiRealNewsResponse struct { | |||||
Page int `json:"page"` | |||||
Rows int `json:"rows"` | |||||
Order interface{} `json:"order"` | |||||
Sort interface{} `json:"sort"` | |||||
Id int `json:"id"` | |||||
XianbaoId string `json:"xianbaoId"` | |||||
XianbaoContent string `json:"xianbaoContent"` | |||||
XianbaoImageUrl string `json:"xianbaoImageUrl"` | |||||
OpenType string `json:"openType"` | |||||
OpenName string `json:"openName"` | |||||
ItemIds string `json:"itemIds"` | |||||
Status int `json:"status"` | |||||
SourceFrom string `json:"sourceFrom"` | |||||
SourceXianbaoId interface{} `json:"sourceXianbaoId"` | |||||
ThirdCreateTime string `json:"thirdCreateTime"` | |||||
CreateTime string `json:"createTime"` | |||||
UpdateTime string `json:"updateTime"` | |||||
Version string `json:"version"` | |||||
IsConvert interface{} `json:"isConvert"` | |||||
IsExpireItem interface{} `json:"isExpireItem"` | |||||
IsExpireCoupon interface{} `json:"isExpireCoupon"` | |||||
ExtendJson string `json:"extendJson"` | |||||
} |