This commit is contained in:
yystopf 2023-02-28 17:05:38 +08:00
parent ec44376e4d
commit e59e4e4bd5
2 changed files with 11 additions and 9 deletions

View File

@ -24,10 +24,10 @@ class Api::V1::Issues::Journals::CreateService < ApplicationService
ActiveRecord::Base.transaction do
check_parent_journal(parent_id) if parent_id.present?
check_parent_journal(reply_id) if reply_id.present?
check_attachments(attachment_ids) unless attachment_ids.blank?
check_atme_receivers(receivers_login) unless receivers_login.blank?
load_attachments(attachment_ids) unless attachment_ids.blank?
load_atme_receivers(receivers_login) unless receivers_login.blank?
check_attachments(attachment_ids) unless attachment_ids.nil?
check_atme_receivers(receivers_login) unless receivers_login.nil?
load_attachments(attachment_ids) unless attachment_ids.nil?
load_atme_receivers(receivers_login) unless receivers_login.nil?
try_lock("Api::V1::Issues::Journals::CreateService:#{@issue.id}")
@created_journal = @issue.journals.new(journal_attributes)
@ -37,6 +37,7 @@ class Api::V1::Issues::Journals::CreateService < ApplicationService
@created_journal.attachments = @attachments unless attachment_ids.blank?
@created_journal.save!
@issue.save!
# @信息发送
AtmeService.call(current_user, @atme_receivers, @created_journal) unless receivers_login.blank?

View File

@ -20,10 +20,10 @@ class Api::V1::Issues::Journals::UpdateService < ApplicationService
def call
raise Error, errors.full_messages.join(", ") unless valid?
ActiveRecord::Base.transaction do
check_attachments(attachment_ids) unless attachment_ids.blank?
check_atme_receivers(receivers_login) unless receivers_login.blank?
load_attachments(attachment_ids) unless attachment_ids.blank?
load_atme_receivers(receivers_login) unless receivers_login.blank?
check_attachments(attachment_ids) unless attachment_ids.nil?
check_atme_receivers(receivers_login) unless receivers_login.nil?
load_attachments(attachment_ids) unless attachment_ids.nil?
load_atme_receivers(receivers_login) unless receivers_login.nil?
try_lock("Api::V1::Issues::Journals::UpdateService:#{@issue.id}:#{@journal.id}")
@updated_journal = @journal
@ -31,9 +31,10 @@ class Api::V1::Issues::Journals::UpdateService < ApplicationService
build_atme_participants if @atme_receivers.present?
@updated_journal.attachments = @attachments unless attachment_ids.blank?
@updated_journal.attachments = @attachments unless attachment_ids.nil?
@updated_journal.save!
@issue.save!
# @信息发送
AtmeService.call(current_user, @atme_receivers, @created_journal) unless receivers_login.blank?