新增:管理后台新增类型筛选

This commit is contained in:
yystopf 2022-09-15 10:21:39 +08:00
parent 6a2cfc5fde
commit dfc2c68225
2 changed files with 14 additions and 1 deletions

View File

@ -30,6 +30,15 @@ class Admins::UserQuery < ApplicationQuery
users = users.joins(user_extension: :school).where(schools: { auto_users_trial: params[:auto_trial].to_i == 1 })
end
# 第三方账户类型
if params[:open_user_type].present?
if params[:open_user_type] == "Forge"
users = users.left_joins(:open_users).where(open_users: {id: nil})
else
users = users.joins(:open_users).where(open_users: {type: params[:open_user_type]})
end
end
# 关键字检索
keyword = params[:keyword].to_s.strip.presence
if keyword

View File

@ -15,7 +15,11 @@
<% identity_options = [['全部', ''], ['教师', 0], ['学生', 1], ['专业人士', 2]] %>
<%= select_tag(:identity, options_for_select(identity_options), class: 'form-control') %>
</div>
<div class="form-group mr-2">
<label for="identity">类型:</label>
<% open_user_type_options = [['所有用户', ''], ['头歌同步', "OpenUsers::Educoder"], ['平台注册', "Forge"],] %>
<%= select_tag(:open_user_type, options_for_select(open_user_type_options), class: 'form-control') %>
</div>
<%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-sm-2 ml-3', placeholder: 'ID/姓名/邮箱/手机号检索') %>