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

dev_forum
daiao 5 years ago
commit 1520bf941f

@ -87,7 +87,10 @@ class MessagesController < ApplicationController
end end
def show def show
@message = Message.includes(:attachments, :message_detail, :children, :author => :user_extension, :board => [{course: :board_course_modules}]).find_by_id params[:id] @message = Message.includes(:attachments, :message_detail,
:children, :author => :user_extension,
:board => [{course: :board_course_modules}])
.find_by_id params[:id]
return normal_status(-2, "ID为#{params[:id]}的帖子不存在") if @message.nil? return normal_status(-2, "ID为#{params[:id]}的帖子不存在") if @message.nil?
@attachment_size = @message.attachments.size @attachment_size = @message.attachments.size

@ -73,7 +73,7 @@ class Message < ApplicationRecord
# 包含二级回复的总点赞数 # 包含二级回复的总点赞数
def total_praises_count def total_praises_count
descendants.sum(:praises_count) praises_count + descendants.sum(:praises_count)
end end
# 包含二级回复数的总回复数 # 包含二级回复数的总回复数

Loading…
Cancel
Save