* finish task #6939.

This commit is contained in:
wangyidong
2020-03-04 18:21:46 +08:00
parent a6169ffec5
commit 718373cc06
10 changed files with 229 additions and 295 deletions
+31 -31
View File
@@ -11,6 +11,18 @@
*/
class compileModel extends model
{
/**
* Get by id
*
* @param int $buildID
* @access public
* @return object
*/
public function getByID($buildID)
{
return $this->dao->select('*')->from(TABLE_COMPILE)->where('id')->eq($buildID)->fetch();
}
/**
* Get build list.
*
@@ -34,18 +46,6 @@ class compileModel extends model
->fetchAll('id');
}
/**
* Get by id
*
* @param int $buildID
* @access public
* @return object
*/
public function getByID($buildID)
{
return $this->dao->select('*')->from(TABLE_COMPILE)->where('id')->eq($buildID)->fetch();
}
/**
* Get unexecuted list.
*
@@ -57,6 +57,25 @@ class compileModel extends model
return $this->dao->select('*')->from(TABLE_COMPILE)->where('status')->eq('')->andWhere('deleted')->eq('0')->fetchAll();
}
/**
* Get build url.
*
* @param object $jenkins
* @access public
* @return string
*/
public function getBuildUrl($jenkins)
{
$jenkinsServer = $jenkins->url;
$jenkinsUser = $jenkins->account;
$jenkinsPassword = $jenkins->token ? $jenkins->token : base64_decode($jenkins->password);
$jenkinsAuth = '://' . $jenkinsUser . ':' . $jenkinsPassword . '@';
$jenkinsServer = str_replace('://', $jenkinsAuth, $jenkinsServer);
$buildUrl = sprintf('%s/job/%s/buildWithParameters/api/json', $jenkinsServer, $jenkins->jkJob);
return $buildUrl;
}
/**
* Save build by integration
*
@@ -112,23 +131,4 @@ class compileModel extends model
return !dao::isError();
}
/**
* Get build url.
*
* @param object $jenkins
* @access public
* @return string
*/
public function getBuildUrl($jenkins)
{
$jenkinsServer = $jenkins->url;
$jenkinsUser = $jenkins->account;
$jenkinsPassword = $jenkins->token ? $jenkins->token : base64_decode($jenkins->password);
$jenkinsAuth = '://' . $jenkinsUser . ':' . $jenkinsPassword . '@';
$jenkinsServer = str_replace('://', $jenkinsAuth, $jenkinsServer);
$buildUrl = sprintf('%s/job/%s/buildWithParameters/api/json', $jenkinsServer, $jenkins->jkJob);
return $buildUrl;
}
}