作业二级回复的模板通知

cxt_course
cxt 9 years ago
parent 2895dd5342
commit c165d0b37e

@ -259,19 +259,26 @@ class JournalsForMessage < ActiveRecord::Base
if self.m_parent_id.nil? if self.m_parent_id.nil?
if self.user_id != self.jour.user_id 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) 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 end
else else
if self.user_id != self.parent.user_id 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) 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
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
end end

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

Loading…
Cancel
Save