留言报500

This commit is contained in:
cxt 2016-05-05 10:52:54 +08:00
parent d845b14992
commit 5f50ad046c
1 changed files with 8 additions and 6 deletions

View File

@ -255,12 +255,14 @@ class JournalsForMessage < ActiveRecord::Base
self.course_messages << CourseMessage.new(:user_id => r, :course_id => self.jour.id, :viewed => false)
end
end
count = ShieldWechatMessage.where("container_type='User' and container_id=#{self.jour.user_id} and shield_type='Course' and shield_id=#{self.jour.course_id}").count
if self.jour_type == 'HomeworkCommon' && count == 0
ws = WechatService.new
#content = truncate(strip_tags(self.notes.to_s), length: 200)
content = strip_html self.notes.html_safe, 200
ws.comment_template self.jour.user_id, "homework", self.jour_id, "#{l(:label_homework_comment_template)}", self.user.try(:realname), format_time(self.created_on), content
if self.jour_type == 'HomeworkCommon'
count = ShieldWechatMessage.where("container_type='User' and container_id=#{self.jour.user_id} and shield_type='Course' and shield_id=#{self.jour.course_id}").count
if count == 0
ws = WechatService.new
#content = truncate(strip_tags(self.notes.to_s), length: 200)
content = strip_html self.notes.html_safe, 200
ws.comment_template self.jour.user_id, "homework", self.jour_id, "#{l(:label_homework_comment_template)}", self.user.try(:realname), format_time(self.created_on), content
end
end
end