新增:issue编辑删除接口

This commit is contained in:
2023-02-14 23:19:17 +08:00
parent db2d398d94
commit 404a6a00e7
12 changed files with 478 additions and 87 deletions

View File

@@ -34,8 +34,12 @@ class SendTemplateMessageJob < ApplicationJob
operator_id, issue_id = args[0], args[1]
operator = User.find_by_id(operator_id)
issue = Issue.find_by_id(issue_id)
return unless operator.present? && issue.present?
receivers = User.where(id: issue&.assigned_to_id).where.not(id: operator&.id)
return unless operator.present? && issue.present?
if args[2].present?
receivers = User.where(id: args[2]).where.not(id: operator&.id)
else
receivers = User.where(id: issue&.assigned_to_id).where.not(id: operator&.id)
end
receivers_string, content, notification_url = MessageTemplate::IssueAssigned.get_message_content(receivers, operator, issue)
Notice::Write::CreateService.call(receivers_string, content, notification_url, source, {operator_id: operator.id, issue_id: issue.id})
receivers.find_each do |receiver|
@@ -78,7 +82,11 @@ class SendTemplateMessageJob < ApplicationJob
operator_id, issue_title, issue_assigned_to_id, issue_author_id = args[0], args[1], args[2], args[3]
operator = User.find_by_id(operator_id)
return unless operator.present?
receivers = User.where(id: [issue_assigned_to_id, issue_author_id]).where.not(id: operator&.id)
if issue_assigned_to_id.is_a?(Array)
receivers = User.where(id: issue_assigned_to_id.append(issue_author_id)).where.not(id: operator&.id)
else
receivers = User.where(id: [issue_assigned_to_id, issue_author_id]).where.not(id: operator&.id)
end
receivers_string, content, notification_url = MessageTemplate::IssueDeleted.get_message_content(receivers, operator, issue_title)
Notice::Write::CreateService.call(receivers_string, content, notification_url, source, {operator_id: operator.id, issue_title: issue_title})
receivers.find_each do |receiver|