Commit a764050e by 朱继来

调整json

parent 3808dcb6
......@@ -11,8 +11,8 @@ import (
)
type JosnResp struct {
err_code string `json:"err_code"`
msg string `json:"msg"`
Errcode int `json:"err_code"`
Errmsg string `json:"msg"`
}
func SendPurchaseEmail(data string) (err error) {
......@@ -20,9 +20,7 @@ func SendPurchaseEmail(data string) (err error) {
client := &http.Client{}
byte, _ := json.Marshal(data)
req, _ := http.NewRequest("POST", crm_url, strings.NewReader(string(byte)))
req, _ := http.NewRequest("POST", crm_url, strings.NewReader(string(data)))
req.Header.Set("api-key", "crm a1b2c3d4e5f6g7h8i9jk")
req.Header.Set("Content-Type", "application/json")
......@@ -36,10 +34,10 @@ func SendPurchaseEmail(data string) (err error) {
}
body, _ := ioutil.ReadAll(resp.Body)
fmt.Println(string(body))
res := &JosnResp{}
err1 := json.Unmarshal(body, res)
res := JosnResp{}
err1 := json.Unmarshal([]byte(body), &res)
if err1 !=nil{
fmt.Println(err1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment