This commit is contained in:
yuanke 2016-11-15 09:28:42 +08:00
parent e33146813d
commit 85938bf3f1
1 changed files with 5 additions and 0 deletions

View File

@ -147,6 +147,7 @@ class Message < ActiveRecord::Base
# 删除帖子的时候更新帖子总数, 删除回复的时候总数不减少
def decrease_boards_count
logger.info 'decrease_boards_count! start'
tStarttime = Time.now
if self.project && !project.project_score.nil?
# 讨论区
@ -165,6 +166,7 @@ class Message < ActiveRecord::Base
end
def reset_counters!
logger.info 'reset_counters! start'
tStarttime = Time.now
if parent && parent.id
Message.update_all({:last_reply_id => parent.children.maximum(:id)}, {:id => parent.id})
@ -368,6 +370,7 @@ class Message < ActiveRecord::Base
#减少用户分数
def down_user_score
logger.info 'down_user_score start'
tStarttime = Time.now
if self.parent_id.nil? && !self.board.project.nil?
UserScore.joint(:delete_message, self.author,nil,self, { message_id: self.id })
@ -396,6 +399,7 @@ class Message < ActiveRecord::Base
# Author lizanle
# Description 删除对应消息的图片资源
def delete_kindeditor_assets
logger.info 'delete_kindeditor_assets start'
tStarttime = Time.now
delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::MESSAGE
@ -420,6 +424,7 @@ class Message < ActiveRecord::Base
# 删除帖子的时候更新课程帖子总数, 删除回复的时候减少总数
def down_course_score
logger.info 'down_course_score start'
tStarttime = Time.now
if self.course
if self.parent_id.nil? # 发帖