Merge branch 'dev_aliyun' of http://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

PCqiandao
anke1460 5 years ago
commit c3ab296de5

@ -12,7 +12,14 @@ class MemosController < ApplicationController
def index def index
@user = current_user @user = current_user
@memos = Memo.all @memos = Memo.all
s_order = (params[:order] == "replies_count" ? "all_replies_count" : params[:order]) || "updated_at" # replies_count created_at updated_at
s_order =
case params[:order]
when 'replies_count' then 'all_replies_count'
when 'created_at' then 'created_at'
else
'updated_at'
end
# @tidding_count = unviewed_tiddings(current_user) if current_user.present? # @tidding_count = unviewed_tiddings(current_user) if current_user.present?
page = params[:page] || 1 page = params[:page] || 1
limit = params[:limit] || 15 limit = params[:limit] || 15

@ -70,7 +70,7 @@ class ShixunsController < ApplicationController
end end
## 排序参数 ## 排序参数
bsort = params[:sort] || 'desc' bsort = (params[:sort] == "desc" ? "desc" : "asc")
case params[:order_by] || 'new' case params[:order_by] || 'new'
when 'hot' when 'hot'
@shixuns = @shixuns.order("shixuns.public = 2 desc, shixuns.myshixuns_count #{bsort}") @shixuns = @shixuns.order("shixuns.public = 2 desc, shixuns.myshixuns_count #{bsort}")

Loading…
Cancel
Save