* Fix bug for instance build error.

This commit is contained in:
caoyanyi
2024-05-13 15:37:09 +08:00
parent 5466149439
commit 8d99c79c00
2 changed files with 5 additions and 7 deletions
+1 -2
View File
@@ -16,11 +16,10 @@ class instanceZen extends instance
* Show instance view.
*
* @param int $id
* @param string $tab
* @access public
* @return void
*/
protected function storeView(int $id, string $tab = 'baseinfo')
protected function storeView(int $id)
{
if(!commonModel::hasPriv('space', 'browse')) $this->loadModel('common')->deny('space', 'browse', false);
+4 -5
View File
@@ -102,8 +102,7 @@ class pipelineModel extends model
*/
public function create(object $server): int|false
{
$type = $server->appType;
$server->type = $type;
$server->type = !empty($server->type) ? $server->type : $server->appType;
unset($server->appType);
$server->url = rtrim($server->url, '/');
@@ -113,9 +112,9 @@ class pipelineModel extends model
->batchCheck($this->config->pipeline->create->requiredFields, 'notempty')
->batchCheck("url", 'URL')
->check('name', 'unique', "`type` = '$type'")
->checkIF($type == 'jenkins', 'account', 'notempty')
->checkIF($type == 'jenkins' && !$server->token, 'password', 'notempty')
->checkIF($type == 'jenkins' && !$server->password, 'token', 'notempty')
->checkIF($server->type == 'jenkins', 'account', 'notempty')
->checkIF($server->type == 'jenkins' && !$server->token, 'password', 'notempty')
->checkIF($server->type == 'jenkins' && !$server->password, 'token', 'notempty')
->autoCheck()
->exec();
if(dao::isError()) return false;