From 4bb674bcae928008096fb11cef4c407177db51c9 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 15 Jun 2015 15:43:28 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E9=80=9A=E7=9F=A5=E3=80=81?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=96=B0=E9=97=BB=E5=9B=9E=E5=A4=8D=20?= =?UTF-8?q?=E9=82=AE=E4=BB=B6=E6=9F=A5=E8=AF=A2=E8=AF=AD=E5=8F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/mailer.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 20cf91aa4..352c1b41a 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -160,13 +160,23 @@ class Mailer < ActionMailer::Base end # wiki - # 查询user在课程中发布的通知,项目中发的新闻 + # 查询user在课程中发布的通知和回复通知 @course_news = (course_ids && !course_ids.empty?) ? News.find_by_sql("select DISTINCT n.* from news n where n.course_id in (#{course_ids}) and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") : [] + + @course_news_comments = Comment.find_by_sql("select cm.* from comments cm, members m, courses c, news n + where m.user_id = '#{user.id}' and c.id = m.course_id and n.course_id = c.id and cm.commented_id = n.id + and cm.commented_type ='News' and (cm.created_on between '#{date_from}' and '#{date_to}') order by created_on desc") + + # 查询user在项目中添加新闻和回复新闻 @project_news = (project_ids && !project_ids.empty?) ? News.find_by_sql("select DISTINCT n.* from news n where n.project_id in (#{project_ids}) and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") : [] + @project_news_comments = Comment.find_by_sql("select c.* from comments c, members m, projects p, news n + where m.user_id = '#{user.id}' and p.id = m.project_id and n.project_id = p.id and c.commented_id = n.id + and c.commented_type ='News' and (c.created_on between '#{date_from}' and '#{date_to}') order by created_on desc") + # 查询user在课程及个人中留言 @course_journal_messages = JournalsForMessage.find_by_sql("select DISTINCT jfm.* from journals_for_messages jfm, members m, courses c where m.user_id = '#{user.id}' and c.id = m.course_id and jfm.jour_id = c.id