用户搜索接口
This commit is contained in:
parent
29069c58ae
commit
1494821b67
|
@ -370,14 +370,16 @@ class UsersController < ApplicationController
|
|||
else
|
||||
@limit = 15#per_page_option
|
||||
end
|
||||
|
||||
@status = params[:status] || 1
|
||||
has = {
|
||||
"show_changesets" => true
|
||||
}
|
||||
scope = User.logged.status(@status)
|
||||
@search_by = params[:search_by] ? params[:search_by][:id] : 0
|
||||
scope = scope.like(params[:name],@search_by) if params[:name].present?
|
||||
#
|
||||
#@status = params[:status] || 1
|
||||
#has = {
|
||||
# "show_changesets" => true
|
||||
#}
|
||||
# scope = User.logged.status(@status)
|
||||
# @search_by = params[:search_by] ? params[:search_by][:id] : 0
|
||||
# scope = scope.like(params[:name],@search_by) if params[:name].present?
|
||||
us = UsersService.new
|
||||
scope = us.search_user params
|
||||
@user_count = scope.count
|
||||
@user_pages = Paginator.new @user_count, @limit, params['page']
|
||||
@user_base_tag = params[:id] ? 'base_users':'users_base'
|
||||
|
|
|
@ -126,4 +126,16 @@ class UsersService
|
|||
@current_user
|
||||
end
|
||||
|
||||
#搜索用户
|
||||
def search_user params
|
||||
@status = params[:status] || 1
|
||||
has = {
|
||||
"show_changesets" => true
|
||||
}
|
||||
scope = User.logged.status(@status)
|
||||
@search_by = params[:search_by] ? params[:search_by][:id] : 0
|
||||
scope = scope.like(params[:name],@search_by) if params[:name].present?
|
||||
scope
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue