diff --git a/app/models/mailer.rb b/app/models/mailer.rb index b3aff41d2..065443d99 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -125,11 +125,17 @@ class Mailer < ActionMailer::Base # user 提交的作业 # @homeworks = HomeworkAttach.where("user_id=#{user.id} and (created_at between '#{date_from}' and '#{date_to}')").order("created_at desc") + # 查询user所在项目添加wiki + @wiki_contents = WikiContent.find_by_sql("SELECT wc.* FROM wikis w, members m, projects p, wiki_pages wp, wiki_contents wc where + m.user_id = '#{user.id}' and p.user_id = m.user_id and m.project_id=p.id and w.project_id = p.id and w.id = wp.wiki_id and wc.page_id = wp.id and w.project_id>0 + and (wc.updated_on between '#{date_from}' and '#{date_to}') order by updated_on desc") + # 查询user在课程中发布的讨论帖子 course_mesages = Message.find_by_sql("select distinct me.* from messages me, boards b, members m where b.id = me.board_id and b.course_id = m.course_id and b.course_id is not Null and m.user_id = '#{user.id}' and (me.created_on between '#{date_from}' and '#{date_to}') order by created_on desc") + # 查询user在项目中发布的讨论帖子 project_messages = Message.find_by_sql("select distinct me.* from messages me, boards b, members m where b.id = me.board_id and b.project_id = m.project_id @@ -167,7 +173,7 @@ class Mailer < ActionMailer::Base and (m.created_at between '#{date_from}' and '#{date_to}') order by m.created_at desc") has_content = [@issues,@course_messages,@project_messages,@course_news,@project_news, - @course_journal_messages,@user_journal_messages,@forums,@memos,@attachments,@bids].any? {|o| !o.empty?} + @course_journal_messages,@user_journal_messages,@forums,@memos,@attachments,@bids,@wiki_contents].any? {|o| !o.empty?} mylogger.debug "Sent activity mail : #{user.mail} - #{has_content}" #有内容才发,没有不发 mail :to => user.mail,:subject => subject if has_content diff --git a/app/views/mailer/send_for_user_activities.html.erb b/app/views/mailer/send_for_user_activities.html.erb index 38805d837..8bd4e0413 100644 --- a/app/views/mailer/send_for_user_activities.html.erb +++ b/app/views/mailer/send_for_user_activities.html.erb @@ -231,6 +231,38 @@ <% end %> + + <% unless @wiki_contents.first.nil? %> +