|
@@ -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)
|