* Adjust codes.

This commit is contained in:
caoyanyi
2022-08-03 13:52:51 +08:00
parent 96d6ca78d7
commit 59a1377e5a
2 changed files with 6 additions and 8 deletions
-2
View File
@@ -126,12 +126,10 @@ class mr extends control
{
$gitlabUsers = $this->loadModel('gitlab')->getGitLabListByAccount();
$giteaUsers = $this->gitea->getGiteaListByAccount();
$gogsUsers = $this->gogs->getGiteaListByAccount();
foreach($hosts as $hostID => $host)
{
if($host->type == 'gitLab' and isset($gitlabUsers[$hostID])) continue;
if($host->type == 'gitea' and isset($giteaUsers[$hostID])) continue;
if($host->type == 'gogs' and isset($gogsUsers[$hostID])) continue;
unset($hosts[$hostID]);
}
+6 -6
View File
@@ -217,10 +217,10 @@ class repoModel extends model
$this->dao->insert(TABLE_REPO)->data($data, $skip = 'serviceToken')
->batchCheck($this->config->repo->create->requiredFields, 'notempty')
->batchCheckIF($data->SCM != 'Gitlab', 'path,client', 'notempty')
->batchCheckIF(in_array($data->SCM, array('Gitea', 'Gogs')), 'serviceHost,serviceProject', 'notempty')
->batchCheckIF($isPipelineServer, 'serviceHost,serviceProject', 'notempty')
->batchCheckIF($data->SCM == 'Subversion', $this->config->repo->svn->requiredFields, 'notempty')
->checkIF(in_array($data->SCM, array('Gitea', 'Gogs')), 'serviceProject', 'unique', "`SCM` = '{$data->SCM}'")
->checkIF(in_array($data->SCM, array('Git', 'Subversion')), 'path', 'unique', "`SCM` = '{$data->SCM}'")
->checkIF($isPipelineServer, 'serviceProject', 'unique', "`SCM` = '{$data->SCM}'")
->checkIF(!$isPipelineServer, 'path', 'unique', "`SCM` = '{$data->SCM}'")
->autoCheck()
->exec();
@@ -291,10 +291,10 @@ class repoModel extends model
$this->dao->update(TABLE_REPO)->data($data, $skip = 'serviceToken')
->batchCheck($this->config->repo->edit->requiredFields, 'notempty')
->batchCheckIF($data->SCM != 'Gitlab', 'path,client', 'notempty')
->batchCheckIF(in_array($data->SCM, array('Gitea', 'Gogs')), 'serviceHost,serviceProject', 'notempty')
->batchCheckIF($isPipelineServer, 'serviceHost,serviceProject', 'notempty')
->batchCheckIF($data->SCM == 'Subversion', $this->config->repo->svn->requiredFields, 'notempty')
->checkIF(in_array($data->SCM, array('Gitea', 'Gogs')), 'serviceProject', 'unique', "`SCM` = '{$data->SCM}' and `id` <> $id")
->checkIF(in_array($data->SCM, array('Git', 'Subversion')), 'path', 'unique', "`SCM` = '{$data->SCM}' and `id` <> $id")
->checkIF($isPipelineServer, 'serviceProject', 'unique', "`SCM` = '{$data->SCM}' and `id` <> $id")
->checkIF(!$isPipelineServer, 'path', 'unique', "`SCM` = '{$data->SCM}' and `id` <> $id")
->autoCheck()
->where('id')->eq($id)->exec();