From a578b7277a48f1b56f16711c42531e0922412533 Mon Sep 17 00:00:00 2001 From: yystopf Date: Wed, 19 Apr 2023 17:32:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=EF=BC=9A=E6=A3=80=E6=9F=A5?= =?UTF-8?q?=E7=94=A8=E6=88=B7id=E4=B8=8D=E9=9C=80=E8=A6=81=E7=99=BB?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/api/v1/users_controller.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/controllers/api/v1/users_controller.rb b/app/controllers/api/v1/users_controller.rb index 807efd5f3..f63400b03 100644 --- a/app/controllers/api/v1/users_controller.rb +++ b/app/controllers/api/v1/users_controller.rb @@ -1,5 +1,11 @@ class Api::V1::UsersController < Api::V1::BaseController + def check_user_id + id = params[:user_id] + return tip_exception(-1, "用户ID不存在") unless User.exists?(id: id) + render_ok + end + before_action :load_observe_user before_action :check_auth_for_observe_user @@ -42,12 +48,6 @@ class Api::V1::UsersController < Api::V1::BaseController end end - def check_user_id - id = params[:user_id] - return tip_exception(-1, "用户ID不存在") unless User.exists?(id: id) - render_ok - end - def check_password password = params[:password] return tip_exception(-5, "8~16位密码,支持字母数字和符号") unless password =~ CustomRegexp::PASSWORD