This commit is contained in:
邹宗楠
2025-02-07 16:58:49 +08:00
parent 30d65c6de5
commit 8618e4bb38
3 changed files with 16 additions and 23 deletions

View File

@@ -141,13 +141,8 @@ const (
// HttpToGuoYuanFN 订单消息推送果园
func HttpToGuoYuanFN(param map[string]interface{}, requestType string, serverType string) (*http.Response, error) {
//var paramData []byte
//var err error
//paramData, err = json.Marshal(param)
//if err != nil {
// return nil, err
//}
//body := strings.NewReader(string(paramData))
//cl := http.Client{}
url := ""
if serverType == "prod" {
switch requestType {
@@ -175,15 +170,18 @@ func HttpToGuoYuanFN(param map[string]interface{}, requestType string, serverTyp
return nil, nil
}
httpReq, err := http.NewRequest(http.MethodPost, url, strings.NewReader(utils.Map2URLValues(param).Encode()))
byteParam, _ := json.Marshal(param)
httpReq, err := http.NewRequest(http.MethodPost, url, strings.NewReader(string(byteParam)))
if err != nil {
return nil, err
}
httpReq.Header.Set("Content-Type", "application/json")
httpReq.Header.Set("accept", "application/json, text/plain, */*")
httpReq.Header.Add("content-type", "application/json")
httpRes, err := http.DefaultClient.Do(httpReq)
defer httpRes.Body.Close()
if err != nil {
return nil, err
}
return httpRes, err
}