作业二级回复的模板通知

This commit is contained in:
cxt 2016-05-20 14:52:47 +08:00
parent 2895dd5342
commit c165d0b37e
2 changed files with 15 additions and 7 deletions

View File

@ -259,19 +259,26 @@ class JournalsForMessage < ActiveRecord::Base
if self.m_parent_id.nil?
if self.user_id != self.jour.user_id
self.course_messages << CourseMessage.new(:user_id => self.jour.user_id,:course_id => self.jour.course.id, :viewed => false)
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
else
if self.user_id != self.parent.user_id
self.course_messages << CourseMessage.new(:user_id => self.parent.user_id,:course_id => self.jour.course.id, :viewed => false)
count = ShieldWechatMessage.where("container_type='User' and container_id=#{self.parent.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.parent.user_id, "homework", self.jour_id, "#{l(:label_new_second_comment_template)}", self.user.try(:realname), format_time(self.created_on), content
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 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

View File

@ -2137,6 +2137,7 @@ zh:
label_notice_comment_template: 您的课程通知有新回复了
label_news_comment_template: 您的项目新闻有新回复了
label_homework_comment_template: 您的作业有新回复了
label_new_second_comment_template: 您有新回复了
label_new_journals_template: 您有新留言了
label_journals_comment_template: 您的留言有新回复了
label_blog_comment_template: 您的博客有新回复了