更改:检查用户id的路由
This commit is contained in:
parent
a578b7277a
commit
e815b0a8ac
|
@ -1,14 +1,13 @@
|
||||||
class Api::V1::UsersController < Api::V1::BaseController
|
class Api::V1::UsersController < Api::V1::BaseController
|
||||||
|
|
||||||
|
before_action :load_observe_user, except: [:check_user_id]
|
||||||
|
before_action :check_auth_for_observe_user, except: [:check_user_id]
|
||||||
|
|
||||||
def check_user_id
|
def check_user_id
|
||||||
id = params[:user_id]
|
return tip_exception(-1, "用户ID不存在") unless params[:user_id].present? && User.exists?(id: params[:user_id])
|
||||||
return tip_exception(-1, "用户ID不存在") unless User.exists?(id: id)
|
|
||||||
render_ok
|
render_ok
|
||||||
end
|
end
|
||||||
|
|
||||||
before_action :load_observe_user
|
|
||||||
before_action :check_auth_for_observe_user
|
|
||||||
|
|
||||||
def send_email_vefify_code
|
def send_email_vefify_code
|
||||||
code = %W(0 1 2 3 4 5 6 7 8 9)
|
code = %W(0 1 2 3 4 5 6 7 8 9)
|
||||||
verification_code = code.sample(6).join
|
verification_code = code.sample(6).join
|
||||||
|
|
|
@ -1,11 +1,17 @@
|
||||||
defaults format: :json do
|
defaults format: :json do
|
||||||
namespace :api do
|
namespace :api do
|
||||||
namespace :v1 do
|
namespace :v1 do
|
||||||
|
|
||||||
|
resources :users, only: [:index] do
|
||||||
|
collection do
|
||||||
|
post :check_user_id
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
scope ':owner' do
|
scope ':owner' do
|
||||||
resource :users, path: '/', only: [:update, :edit, :destroy] do
|
resource :users, path: '/', only: [:update, :edit, :destroy] do
|
||||||
collection do
|
collection do
|
||||||
get :send_email_vefify_code
|
get :send_email_vefify_code
|
||||||
post :check_user_id
|
|
||||||
post :check_password
|
post :check_password
|
||||||
post :check_email
|
post :check_email
|
||||||
post :check_email_verify_code
|
post :check_email_verify_code
|
||||||
|
|
Loading…
Reference in New Issue