dbms_primeidc_init...1

This commit is contained in:
최준흠 2025-04-11 16:36:04 +09:00
parent 4685f9c928
commit 0316778c78
4 changed files with 39 additions and 2 deletions

View File

@ -163,3 +163,12 @@ $router->group('dbms/gearlist', function (Router $router) {
// Response::view($result);
});
});
$router->group('dbms/server', function (Router $router) {
$router->add('GET', 'index', function ($params) {
$controller = new ServerController();
return $controller->index($params);
// Response::view($result);
});
});

View File

@ -5,6 +5,7 @@ namespace lib\Controllers\DBMS;
use lib\Entities\GearlistEntity;
use lib\Services\GearlistService;
use lib\Services\ServerService;
use lib\Utils\Pagination;
class GearlistController extends DBMSController
{

View File

@ -19,4 +19,32 @@ class ServerController extends DBMSController
}
return $this->_serverService;
}
//가용장비 현황 server_use.php
//CLI 접속방법 : php index.php site/server/use
//WEB 접속방법 : http://localhost site/server/use
private function setMode(GearlistEntity $entity): GearlistEntity
{
$lineup_explode = explode('.', $entity->getSpec());
$spec = $lineup_explode[0];
$cpu = $entity->getCPUName();
$entity->all = $this->getServerService()->getCountByMode("all", $cpu, $spec);
$entity->use = $this->getServerService()->getCountByMode("use", $cpu, $spec);
$entity->empty = $this->getServerService()->getCountByMode("empty", $cpu, $spec);
$entity->format = $this->getServerService()->getCountByMode("format", $cpu, $spec);
return $entity;
}
public function index(array $params): string
{
$gearlistEntities = $this->getGearlistService()->getEntitiesForLineUp();
//DB에 넣지않는 이유가 뭘까? DB에 넣으면 관리가 힘들어서?
$gearlistEntities[] = new GearlistEntity(['process' => "INTEL i5(구세대)", 'spec' => "i5-2.xx", "cpuname" => "i5-2", 'price' => "23"]);
$gearlistEntities[] = new GearlistEntity(['process' => "INTEL i7(구세대)", 'spec' => "i7-2.xx", "cpuname" => "i7-2", 'price' => "45"]);
$gearlistEntities[] = new GearlistEntity(['process' => "INTEL i7(4세대)", 'spec' => "i7-4.xx", "cpuname" => "i7-4", 'price' => "45"]);
$entities = [];
foreach ($gearlistEntities as $idx => $gearlistEntity) {
$entities[] = $this->setMode($gearlistEntity);
}
$this->entities = $entities;
return $this->render(__FUNCTION__);
}
} //Class

View File

@ -32,5 +32,4 @@
</tr>
<?php } ?>
</tbody>
</table>
<div align='center'><?= $this->pagination->render(DBMS_SITE_URL . "/usableServerList.ser", ['curPage' => $this->curPage, 'perPage' => $this->perPage]) ?></div>
</table>