* Call pipeline model in gitlab model.
This commit is contained in:
@@ -179,7 +179,7 @@ define('TABLE_LOG', '`' . $config->db->prefix . 'log`');
|
||||
define('TABLE_SCORE', '`' . $config->db->prefix . 'score`');
|
||||
define('TABLE_NOTIFY', '`' . $config->db->prefix . 'notify`');
|
||||
define('TABLE_OAUTH', '`' . $config->db->prefix . 'oauth`');
|
||||
define('TABLE_PIPELINE', '`' . $config->db->prefix . 'jenkins`');
|
||||
define('TABLE_PIPELINE', '`' . $config->db->prefix . 'pipeline`');
|
||||
define('TABLE_JOB', '`' . $config->db->prefix . 'job`');
|
||||
define('TABLE_COMPILE', '`' . $config->db->prefix . 'compile`');
|
||||
|
||||
|
||||
+5
-44
@@ -21,10 +21,7 @@ class gitlabModel extends model
|
||||
*/
|
||||
public function getByID($id)
|
||||
{
|
||||
$gitlab = $this->dao->select('*')->from(TABLE_PIPELINE)->where('id')->eq($id)->fetch();
|
||||
$gitlab->password = base64_decode($gitlab->password);
|
||||
|
||||
return $gitlab;
|
||||
return $this->loadModel('pipeline')->getByID($id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -37,12 +34,7 @@ class gitlabModel extends model
|
||||
*/
|
||||
public function getList($orderBy = 'id_desc', $pager = null)
|
||||
{
|
||||
return $this->dao->select('*')->from(TABLE_PIPELINE)
|
||||
->where('deleted')->eq('0')
|
||||
->andwhere('type')->eq('1')
|
||||
->orderBy($orderBy)
|
||||
->page($pager)
|
||||
->fetchAll('id');
|
||||
return $this->loadModel('pipeline')->getList('gitlab', $orderBy, $pager);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -52,11 +44,7 @@ class gitlabModel extends model
|
||||
*/
|
||||
public function getPairs()
|
||||
{
|
||||
$gitlab = $this->dao->select('id,name')->from(TABLE_PIPELINE)
|
||||
->where('deleted')->eq('0')
|
||||
->orderBy('id')->fetchPairs('id', 'name');
|
||||
$gitlab = array('' => '') + $gitlab;
|
||||
return $gitlab;
|
||||
return $this->loadModel('pipeline')->getPairs('gitlab');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -67,20 +55,7 @@ class gitlabModel extends model
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$gitlab = fixer::input('post')
|
||||
->add('createdBy', $this->app->user->account)
|
||||
->add('createdDate', helper::now())
|
||||
->add('type', 1)
|
||||
->skipSpecial('url,token')
|
||||
->get();
|
||||
|
||||
$this->dao->insert(TABLE_PIPELINE)->data($gitlab)
|
||||
->batchCheck($this->config->gitlab->create->requiredFields, 'notempty')
|
||||
->batchCheck("url", 'URL')
|
||||
->autoCheck()
|
||||
->exec();
|
||||
if(dao::isError()) return false;
|
||||
return $this->dao->lastInsertId();
|
||||
return $this->loadModel('pipeline')->create('gitlab');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,19 +67,7 @@ class gitlabModel extends model
|
||||
*/
|
||||
public function update($id)
|
||||
{
|
||||
$gitlab = fixer::input('post')
|
||||
->add('editedBy', $this->app->user->account)
|
||||
->add('editedDate', helper::now())
|
||||
->skipSpecial('url,token')
|
||||
->get();
|
||||
|
||||
$this->dao->update(TABLE_PIPELINE)->data($gitlab)
|
||||
->batchCheck($this->config->gitlab->edit->requiredFields, 'notempty')
|
||||
->batchCheck("url", 'URL')
|
||||
->autoCheck()
|
||||
->where('id')->eq($id)
|
||||
->exec();
|
||||
return !dao::isError();
|
||||
return $this->loadModel('pipeline')->update($id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -119,10 +82,8 @@ class gitlabModel extends model
|
||||
{
|
||||
$host = rtrim($host, '/');
|
||||
$host .= '/api/v4/activities';
|
||||
|
||||
$results = json_decode(file_get_contents($host . "?private_token=$token"));
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ class jenkinsModel extends model
|
||||
*/
|
||||
public function getByID($id)
|
||||
{
|
||||
return $this->loadModel('pipline')->getByID($id);
|
||||
return $this->loadModel('pipeline')->getByID($id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -34,7 +34,7 @@ class jenkinsModel extends model
|
||||
*/
|
||||
public function getList($orderBy = 'id_desc', $pager = null)
|
||||
{
|
||||
return $this->loadModel('pipline')->getList('jenkins', $orderBy, $pager);
|
||||
return $this->loadModel('pipeline')->getList('jenkins', $orderBy, $pager);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -44,7 +44,7 @@ class jenkinsModel extends model
|
||||
*/
|
||||
public function getPairs()
|
||||
{
|
||||
return $this->loadModel('pipline')->getPairs('jenkins');
|
||||
return $this->loadModel('pipeline')->getPairs('jenkins');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -83,7 +83,7 @@ class jenkinsModel extends model
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return $this->loadModel('pipline')->create('jenkins');
|
||||
return $this->loadModel('pipeline')->create('jenkins');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -95,6 +95,6 @@ class jenkinsModel extends model
|
||||
*/
|
||||
public function update($id)
|
||||
{
|
||||
return $this->loadModel('pipline')->update($id);
|
||||
return $this->loadModel('pipeline')->update($id);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user