留言报500

chenlw_dev v20160505_01
cxt 9 years ago
parent d845b14992
commit 5f50ad046c

@ -255,12 +255,14 @@ class JournalsForMessage < ActiveRecord::Base
self.course_messages << CourseMessage.new(:user_id => r, :course_id => self.jour.id, :viewed => false) self.course_messages << CourseMessage.new(:user_id => r, :course_id => self.jour.id, :viewed => false)
end end
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'
if self.jour_type == 'HomeworkCommon' && count == 0 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
ws = WechatService.new if count == 0
#content = truncate(strip_tags(self.notes.to_s), length: 200) ws = WechatService.new
content = strip_html self.notes.html_safe, 200 #content = truncate(strip_tags(self.notes.to_s), length: 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 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
end end

Loading…
Cancel
Save