* Refactor pipline module.

This commit is contained in:
zhaoke
2023-08-02 14:13:31 +08:00
parent 4c881641b4
commit 74a180193e
3 changed files with 6 additions and 13 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
$lang->pipeline->id = 'ID';
$lang->pipeline->name = 'Server Name';
$lang->pipeline->name = 'Application Name';
$lang->pipeline->url = 'Server URL';
$lang->pipeline->token = 'Token';
$lang->pipeline->account = 'Username';
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
$lang->pipeline->id = 'ID';
$lang->pipeline->name = '服务器名称';
$lang->pipeline->name = '应用名称';
$lang->pipeline->url = '服务器地址';
$lang->pipeline->token = 'Token';
$lang->pipeline->account = '用户名';
+4 -11
View File
@@ -42,7 +42,7 @@ class pipelineModel extends model
{
return $this->dao->select('*')->from(TABLE_PIPELINE)
->where('deleted')->eq('0')
->AndWhere('type')->in($type)
->beginIF($type)->AndWhere('type')->in($type)->fi()
->orderBy($orderBy)
->page($pager)
->fetchAll('id');
@@ -69,16 +69,9 @@ class pipelineModel extends model
* @access public
* @return bool
*/
public function create($type)
public function create(object $pipeline): int|false
{
$pipeline = fixer::input('post')
->add('type', $type)
->add('private',md5(rand(10,113450)))
->add('createdBy', $this->app->user->account)
->add('createdDate', helper::now())
->trim('url,token,account,password')
->skipSpecial('url,token,account,password')
->get();
$type = $pipeline->type;
if($type == 'gitlab') $pipeline->url = rtrim($pipeline->url, '/');
if(isset($pipeline->password)) $pipeline->password = base64_encode($pipeline->password);
@@ -160,7 +153,7 @@ class pipelineModel extends model
if($job) return false;
}
$this->dao->update(TABLE_PIPELINE)->set('deleted')->eq(1)->where('id')->eq($id)->exec();
$this->loadModel('action')->create($object, $id, 'deleted', '', ACTIONMODEL::CAN_UNDELETED);
$this->loadModel('action')->create($object, $id, 'deleted', '');
$actionID = $this->dao->lastInsertID();
return $actionID;