From dfc2c6822533a467944223b81ec88cf528a64b61 Mon Sep 17 00:00:00 2001 From: yystopf Date: Thu, 15 Sep 2022 10:21:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=90=8E=E5=8F=B0=E6=96=B0=E5=A2=9E=E7=B1=BB=E5=9E=8B=E7=AD=9B?= =?UTF-8?q?=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/queries/admins/user_query.rb | 9 +++++++++ app/views/admins/users/index.html.erb | 6 +++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/queries/admins/user_query.rb b/app/queries/admins/user_query.rb index dabfa9c5e..6187f2ecc 100644 --- a/app/queries/admins/user_query.rb +++ b/app/queries/admins/user_query.rb @@ -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 diff --git a/app/views/admins/users/index.html.erb b/app/views/admins/users/index.html.erb index 42d85108d..4ba38c39a 100644 --- a/app/views/admins/users/index.html.erb +++ b/app/views/admins/users/index.html.erb @@ -15,7 +15,11 @@ <% identity_options = [['全部', ''], ['教师', 0], ['学生', 1], ['专业人士', 2]] %> <%= select_tag(:identity, options_for_select(identity_options), class: 'form-control') %> - +
+ + <% open_user_type_options = [['所有用户', ''], ['头歌同步', "OpenUsers::Educoder"], ['平台注册', "Forge"],] %> + <%= select_tag(:open_user_type, options_for_select(open_user_type_options), class: 'form-control') %> +
<%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-sm-2 ml-3', placeholder: 'ID/姓名/邮箱/手机号检索') %>