From 0bfdf8d320cc99559d4c02c720b6877e274b5314 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 14 Jan 2020 19:00:40 +0800 Subject: [PATCH] 1 --- app/services/shixun_search_service.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/services/shixun_search_service.rb b/app/services/shixun_search_service.rb index c8db74325..21ad7fcf4 100644 --- a/app/services/shixun_search_service.rb +++ b/app/services/shixun_search_service.rb @@ -51,11 +51,17 @@ class ShixunSearchService < ApplicationService 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 = { includes: [ :shixun_info, :challenges, :subjects, user: { user_extension: :school } ] } 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 end