已经被关注的人就不显示

This commit is contained in:
lizanle 2015-04-10 16:43:42 +08:00
parent db219205d9
commit b3b0461a42
1 changed files with 6 additions and 4 deletions

View File

@ -199,13 +199,15 @@ class UsersService
#搜索用户
def search_user params
@status = params[:status] || 1
status = params[:status] || 1
has = {
"show_changesets" => true
}
scope = User.logged.status(@status)
@search_by = params[:search_by] ? params[:search_by] : "0"
scope = scope.like(params[:name],@search_by) if params[:name].present?
scope = User.logged.status(status)
watcher = User.watched_by(params[:user_id])
watcher.push(params[:user_id])
search_by = params[:search_by] ? params[:search_by] : "0"
scope = scope.where("id not in (?)",watcher).like(params[:name],search_by) if params[:name].present?
scope
end