From cbbd62121c93680b64760c6530a07f81718ffcc0 Mon Sep 17 00:00:00 2001 From: yystopf Date: Fri, 17 Nov 2023 15:28:29 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=9B=B4=E6=94=B9=EF=BC=9A=E6=89=B9?= =?UTF-8?q?=E9=87=8F=E5=88=A0=E9=99=A4=E6=95=B0=E7=BB=84=E4=B8=BA=E7=A9=BA?= =?UTF-8?q?=E6=97=B6=E8=BF=94=E5=9B=9E=E6=AD=A3=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/api/pm/issues_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/api/pm/issues_controller.rb b/app/controllers/api/pm/issues_controller.rb index 74cd1c144..0af8e60cc 100644 --- a/app/controllers/api/pm/issues_controller.rb +++ b/app/controllers/api/pm/issues_controller.rb @@ -64,6 +64,7 @@ class Api::Pm::IssuesController < Api::Pm::BaseController end def batch_destroy + return render_ok if params[:ids].is_a?(Array) && params[:ids].blank? @object_result = Api::V1::Issues::BatchDeleteService.call(@project, @issues, current_user) if @object_result render_ok From fbad9859e639d9f329b93ea012ff28e275c720d3 Mon Sep 17 00:00:00 2001 From: yystopf Date: Fri, 17 Nov 2023 15:29:19 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E5=B7=A5=E4=BD=9C=E9=A1=B9=E5=90=8C=E6=97=B6=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E5=AD=90=E5=B7=A5=E4=BD=9C=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/api/v1/issues/delete_service.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/services/api/v1/issues/delete_service.rb b/app/services/api/v1/issues/delete_service.rb index 952f6a404..7210c0eb7 100644 --- a/app/services/api/v1/issues/delete_service.rb +++ b/app/services/api/v1/issues/delete_service.rb @@ -15,6 +15,8 @@ class Api::V1::Issues::DeleteService < ApplicationService raise Error, errors.full_messages.join(", ") unless valid? try_lock("Api::V1::Issues::DeleteService:#{project.id}") # 开始写数据,加锁 + delete_be_linkable_issues + delete_issue project.incre_project_issue_cache_delete_count @@ -38,4 +40,10 @@ class Api::V1::Issues::DeleteService < ApplicationService raise Error, "删除疑修失败!" unless issue.destroy! end + def delete_be_linkable_issues + pmlink_ids = PmLink.where(linkable: issue).pluck(:be_linkable_id) + linkable_issues = Issue.where(id: pmlink_ids) + raise Error, "删除疑修关联项失败!" unless linkable_issues.destroy_all + end + end \ No newline at end of file