diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index c5cae99c4..b6fdf8ea9 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -17,7 +17,7 @@ class SubjectsController < ApplicationController include CustomSortable def index - subjects = Weapps::SubjectQuery.call(current_laboratory, params) + subjects = Weapps::SubjectQuery.call(current_laboratory, params, "web") @subject_count = subjects.map(&:id).size @subjects = paginate subjects.includes(:shixuns, :repertoire) end diff --git a/app/controllers/weapps/subjects_controller.rb b/app/controllers/weapps/subjects_controller.rb index e5c3eb316..e1e50cc40 100644 --- a/app/controllers/weapps/subjects_controller.rb +++ b/app/controllers/weapps/subjects_controller.rb @@ -4,7 +4,7 @@ class Weapps::SubjectsController < Weapps::BaseController # 首页 def index - subjects = Weapps::SubjectQuery.call(current_laboratory, params) + subjects = Weapps::SubjectQuery.call(current_laboratory, params, "wechat") @subject_count = subjects.map(&:id).size @subjects = paginate subjects end diff --git a/app/queries/weapps/subject_query.rb b/app/queries/weapps/subject_query.rb index 180176ce2..ca0c437a9 100644 --- a/app/queries/weapps/subject_query.rb +++ b/app/queries/weapps/subject_query.rb @@ -2,13 +2,20 @@ class Weapps::SubjectQuery < ApplicationQuery include CustomSortable attr_reader :params - def initialize(current_laboratory, params) + def initialize(current_laboratory, params, device) @current_laboratory = current_laboratory @params = params + @device = device end def call - subjects = @current_laboratory.subjects.unhidden.publiced.show_moblied + Rails.logger.info("##### @device: #{@device}") + subjects = + if @device == "wechat" + @current_laboratory.subjects.unhidden.publiced.show_moblied + else + @current_laboratory.subjects.unhidden.publiced + end # 课程体系的过滤 if params[:sub_discipline_id].present?