From 1287cf6d53bbc435be5bb1c301637a5fe7c11690 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 17 Jul 2019 18:00:05 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E5=9B=9E=E5=A4=8D?= =?UTF-8?q?=E7=89=B9=E5=88=AB=E6=85=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/discusses_service.rb | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/app/services/discusses_service.rb b/app/services/discusses_service.rb index a43ccfa8..cebdf426 100644 --- a/app/services/discusses_service.rb +++ b/app/services/discusses_service.rb @@ -30,14 +30,15 @@ class DiscussesService memo_count = memos.count memos = memos.offset(offset).limit(15) #实训标签使用最多的9个 - hot_tags = TagRepertoire.find_by_sql("select a.name, sum(a.cnt) cnt, a.id from - (select tr.id, tr.name, count(d.dis_id) cnt, d.root_id, s.status, s.hidden - from tag_repertoires tr join (shixun_tag_repertoires str - left join (shixuns s join discusses d on d.dis_id = s.id and d.root_id is null and s.status =2 and s.hidden=false) - on s.id = str.shixun_id) on tr.id = str.tag_repertoire_id - group by d.dis_id order by cnt desc) a group by a.name - order by cnt desc limit 9").map{|ht| ht.attributes.dup} - + # hot_tags = TagRepertoire.find_by_sql("select a.name, sum(a.cnt) cnt, a.id from + # (select tr.id, tr.name, count(d.dis_id) cnt, d.root_id, s.status, s.hidden + # from tag_repertoires tr join (shixun_tag_repertoires str + # left join (shixuns s join discusses d on d.dis_id = s.id and d.root_id is null and s.status =2 and s.hidden=false) + # on s.id = str.shixun_id) on tr.id = str.tag_repertoire_id + # group by d.dis_id order by cnt desc) a group by a.name + # order by cnt desc limit 9").map{|ht| ht.attributes.dup} + tag_id = ShixunTagRepertoire.joins(:shixun).order("myshixuns_count desc").pluck(:tag_repertoire_id).uniq.first(9) + hot_tags = TagRepertoire.select([:id, :name]).where(:id => tag_id).order("FIELD(id, #{tag_id.join(",")})") if tag_id memos = memo_list memos user_info = format_for_current_user current_user hot_memos = Memo.field_for_recommend.posts.hot.limit(4) From e480e06d1b84f2c3e8530457de8d57fcaaebe0d9 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 17 Jul 2019 18:01:53 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/competitions/_header.html.erb | 41 ++++++++++++------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/app/views/competitions/_header.html.erb b/app/views/competitions/_header.html.erb index 1739ed7d..698238cb 100644 --- a/app/views/competitions/_header.html.erb +++ b/app/views/competitions/_header.html.erb @@ -65,29 +65,28 @@
- <% if User.current.logged? %> + <% if User.current.logged? %> <%= link_to (image_tag(url_to_avatar(User.current), :width =>"34", :height => "34", :class => "radius", :nhname => "avatar_image", :alt=>"头像", :id => "nh_user_logo")), user_path(User.current),:class => "fr mt15 ml40" %> - <% else %> - 登录/注册 - <% end %> - - + <% else %> + 登录/注册 + <% end %>
From 1fdd8d0b238b4388ed41a9e531859d1abb24abc4 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 17 Jul 2019 18:18:12 +0800 Subject: [PATCH 3/3] 1 --- app/controllers/ecs_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/ecs_controller.rb b/app/controllers/ecs_controller.rb index 5d391a5d..f31bea88 100644 --- a/app/controllers/ecs_controller.rb +++ b/app/controllers/ecs_controller.rb @@ -1,5 +1,5 @@ class EcsController < ApplicationController - before_filter :require_login + before_filter :require_login, :except => [:get_navigation_url] before_filter :find_school, :except => [:get_navigation_url] before_filter :school_manager, :except => [:department, :get_navigation_url] layout 'base_ec'