* Add submit task
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* The host entry point of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2022 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
|
||||
* @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
|
||||
* @author Ke Zhao <zhaoke@easycorp.ltd>
|
||||
* @package entries
|
||||
* @version 1
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
class hostSubmitEntry extends baseEntry
|
||||
{
|
||||
/**
|
||||
* Listen host heartbeat.
|
||||
*
|
||||
* @param int|string $userID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function post()
|
||||
{
|
||||
/* Check authorize. */
|
||||
$header = getallheaders();
|
||||
$token = isset($header['Authorization']) ? substr($header['Authorization'], 7) : '';
|
||||
if(!$token) return $this->sendError(401, 'Unauthorized');
|
||||
|
||||
$now = helper::now();
|
||||
|
||||
/* Check param. */
|
||||
$image = new stdclass();
|
||||
$task = $this->requestBody->task;
|
||||
$image->status = $this->requestBody->status;
|
||||
$image->speed = $this->requestBody->speed;
|
||||
$image->rate = $this->requestBody->rate;
|
||||
|
||||
$this->dao = $this->loadModel('common')->dao;
|
||||
$id = $this->dao->select('id')->from(TABLE_ZAHOST)
|
||||
->where('tokenSN')->eq($token)
|
||||
->andWhere('tokenTime')->gt($now)->fi()
|
||||
->fetch('id');
|
||||
if(!$id) return $this->sendError(400, 'Secret error.');
|
||||
|
||||
$this->dao->update(TABLE_IMAGE)->data($image)->where("id")->eq($task)->exec();
|
||||
|
||||
return $this->sendSuccess(200, 'success');
|
||||
}
|
||||
}
|
||||
@@ -162,6 +162,7 @@ $routes['/modules'] = 'modules';
|
||||
$routes['/reports'] = 'reports';
|
||||
|
||||
$routes['/host/heartbeat'] = 'hostHeartbeat';
|
||||
$routes['/host/submitResult'] = 'hostSubmit';
|
||||
|
||||
$routes['/zanode/heartbeat'] = 'zanodeHeartbeat';
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ $lang->zahost->IP = 'Extranet Address';
|
||||
$lang->zahost->extranet = 'Extranet Address';
|
||||
$lang->zahost->cpuCores = 'CPU Cores';
|
||||
$lang->zahost->memory = 'Memory Size';
|
||||
$lang->zahost->diskSize = 'diskSize Size';
|
||||
$lang->zahost->diskSize = 'Disk Size';
|
||||
$lang->zahost->desc = 'Description';
|
||||
$lang->zahost->type = 'Type';
|
||||
$lang->zahost->status = 'Status';
|
||||
|
||||
@@ -20,7 +20,7 @@ $lang->zahost->IP = 'Extranet Address';
|
||||
$lang->zahost->extranet = 'Extranet Address';
|
||||
$lang->zahost->cpuCores = 'CPU Cores';
|
||||
$lang->zahost->memory = 'Memory Size';
|
||||
$lang->zahost->diskSize = 'diskSize Size';
|
||||
$lang->zahost->diskSize = 'Disk Size';
|
||||
$lang->zahost->desc = 'Description';
|
||||
$lang->zahost->type = 'Type';
|
||||
$lang->zahost->status = 'Status';
|
||||
|
||||
@@ -20,7 +20,7 @@ $lang->zahost->IP = 'Extranet Address';
|
||||
$lang->zahost->extranet = 'Extranet Address';
|
||||
$lang->zahost->cpuCores = 'CPU Cores';
|
||||
$lang->zahost->memory = 'Memory Size';
|
||||
$lang->zahost->diskSize = 'diskSize Size';
|
||||
$lang->zahost->diskSize = 'Disk Size';
|
||||
$lang->zahost->desc = 'Description';
|
||||
$lang->zahost->type = 'Type';
|
||||
$lang->zahost->status = 'Status';
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
<td>
|
||||
<div class='input-group'>
|
||||
<?php echo html::input('memory', '', "class='form-control'");?>
|
||||
<span class="input-group-addon" id="memory-addon"><?php echo $lang->zahost->unitList['GB'];?></span>
|
||||
<span class="input-group-addon" id="memory-addon">GB</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -56,7 +56,7 @@
|
||||
<div class='input-group'>
|
||||
<?php echo html::input('diskSize', '', "class='form-control'");?>
|
||||
<span class='input-group-addon fix-border fix-padding' id='unit'>
|
||||
<?php echo $lang->zahost->unitList['GB'];?>
|
||||
GB
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
<td>
|
||||
<div class='input-group'>
|
||||
<?php echo html::input('memory', $host->memory, "class='form-control'");?>
|
||||
<span class="input-group-addon" id="memory-addon"><?php echo $lang->zahost->unitList['GB'];?></span>
|
||||
<span class="input-group-addon" id="memory-addon">GB</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -56,7 +56,7 @@
|
||||
<div class='input-group'>
|
||||
<?php echo html::input('diskSize', $host->diskSize, "class='form-control'");?>
|
||||
<span class='input-group-addon fix-border fix-padding' id='unit'>
|
||||
<?php echo $lang->zahost->unitList['GB'];?>
|
||||
GB
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
#unit {padding: 0px !important; width:0px; border-left: 0px;width:63px;}
|
||||
.input-group-addon {border: 0px; width: 100px;}
|
||||
#memory-addon {width:63px;}
|
||||
@@ -42,7 +42,7 @@
|
||||
<td>
|
||||
<div class='input-group'>
|
||||
<?php echo html::input('memory', '', "class='form-control'");?>
|
||||
<span class="input-group-addon" id="memory-addon"><?php echo $lang->zahost->unitList['GB'];?></span>
|
||||
<span class="input-group-addon" id="memory-addon">GB</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -52,7 +52,7 @@
|
||||
<div class='input-group'>
|
||||
<?php echo html::input('diskSize', '', "class='form-control'");?>
|
||||
<span class='input-group-addon fix-border fix-padding' id='unit'>
|
||||
<?php echo $lang->zahost->unitList['GB'];?>
|
||||
GB
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='w-120px'><?php echo $lang->zanode->name;?></th>
|
||||
<td class='p-25f'><?php echo html::input('name', $zanode->name, "class='form-control' placeholder=\"{$lang->zanode->nameValid}\"");?></td>
|
||||
<td class='p-25f'><?php echo html::input('name', $zanode->name, "class='form-control' placeholder=\"{$lang->zanode->nameValid}\" readonly='readonly'");?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -42,7 +42,7 @@
|
||||
<td>
|
||||
<div class='input-group'>
|
||||
<?php echo html::input('memory', $zanode->memory, "class='form-control' readonly='readonly'");?>
|
||||
<span class="input-group-addon" id="memory-addon"><?php echo $lang->zahost->unitList['GB'];?></span>
|
||||
<span class="input-group-addon" id="memory-addon">GB</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -52,7 +52,7 @@
|
||||
<div class='input-group'>
|
||||
<?php echo html::input('diskSize', $zanode->diskSize, "class='form-control' readonly='readonly'");?>
|
||||
<span class='input-group-addon fix-border fix-padding' id='unit'>
|
||||
<?php echo $lang->zahost->unitList['GB'];?>
|
||||
GB
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user