wcj 5 жил өмнө
parent
commit
77c0388b09

+ 1 - 2
src/jfw/jyutil/jyutil.go

@@ -145,13 +145,12 @@ func Getopenid(code string) (openid string) {
 	defer util.Catch()
 	recturl := fmt.Sprintf(config.Wxoauthinfo, code)
 	resp, err := http.Get(recturl)
-	defer resp.Body.Close()
 	if err != nil {
 		log.Println(err.Error())
 		return
 	}
+	defer resp.Body.Close()
 	bs, _ := ioutil.ReadAll(resp.Body)
-	resp.Body.Close()
 	data := map[string]interface{}{}
 	json.Unmarshal(bs, &data)
 	openid, _ = data["openid"].(string)