|
@@ -94,11 +94,11 @@ func (this *WechatCommonController) WechatLogin() {
|
|
|
user.Headimgurl = wxUserInfo.Headimgurl
|
|
|
user.FirstLogin = 1
|
|
|
user.Enabled = 1
|
|
|
- user.RegisterPlatform=1
|
|
|
+ user.RegisterPlatform = 1
|
|
|
user.RegisterTime = time.Now()
|
|
|
_, err = models.AddWxUser(user)
|
|
|
wxUser, err = models.GetWxUserItemByUnionid(unionid)
|
|
|
- if err != nil{
|
|
|
+ if err != nil {
|
|
|
br.Msg = "获取用户信息失败"
|
|
|
br.ErrMsg = "unionid登录,获取微信用户信息失败,Err:" + err.Error()
|
|
|
return
|
|
@@ -109,9 +109,9 @@ func (this *WechatCommonController) WechatLogin() {
|
|
|
userId = wxUser.UserId
|
|
|
}
|
|
|
} else {
|
|
|
- if openId!="" {
|
|
|
+ if openId != "" {
|
|
|
wxUser, err := models.GetWxUserItemByOpenId(openId)
|
|
|
- if err != nil {
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
br.Msg = "获取用户信息失败"
|
|
|
br.ErrMsg = "获取微信用户信息失败,Err:" + err.Error()
|
|
|
return
|
|
@@ -131,18 +131,18 @@ func (this *WechatCommonController) WechatLogin() {
|
|
|
user.Headimgurl = wxUserInfo.Headimgurl
|
|
|
user.FirstLogin = 1
|
|
|
user.Enabled = 1
|
|
|
- user.RegisterPlatform=1
|
|
|
+ user.RegisterPlatform = 1
|
|
|
user.RegisterTime = time.Now()
|
|
|
_, err = models.AddWxUser(user)
|
|
|
|
|
|
wxUser, err = models.GetWxUserItemByOpenId(openId)
|
|
|
- if err != nil{
|
|
|
+ if err != nil {
|
|
|
br.Msg = "获取用户信息失败"
|
|
|
br.ErrMsg = "unionid登录,获取微信用户信息失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
userId = wxUser.UserId
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
userId = wxUser.UserId
|
|
|
}
|
|
|
}
|
|
@@ -240,4 +240,4 @@ func (this *WechatController) GetWxSign() {
|
|
|
br.Success = true
|
|
|
br.Msg = "获取签名成功"
|
|
|
br.Data = resp
|
|
|
-}
|
|
|
+}
|