Merge remote-tracking branch 'origin/develop' into develop

dev_aliyun
杨树明 5 years ago
commit 60f40d94ce

@ -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'

@ -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)

@ -67,10 +67,6 @@
<div class="fr edu-menu-panel ml15" style="height:60px;">
<% 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 %>
<span class="fr font-16 color-white mt13 ml40"><a href="<%= signin_path %>" class="color-white mr3">登录</a>/<a href="<%= user_join_path %>" class="color-white ml3">注册</a></span>
<% end %>
<ul class="edu-menu-list edu-menu-lists" style="top:60px;">
<span class="bor-bottom-greyE currentName task-hide"><%= User.current.show_name %></span>
<li><%= link_to '我的课堂', user_path(User.current) %></li>
@ -88,6 +84,9 @@
<li><%= link_to '账号管理', my_account_path %></li>
<li class="bor-top-greyE"><%= link_to '退出', signout_path %></li>
</ul>
<% else %>
<span class="fr font-16 color-white mt13 ml40"><a href="<%= signin_path %>" class="color-white mr3">登录</a>/<a href="<%= user_join_path %>" class="color-white ml3">注册</a></span>
<% end %>
</div>
</div>
</div>

Loading…
Cancel
Save