* Refactor pipline module.
This commit is contained in:
@@ -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,6 +1,6 @@
|
||||
<?php
|
||||
$lang->pipeline->id = 'ID';
|
||||
$lang->pipeline->name = '服务器名称';
|
||||
$lang->pipeline->name = '应用名称';
|
||||
$lang->pipeline->url = '服务器地址';
|
||||
$lang->pipeline->token = 'Token';
|
||||
$lang->pipeline->account = '用户名';
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user