From b673909f9edf3e5ad74c8679b56025099d905397 Mon Sep 17 00:00:00 2001 From: xiaoxiaoqiong Date: Tue, 24 May 2022 10:47:17 +0800 Subject: [PATCH] =?UTF-8?q?fixed=20=E5=A2=9E=E5=8A=A0=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E7=99=BB=E5=BD=95=EF=BC=8C=E6=89=8B=E6=9C=BA=E5=8F=B7=E5=85=88?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=EF=BC=8C=E5=90=8E=E7=BB=AD=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index ad211d42c..72fb40fee 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -350,7 +350,10 @@ class UsersController < ApplicationController # 没有用户时,新建用户并登录 user = User.where("login = ? or phone = ? or mail = ? ", "#{login}", phone, email).first - unless user + if user.present? + # 手机号先记录,后续用 + user.update_column(:phone, "#{phone}") if phone.present? + else ActiveRecord::Base.transaction do phone_rand = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9].sample(4).join user_params = { status: 1, type: 'User', login: "#{login}", lastname: "#{real_name}", mail: "#{email}",