Skip to content

Commit

Permalink
sns-api updated
Browse files Browse the repository at this point in the history
  • Loading branch information
rosbit committed May 6, 2020
1 parent 253219f commit 39d714a
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions router.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,24 +234,22 @@ func snsAPI(w http.ResponseWriter, r *http.Request) {
writeError(w, http.StatusInternalServerError, err.Error())
return
}

var userInfo map[string]interface{}
if scope == "base" {
writeJson(w, http.StatusOK, map[string]interface{}{
"code": http.StatusOK,
"msg": "OK",
"openId": openId,
})
return
userInfo, err = wxUser.GetInfoByAccessToken()
} else {
if err = wxUser.GetInfo(); err == nil {
userInfo = wxUser.UserInfo
}
}

userInfo, err := wxUser.GetInfoByAccessToken()
if err != nil {
writeError(w, http.StatusInternalServerError, err.Error())
return
}
writeJson(w, http.StatusOK, map[string]interface{}{
"code": http.StatusOK,
"msg": "OK",
"openId": openId,
"userInfo": userInfo,
"error": err.Error(),
})
}

Expand Down

0 comments on commit 39d714a

Please sign in to comment.