diff --git a/extdbms/lib/Configs/Route.php b/extdbms/lib/Configs/Route.php index aca7fc2..fa5f974 100644 --- a/extdbms/lib/Configs/Route.php +++ b/extdbms/lib/Configs/Route.php @@ -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); + }); +}); diff --git a/extdbms/lib/Controllers/DBMS/GearlistController.php b/extdbms/lib/Controllers/DBMS/GearlistController.php index 42d38fd..ed9c0c2 100644 --- a/extdbms/lib/Controllers/DBMS/GearlistController.php +++ b/extdbms/lib/Controllers/DBMS/GearlistController.php @@ -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 { diff --git a/extdbms/lib/Controllers/DBMS/ServerController.php b/extdbms/lib/Controllers/DBMS/ServerController.php index f8577ba..0242261 100644 --- a/extdbms/lib/Controllers/DBMS/ServerController.php +++ b/extdbms/lib/Controllers/DBMS/ServerController.php @@ -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 diff --git a/extdbms/lib/Views/dbms/gearlist/index.php b/extdbms/lib/Views/dbms/gearlist/index.php index eda85f8..2dbf1d6 100644 --- a/extdbms/lib/Views/dbms/gearlist/index.php +++ b/extdbms/lib/Views/dbms/gearlist/index.php @@ -32,5 +32,4 @@ - -