|
@@ -86,8 +86,8 @@ func (this *WechatCommonController) WechatLoginByGzh() {
|
|
|
br.ErrMsg = "获取unionid失败,unionid:" + wxUserInfo.Unionid
|
|
|
return
|
|
|
}
|
|
|
- total, err := models.GetCygxUserRecordCount(openId)
|
|
|
- if err != nil {
|
|
|
+ mfyxUserRecord, err := models.GetCygxUserRecordByOpenid(openId)
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
br.Msg = "获取用户信息失败"
|
|
|
br.ErrMsg = "查询数量失败,Err:" + err.Error()
|
|
|
return
|
|
@@ -113,8 +113,16 @@ func (this *WechatCommonController) WechatLoginByGzh() {
|
|
|
if user != nil {
|
|
|
items.CygxUserId = user.UserId
|
|
|
items.CygxBindAccount = user.Mobile
|
|
|
+ if mfyxUserRecord != nil && mfyxUserRecord.CygxUserId != user.UserId {
|
|
|
+ err = models.UpdateCygxUserRecordMobile(user.UserId, user.Mobile, unionId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "修复用户信息失败"
|
|
|
+ br.ErrMsg = "修复用户信息失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- if total == 0 {
|
|
|
+ if mfyxUserRecord == nil {
|
|
|
_, err = models.AddMfyxGzhUserRecord(items)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取用户信息失败"
|