dev_cxt2
cxt 5 years ago
parent a87160a634
commit ef1273a807

@ -207,7 +207,7 @@ class MessagesController < ApplicationController
def notify_course_students message, course def notify_course_students message, course
course.students.includes(:user).each do |student| course.students.includes(:user).each do |student|
UserMailer.course_message_email(student&.user&.mail, message.id).deliver_now if student&.user&.mail UserMailer.course_message_email(student&.user&.mail, message.id).deliver_later if student&.user&.mail
end end
end end
end end

@ -12,6 +12,6 @@ class UserMailer < ApplicationMailer
def course_message_email(mail, message_id) def course_message_email(mail, message_id)
@message = Message.find_by(id: message_id) @message = Message.find_by(id: message_id)
@course = @message&.board&.course @course = @message&.board&.course
mail(to: mail, subject: '课堂通知') if @message.present? && @course.present? mail(to: mail, subject: '课堂发布了新的帖子') if @message.present? && @course.present?
end end
end end

@ -1,7 +1,7 @@
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title><%= @course.name %>通知</title> <title><%= @course.name %> 发布了新的帖子</title>
<style type="text/css"> <style type="text/css">
/* 验证链接页面 */ /* 验证链接页面 */
body,h1,h2,h3,h4,h5,h6,hr,p,blockquote,dl,dt,dd,ul,ol,li,pre,form,fieldset,legend,button,input,textarea,th,td{ margin:0; padding:0;} body,h1,h2,h3,h4,h5,h6,hr,p,blockquote,dl,dt,dd,ul,ol,li,pre,form,fieldset,legend,button,input,textarea,th,td{ margin:0; padding:0;}
@ -36,22 +36,15 @@
<p style="color:#333; font-size:16px; margin-bottom:15px;font-weight: bold"> <p style="color:#333; font-size:16px; margin-bottom:15px;font-weight: bold">
您好! 您好!
</p> </p>
<p style="color:#333;"> <p style="color:#333; ">
您正在注册Educoder请在10分钟内在注册页输入此验证码并进行下一步操作。 您参与的课堂:<%= @course.name %>,有新的帖子发布了:<a href="https://www.educoder.net/courses/<%= @course.id %>/boards/<%= @message.board_id %>/messages/<%= @message.id %>" style="font-weight: normal; color:#ff7500;"><%= @message.subject %></a>
如非你本人操作,请忽略此邮件。
</p> </p>
<div style="text-align: center;"> <div style="text-align: center; margin-top:40px;">
<div style="display:block; height: 45px; line-height:45px;padding:0 30px; width:100px; font-size: 20px; font-weight: bold; background:#ffd9d9; color:#e72c37; margin:30px auto;">
<p><%= @code %></p>
</div>
<span style="font-weight: normal;color:#666;"> <span style="font-weight: normal;color:#666;">
此邮件为系统所发,请勿直接回复。<br/> 此邮件为系统所发,请勿直接回复。<br/>
要解决问题或了解您的帐户详情,您可以访问 <a href="https://www.educoder.net/help?index=5" style="font-weight: normal; color:#ff7500;">帮助中心</a>。 要解决问题或了解您的帐户详情,您可以访问 <a href="https://www.educoder.net/help?index=5" style="font-weight: normal; color:#ff7500;">帮助中心</a>。
</span> </span>
</div> </div>
<p style="color:#666; margin-top:30px;">
如果您并未发过此请求,则可能是因为其他用户在注册时误输了您的邮件地址,而使您收到了这封邮件,那么您可以放心的忽略此邮件,无需进一步采取任何操作。
</p>
</div> </div>
<div style="padding:20px; color:#333; line-height: 1.9;background:#46484c;border:1px solid #ddd; border-top:none; width: 558px;"> <div style="padding:20px; color:#333; line-height: 1.9;background:#46484c;border:1px solid #ddd; border-top:none; width: 558px;">
<a href="https:///www.educoder.net/" style="font-weight: normal; color:#fff;">www.educoder.net</a> <a href="https:///www.educoder.net/" style="font-weight: normal; color:#fff;">www.educoder.net</a>

Loading…
Cancel
Save