加日志测试

This commit is contained in:
yuanke 2016-11-15 09:25:58 +08:00
parent 6261b92c7f
commit e33146813d
1 changed files with 25 additions and 0 deletions

View File

@ -147,6 +147,7 @@ class Message < ActiveRecord::Base
# 删除帖子的时候更新帖子总数, 删除回复的时候总数不减少
def decrease_boards_count
tStarttime = Time.now
if self.project && !project.project_score.nil?
# 讨论区
if self.parent_id.nil?
@ -157,13 +158,22 @@ class Message < ActiveRecord::Base
self.project.project_score.update_attribute(:board_message_num, count < 0 ? 0 : count)
end
end
tEndtime = Time.now
tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000
logger.info "message_time decrease_boards_count! user wait time = #{tUsedtime} ms"
end
def reset_counters!
tStarttime = Time.now
if parent && parent.id
Message.update_all({:last_reply_id => parent.children.maximum(:id)}, {:id => parent.id})
end
board.reset_counters!
tEndtime = Time.now
tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000
logger.info "message_time reset_counters! user wait time = #{tUsedtime} ms"
end
def sticky=(arg)
@ -358,6 +368,7 @@ class Message < ActiveRecord::Base
#减少用户分数
def down_user_score
tStarttime = Time.now
if self.parent_id.nil? && !self.board.project.nil?
UserScore.joint(:delete_message, self.author,nil,self, { message_id: self.id })
update_memo_number(User.current,1)
@ -371,6 +382,10 @@ class Message < ActiveRecord::Base
update_replay_for_memo(self.author,2,self.board.project)
end
end
tEndtime = Time.now
tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000
logger.info "message_time down_user_score! user wait time = #{tUsedtime} ms"
end
def send_mail
@ -381,7 +396,13 @@ class Message < ActiveRecord::Base
# Author lizanle
# Description 删除对应消息的图片资源
def delete_kindeditor_assets
tStarttime = Time.now
delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::MESSAGE
tEndtime = Time.now
tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000
logger.info "message_time delete_kindeditor_assets! user wait time = #{tUsedtime} ms"
end
# 课程成员得分(活跃度)
@ -399,6 +420,7 @@ class Message < ActiveRecord::Base
# 删除帖子的时候更新课程帖子总数, 删除回复的时候减少总数
def down_course_score
tStarttime = Time.now
if self.course
if self.parent_id.nil? # 发帖
down_course_score_num(self.course.id, self.author_id, "Message")
@ -407,6 +429,9 @@ class Message < ActiveRecord::Base
down_course_score_num(self.course.id, self.author_id, "MessageReply")
end
end
tEndtime = Time.now
tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000
logger.info "message_time down_course_score! user wait time = #{tUsedtime} ms"
end
def delete_org_activities