@ -255,14 +255,16 @@ class JournalsForMessage < ActiveRecord::Base
self . course_messages << CourseMessage . new ( :user_id = > r , :course_id = > self . jour . id , :viewed = > false )
end
end
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 self . jour_type == 'HomeworkCommon' && count == 0
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
# 用户留言消息通知