This commit is contained in:
David.li
2021-06-08 13:31:44 +08:00
parent 08567f098a
commit 42eb835fa3
6 changed files with 35 additions and 32 deletions
+1 -1
View File
@@ -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_PIPLINE', '`' . $config->db->prefix . 'jenkins`');
define('TABLE_PIPLINE', '`' . $config->db->prefix . 'pipline`');
define('TABLE_JOB', '`' . $config->db->prefix . 'job`');
define('TABLE_COMPILE', '`' . $config->db->prefix . 'compile`');
+2 -2
View File
@@ -2,5 +2,5 @@
$config->gitlab->create = new stdclass();
$config->gitlab->edit = new stdclass();
$config->gitlab->create->requiredFields = 'name,url';
$config->gitlab->edit->requiredFields = 'name,url';
$config->gitlab->create->requiredFields = 'name,url,token';
$config->gitlab->edit->requiredFields = 'name,url,token';
+4 -2
View File
@@ -72,7 +72,9 @@ class gitlab extends control
*/
public function bind()
{
echo 123;die;
var_dump($this->gitlab->getPermissionsByToken('http://127.0.0.1:8090/','rpz2PZKriNE6TD34QtDA'));
die;
$this->display();
}
@@ -113,7 +115,7 @@ class gitlab extends control
{
if($confim != 'yes') die(js::confirm($this->lang->gitlab->confirmDelete, inlink('delete', "id=$id&confirm=yes")));
$this->gitlab->delete(TABLE_GITLAB, $id);
$this->gitlab->delete(TABLE_PIPLINE, $id);
die(js::reload('parent'));
}
+20 -19
View File
@@ -1,24 +1,25 @@
$(function () {
$('#token, #url').change(function () {
//取用户名
var uid = $("#uid").val();
$('#url,#token').change(function () {
$('#url, #url').change(function () {
host = Base64.encode($('#url').val());
token = $('#token').val();
url = createLink('gitlab', 'ajaxCheckToken', "host=" + host + '&token=' + token);
if (host == '' || token == '') return false;
$.get(url, function (response) {
if(response.message == '401 Unauthorized')
{
$('td.demand').each(function() {
var dl = $(this).text();
// change the td html to the link, referencing the DL-XXX number
$(this).html('<a href="order.php?dl=' + dl + '">' + dl + '</a>');
});
}else if (response.message == '403 Forbidden'){
}else {
//调ajax
$.ajax({
url: "uidchuli.php",
data: {u: uid},
type: "POST",
dataType: "TEXT",
success: function (data) {
if (data > 0) {
$("#ts").html("该应户名已存在");
$("#ts").css("color", "red");
} else {
$("#ts").html("该应户名可用");
$("#ts").css("color", "green");
}
}
});
});
})
});
});
+7 -7
View File
@@ -21,7 +21,7 @@ class gitlabModel extends model
*/
public function getByID($id)
{
$gitlab = $this->dao->select('*')->from(TABLE_JENKINS)->where('id')->eq($id)->fetch();
$gitlab = $this->dao->select('*')->from(TABLE_PIPLINE)->where('id')->eq($id)->fetch();
$gitlab->password = base64_decode($gitlab->password);
return $gitlab;
@@ -37,7 +37,7 @@ class gitlabModel extends model
*/
public function getList($orderBy = 'id_desc', $pager = null)
{
return $this->dao->select('*')->from(TABLE_JENKINS)
return $this->dao->select('*')->from(TABLE_PIPLINE)
->where('deleted')->eq('0')
->andwhere('type')->eq('1')
->orderBy($orderBy)
@@ -52,7 +52,7 @@ class gitlabModel extends model
*/
public function getPairs()
{
$gitlab = $this->dao->select('id,name')->from(TABLE_JENKINS)
$gitlab = $this->dao->select('id,name')->from(TABLE_PIPLINE)
->where('deleted')->eq('0')
->orderBy('id')->fetchPairs('id', 'name');
$gitlab = array('' => '') + $gitlab;
@@ -74,9 +74,9 @@ class gitlabModel extends model
->skipSpecial('url,token')
->get();
$this->dao->insert(TABLE_JENKINS)->data($gitlab)
$this->dao->insert(TABLE_PIPLINE)->data($gitlab)
->batchCheck($this->config->gitlab->create->requiredFields, 'notempty')
->batchCheck("url", 'URL')
->autoCheck()
->exec();
if(dao::isError()) return false;
@@ -98,7 +98,7 @@ class gitlabModel extends model
->skipSpecial('url,token')
->get();
$this->dao->update(TABLE_JENKINS)->data($gitlab)
$this->dao->update(TABLE_PIPLINE)->data($gitlab)
->batchCheck($this->config->gitlab->edit->requiredFields, 'notempty')
->batchCheck("url", 'URL')
->autoCheck()
@@ -118,7 +118,7 @@ class gitlabModel extends model
public function getPermissionsByToken($host, $token)
{
$host = rtrim($host, '/');
$host .= '/api/v4/activities';
$host .= '/api/v4/user/activities';
$results = json_decode(file_get_contents($host . "?private_token=$token"));
+1 -1
View File
@@ -32,7 +32,7 @@
<tr>
<th><?php echo $lang->gitlab->token;?></th>
<td><?php echo html::input('token', '', "class='form-control'");?></td>
<td><?php echo $lang->gitlab->tokenFirst;?></td>
<td>Store Pickup Store Pickup</td>
</tr>
<tr>
<th></th>