|
|
|
@@ -332,7 +332,23 @@ class SendTemplateMessageJob < ApplicationJob |
|
|
|
project = Project.find_by_sql("select *,title as name from competitions where id=#{competition_id}") |
|
|
|
return unless user.present? && project.present? |
|
|
|
receivers = User.where(id: user_id) |
|
|
|
receivers_string, content, notification_url = MessageTemplate::TeamLeft.get_message_content(receivers, nil, nil) |
|
|
|
receivers_string, content, notification_url = MessageTemplate::CompetitionBegin.get_message_content(receivers, project.first) |
|
|
|
Notice::Write::CreateService.call(receivers_string, content, notification_url, source, {user_id: user_id, competition_name: project.first&.name, identifier: project.first&.identifier}) |
|
|
|
when 'CompetitionReview' |
|
|
|
user_id, competition_id = args[0], args[1] |
|
|
|
user = User.find_by_id(user_id) |
|
|
|
project = Project.find_by_sql("select *,title as name from competitions where id=#{competition_id}") |
|
|
|
return unless user.present? && project.present? |
|
|
|
receivers = User.where(id: user_id) |
|
|
|
receivers_string, content, notification_url = MessageTemplate::CompetitionReview.get_message_content(receivers, project.first) |
|
|
|
Notice::Write::CreateService.call(receivers_string, content, notification_url, source, {user_id: user_id, competition_name: project.first&.name, identifier: project.first&.identifier}) |
|
|
|
when 'CompetitionResult' |
|
|
|
user_id, competition_id = args[0], args[1] |
|
|
|
user = User.find_by_id(user_id) |
|
|
|
project = Project.find_by_sql("select *,title as name from competitions where id=#{competition_id}") |
|
|
|
return unless user.present? && project.present? |
|
|
|
receivers = User.where(id: user_id) |
|
|
|
receivers_string, content, notification_url = MessageTemplate::CompetitionResult.get_message_content(receivers, project.first) |
|
|
|
Notice::Write::CreateService.call(receivers_string, content, notification_url, source, {user_id: user_id, competition_name: project.first&.name, identifier: project.first&.identifier}) |
|
|
|
end |
|
|
|
end |