项目、课程讨论区邮件提醒查询修改
This commit is contained in:
parent
0354e65497
commit
9e0a986fe9
|
@ -83,13 +83,10 @@ class Mailer < ActionMailer::Base
|
||||||
# 发送内容: 项目【缺陷,讨论区,新闻】,课程【通知,留言,新闻】, 贴吧, 个人留言
|
# 发送内容: 项目【缺陷,讨论区,新闻】,课程【通知,留言,新闻】, 贴吧, 个人留言
|
||||||
def send_for_user_activities(user, date_to, days)
|
def send_for_user_activities(user, date_to, days)
|
||||||
date_from = date_to - days.days
|
date_from = date_to - days.days
|
||||||
|
|
||||||
subject = "[ #{user.show_name}#{l(:label_day_mail)}]"
|
subject = "[ #{user.show_name}#{l(:label_day_mail)}]"
|
||||||
@subject = " #{user.show_name}#{l(:label_day_mail)}"
|
@subject = " #{user.show_name}#{l(:label_day_mail)}"
|
||||||
|
|
||||||
date_from = "#{date_from} 17:59:59"
|
date_from = "#{date_from} 17:59:59"
|
||||||
date_to = "#{date_to} 17:59:59"
|
date_to = "#{date_to} 17:59:59"
|
||||||
|
|
||||||
# 生成token用于直接点击登录
|
# 生成token用于直接点击登录
|
||||||
@user = user
|
@user = user
|
||||||
@token = Token.get_token_from_user(user, 'autologin')
|
@token = Token.get_token_from_user(user, 'autologin')
|
||||||
|
@ -102,7 +99,7 @@ class Mailer < ActionMailer::Base
|
||||||
|
|
||||||
# 查询user的缺陷,包括发布的,跟踪的以及被指派的缺陷
|
# 查询user的缺陷,包括发布的,跟踪的以及被指派的缺陷
|
||||||
sql = "select * from members m, issues i where i.project_id = m.project_id and m.user_id='#{user.id}'
|
sql = "select * from members m, issues i where i.project_id = m.project_id and m.user_id='#{user.id}'
|
||||||
and (i.created_on between '#{date_from}' and '#{date_to}') order by i.created_on desc"
|
and (i.created_on between '#{date_from}' and '#{date_to}') order by i.created_on desc"
|
||||||
@issues = Issue.find_by_sql(sql)
|
@issues = Issue.find_by_sql(sql)
|
||||||
|
|
||||||
# @bids 查询课程作业,包括老师发布的作业,以及user提交作业
|
# @bids 查询课程作业,包括老师发布的作业,以及user提交作业
|
||||||
|
@ -125,7 +122,9 @@ class Mailer < ActionMailer::Base
|
||||||
@homeworks = HomeworkAttach.where("user_id=#{user.id} and (created_at between '#{date_from}' and '#{date_to}')").order("created_at desc")
|
@homeworks = HomeworkAttach.where("user_id=#{user.id} and (created_at between '#{date_from}' and '#{date_to}')").order("created_at desc")
|
||||||
|
|
||||||
# 查询user在课程。项目中发布的讨论帖子
|
# 查询user在课程。项目中发布的讨论帖子
|
||||||
messages = Message.find_by_sql("select DISTINCT * from messages where author_id = #{user.id} and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc")
|
messages = Message.find_by_sql("select me.* from messages me, boards b, members m where
|
||||||
|
b.id = me.board_id and b.project_id = m.project_id and m.user_id = '#{user.id}' and (me.created_on between '#{date_from}' and '#{date_to}') order by created_on desc")
|
||||||
|
# messages = Message.find_by_sql("select DISTINCT * from messages where author_id = #{user.id} and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc")
|
||||||
@course_messages ||= []
|
@course_messages ||= []
|
||||||
@project_messages ||= []
|
@project_messages ||= []
|
||||||
unless messages.first.nil?
|
unless messages.first.nil?
|
||||||
|
|
|
@ -193,6 +193,7 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</div><!--课程动态 end-->
|
</div><!--课程动态 end-->
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<!--项目相关-->
|
||||||
<% if @issues.first || @project_messages.first %>
|
<% if @issues.first || @project_messages.first %>
|
||||||
<div class="wmail_main" style="padding:20px 10px 0px;">
|
<div class="wmail_main" style="padding:20px 10px 0px;">
|
||||||
<h2 class="wmail_h2" style="color:#15bccf; "><%= l(:label_project_overview_new)%></h2>
|
<h2 class="wmail_h2" style="color:#15bccf; "><%= l(:label_project_overview_new)%></h2>
|
||||||
|
@ -260,11 +261,9 @@
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
</ul><!--项目论坛 end-->
|
</ul><!--项目论坛 end-->
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div><!--项目动态 end-->
|
</div><!--项目动态 end-->
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% unless @user_journal_messages.first.nil? %>
|
<% unless @user_journal_messages.first.nil? %>
|
||||||
<div class="wmail_main" style="padding:20px 10px 0px;">
|
<div class="wmail_main" style="padding:20px 10px 0px;">
|
||||||
<h2 class="wmail_h2" style="color:#15bccf; "><%= l(:label_activities) %></h2>
|
<h2 class="wmail_h2" style="color:#15bccf; "><%= l(:label_activities) %></h2>
|
||||||
|
@ -293,7 +292,7 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
</ul><!--课程动态 end-->
|
</ul><!--用户留言 end-->
|
||||||
|
|
||||||
</div><!--个人动态 end-->
|
</div><!--个人动态 end-->
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
Loading…
Reference in New Issue