|
@@ -111,7 +111,7 @@ func (this *WechatCommonController) PcWechatLogin() {
|
|
|
utils.FileLog.Info("用户已经存在,用户id:%d", userId)
|
|
|
}
|
|
|
} else {
|
|
|
- if openId!="" {
|
|
|
+ if openId != "" {
|
|
|
wxUser, err := models.GetWxUserItemByOpenId(openId)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取用户信息失败"
|
|
@@ -133,17 +133,17 @@ func (this *WechatCommonController) PcWechatLogin() {
|
|
|
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
|
|
|
}
|
|
|
}
|
|
@@ -155,6 +155,11 @@ func (this *WechatCommonController) PcWechatLogin() {
|
|
|
br.ErrMsg = "登录失败,判断权限失败:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+ //更新用户微信信息
|
|
|
+ if wxUserInfo != nil {
|
|
|
+ models.ModifyWxUserInfo(wxUserInfo.Nickname, wxUserInfo.Headimgurl, wxUserInfo.City, wxUserInfo.Province, wxUserInfo.Country, wxUserInfo.Sex, userId)
|
|
|
+ }
|
|
|
newUser, _ := models.GetWxUserItemByUserId(userId)
|
|
|
utils.FileLog.Info("获取用户信息:%d", userId)
|
|
|
|