From 51b2a70308f4442ae3830f8509a2279abfb95c9f Mon Sep 17 00:00:00 2001 From: dingguodong Date: Fri, 18 Jun 2021 10:51:31 +0800 Subject: [PATCH] * Create webhook for each products. --- module/gitlab/model.php | 9 ++++++--- module/repo/model.php | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/module/gitlab/model.php b/module/gitlab/model.php index 3e2375e6d1..419a94d231 100644 --- a/module/gitlab/model.php +++ b/module/gitlab/model.php @@ -237,9 +237,12 @@ class gitlabModel extends model */ public function createWebhook($products, $gitlabID, $projectID) { - $webhook = sprintf($this->config->gitlab->zentaoApiWebhookUrl, commonModel::getSysURL(), $gitlabID); - $response = $this->apiCreateHook($gitlabID, $projectID, $webhook, $this->config->gitlab->zentaoApiWebhookToken); - return $response; + foreach($products as $index => $product) + { + $webhook = sprintf($this->config->gitlab->zentaoApiWebhookUrl, commonModel::getSysURL(), $product, $gitlabID, $projectID); + $response = $this->apiCreateHook($gitlabID, $projectID, $webhook, $this->config->gitlab->zentaoApiWebhookToken); + } + return true; } /** diff --git a/module/repo/model.php b/module/repo/model.php index 165533741a..abe3a502af 100644 --- a/module/repo/model.php +++ b/module/repo/model.php @@ -236,7 +236,7 @@ class repoModel extends model // save the relationship between zentao product and gitlab project to zt_relation table. /* create webhook for zentao */ - $this->loadModel("gitlab")->createWebhook($this->post->gitlabHost, $this->post->gitlabProject); + $this->loadModel("gitlab")->createWebhook($this->post->product, $this->post->gitlabHost, $this->post->gitlabProject); }