From 4fb2003f64303aa1825b0cfb83d206e9134d203f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cxxq250=E2=80=9D?= <“xxq250@qq.com”> Date: Thu, 4 Aug 2022 16:50:01 +0800 Subject: [PATCH] =?UTF-8?q?fixed=20reposyncer=20=E5=88=86=E6=94=AF?= =?UTF-8?q?=E7=BB=84=E5=90=88=E5=B7=B2=E9=85=8D=E7=BD=AE=EF=BC=8C=E4=B8=8D?= =?UTF-8?q?=E8=83=BD=E9=87=8D=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/ob_repository_syncs_controller.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/controllers/ob_repository_syncs_controller.rb b/app/controllers/ob_repository_syncs_controller.rb index d48cf1499..344a58355 100644 --- a/app/controllers/ob_repository_syncs_controller.rb +++ b/app/controllers/ob_repository_syncs_controller.rb @@ -48,6 +48,13 @@ class ObRepositorySyncsController < ApplicationController end def create_jobs + tip_exception "必须配置一个分支" if params[:github_branch].blank? && params[:gitee_branch].blank? && params[:gitlink_branch].blank? + ob_jobs = ObRepositorySyncJob.where(ob_repository_sync_id: @ob_repository_sync.id) + ob_jobs.where(job_type: params[:job_type]) if params[:job_type].present? + ob_jobs.where(github_branch: params[:github_branch]) if params[:github_branch].present? + ob_jobs.where(gitee_branch: params[:gitee_branch]) if params[:gitee_branch].present? + ob_jobs.where(gitlink_branch: params[:gitlink_branch]) if params[:gitlink_branch].present? + tip_exception "该分支组合已配置,不能重复!" if ob_jobs.count > 0 service = ObRepositorySync::ApiService.new(@ob_repository_sync.name) res = service.create_projects_jobs(params) tip_exception "保存失败: #{res["msg"]}" if res["code"].to_s != "200"