|
|
@ -51,11 +51,17 @@ class ShixunSearchService < ApplicationService
|
|
|
|
|
|
|
|
|
|
|
|
def search_options
|
|
|
|
def search_options
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
order =
|
|
|
|
|
|
|
|
if sort_str == "wechat_myshixun_count"
|
|
|
|
|
|
|
|
{"is_wechat_support" => "desc", sort_str => order_str}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{sort_str => order_str}
|
|
|
|
|
|
|
|
end
|
|
|
|
model_options = {
|
|
|
|
model_options = {
|
|
|
|
includes: [ :shixun_info, :challenges, :subjects, user: { user_extension: :school } ]
|
|
|
|
includes: [ :shixun_info, :challenges, :subjects, user: { user_extension: :school } ]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
model_options.merge!(where: { id: @shixuns.pluck(:id) })
|
|
|
|
model_options.merge!(where: { id: @shixuns.pluck(:id) })
|
|
|
|
model_options.merge!(order: {sort_str => order_str})
|
|
|
|
model_options.merge!(order: order)
|
|
|
|
model_options.merge!(default_options)
|
|
|
|
model_options.merge!(default_options)
|
|
|
|
model_options
|
|
|
|
model_options
|
|
|
|
end
|
|
|
|
end
|
|
|
|