This commit is contained in:
yuanke 2016-10-26 13:41:58 +08:00
parent c5ac0ed6b7
commit de5fb72ff3
1 changed files with 12 additions and 12 deletions

View File

@ -164,17 +164,17 @@ class News < ActiveRecord::Base
# 消息发送原则:除了消息的发布者,课程的其它成员都能收到消息提醒 # 消息发送原则:除了消息的发布者,课程的其它成员都能收到消息提醒
def act_as_system_message def act_as_system_message
if self.course if self.course
self.course.members.each do |m| # self.course.members.each do |m|
if m.user_id != self.author_id # if m.user_id != self.author_id
#self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.course_id, :viewed => false) # #self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.course_id, :viewed => false)
count = ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Course' and shield_id=#{self.course_id}").count # count = ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Course' and shield_id=#{self.course_id}").count
if count == 0 # if count == 0
ws = WechatService.new # ws = WechatService.new
content = self.title # content = self.title
ws.class_notice m.user_id, "course_notice", self.id, "#{l(:label_new_notice_template)}", self.course.name, self.author.show_name, format_time(self.created_on), content, "点击查看通知详情" # ws.class_notice m.user_id, "course_notice", self.id, "#{l(:label_new_notice_template)}", self.course.name, self.author.show_name, format_time(self.created_on), content, "点击查看通知详情"
end # end
end # end
end # end
else else
if !self.project.nil? if !self.project.nil?
self.project.members.each do |m| self.project.members.each do |m|
@ -188,7 +188,7 @@ class News < ActiveRecord::Base
def delay_news_wechat_send def delay_news_wechat_send
if self.course if self.course
# self.delay.news_wechat_message self.delay.news_wechat_message
end end
end end