diff --git a/app/jobs/delay_expired_issue_job.rb b/app/jobs/delay_expired_issue_job.rb new file mode 100644 index 00000000..4633a953 --- /dev/null +++ b/app/jobs/delay_expired_issue_job.rb @@ -0,0 +1,11 @@ +class DelayExpiredIssueJob < ApplicationJob + queue_as :message + + def perform + Issue.where(due_date: Date.today + 1.days).find_each do |issue| + SendTemplateMessageJob.perform_later('IssueAssignerExpire', issue.id) + SendTemplateMessageJob.perform_later('IssueCreatorExpire', issue.id) + end + end + +end \ No newline at end of file diff --git a/app/jobs/send_template_message_job.rb b/app/jobs/send_template_message_job.rb index 52d4f31b..9c94e16e 100644 --- a/app/jobs/send_template_message_job.rb +++ b/app/jobs/send_template_message_job.rb @@ -1,5 +1,5 @@ class SendTemplateMessageJob < ApplicationJob - queue_as :default + queue_as :message def perform(source, *args) Rails.logger.info "SendTemplateMessageJob [args] #{args}" @@ -94,7 +94,7 @@ class SendTemplateMessageJob < ApplicationJob project = Project.find_by_id(project_id) return unless user.present? && project.present? receivers = User.where(id: user.id) - receivers_string, content, notification_url = MessageTemplate::ProjectJoined.get_message_content(receivers, project) + receivers_string, content, notification_url = MessageTemplate::ProjectLeft.get_message_content(receivers, project) Notice::Write::CreateService.call(receivers_string, content, notification_url, source, {user_id: user.id, project_id: project.id}) when 'ProjectRole' user_id, project_id, role = args[0], args[1], args[2] diff --git a/app/models/message_template/project_setting_changed.rb b/app/models/message_template/project_setting_changed.rb index fe9da7c5..8c272f65 100644 --- a/app/models/message_template/project_setting_changed.rb +++ b/app/models/message_template/project_setting_changed.rb @@ -64,7 +64,7 @@ class MessageTemplate::ProjectSettingChanged < MessageTemplate content.gsub!(/({ifpermission})(.*)({endpermission})/, '') end # 项目导航更改 - if change_params[:navbar].present? || navbar_is_changed_by_time + if change_params[:navbar].present? navbar = project.project_units.order(unit_type: :asc).pluck(:unit_type).join(',') navbar.gsub!('code,', '') navbar.gsub!('issues', '易修') diff --git a/config/sidekiq.yml b/config/sidekiq.yml index a50c1c1a..f8981a8b 100644 --- a/config/sidekiq.yml +++ b/config/sidekiq.yml @@ -8,3 +8,4 @@ - [notify, 100] - [mailers, 101] - [cache, 10] + - [message, 20] diff --git a/config/sidekiq_cron.yml b/config/sidekiq_cron.yml index 3e807fa1..448e9c94 100644 --- a/config/sidekiq_cron.yml +++ b/config/sidekiq_cron.yml @@ -2,3 +2,8 @@ sync_gitea_repo_update_time: cron: "0 0 * * *" class: "SyncRepoUpdateTimeJob" queue: default + +delay_expired_issue: + cron: "0 0 * * *" + class: "DelayExpiredIssueJob" + queue: message