diff --git a/extdbms/lib/Configs/Constant.php b/extdbms/lib/Configs/Constant.php
index 81065bf..b7e29f0 100644
--- a/extdbms/lib/Configs/Constant.php
+++ b/extdbms/lib/Configs/Constant.php
@@ -76,3 +76,51 @@ define('DBMS_SERVICE_LINE', [
'vpn' => 'VPN',
'event' => '이벤트',
]);
+define('DBMS_GEARLIST_PROCESS_TYPES', [
+ '',
+ 'COLOCATION',
+ 'XEON Single',
+ 'CUSTOM',
+ 'INS-일회성',
+ 'NEHALEM',
+ 'Cisco Router',
+]);
+define('DBMS_GEARLIST_CPU_TYPES', [
+ '',
+ 'X6-Q',
+ 'C2800',
+ 'C2600',
+ 'COL',
+ 'CUS',
+ 'NX227',
+ 'NX20',
+ 'NX21',
+ 'DQ28',
+ 'DQ26',
+ 'DQ31',
+ 'DQ18',
+ 'DQ23',
+ 'DQ20',
+ 'DX34',
+ 'DX38',
+ 'DX28',
+ 'DX32',
+ 'DX36',
+ 'DX30',
+ 'MD32',
+ 'MD30',
+ 'Q16R',
+ 'Q316',
+ 'Q310',
+ 'Q283',
+ 'Q266',
+ 'Q25R',
+ 'Q213',
+ 'Q20R',
+ 'Q186',
+ 'Q24',
+ 'Q20',
+ 'Q240',
+ 'DX3',
+ 'DQ233'
+]);
diff --git a/extdbms/lib/Configs/Route.php b/extdbms/lib/Configs/Route.php
index 564a96a..716d29f 100644
--- a/extdbms/lib/Configs/Route.php
+++ b/extdbms/lib/Configs/Route.php
@@ -8,6 +8,7 @@ use lib\Controllers\DBMS\Client\OnetimeController;
use lib\Controllers\DBMS\Client\PaymentController;
use lib\Controllers\DBMS\DashboardController;
use lib\Controllers\DBMS\DefenceController;
+use lib\Controllers\DBMS\GearlistController;
use lib\Controllers\DBMS\NavigatorController;
use lib\Controllers\DBMS\ServerController;
use lib\Controllers\DBMS\ServiceController;
@@ -150,10 +151,10 @@ $router->group('dbms/service', function (Router $router) {
});
});
-$router->group('dbms/server', function (Router $router) {
- $router->add('GET', 'use', function ($params) {
- $controller = new ServerController();
- return $controller->use($params);
+$router->group('dbms/gearlist', function (Router $router) {
+ $router->add('GET', 'index', function ($params) {
+ $controller = new GearlistController();
+ return $controller->index($params);
// Response::view($result);
});
});
diff --git a/extdbms/lib/Controllers/DBMS/Client/PaymentController.php b/extdbms/lib/Controllers/DBMS/Client/PaymentController.php
index 26d954f..123b140 100644
--- a/extdbms/lib/Controllers/DBMS/Client/PaymentController.php
+++ b/extdbms/lib/Controllers/DBMS/Client/PaymentController.php
@@ -73,7 +73,7 @@ class PaymentController extends ClientController
$this->mode = $mode;
$this->curPage = intval($params['curPage'] ?? $this->request->get('curPage') ?? 1);
$this->perPage = intval($params['perPage'] ?? $this->request->get('perPage') ?? VIEW_LIST_PERPAGE);
- [$this->total, $this->entities] = $this->getServiceService()->getNonPaymentEntitiesByMode($this->curPage, $this->perPage, $mode, $exclude_clients);
+ [$this->total, $this->entities] = $this->getServiceService()->getEntitiesForNonPayment($this->curPage, $this->perPage, $mode, $exclude_clients);
$this->pagination = new Pagination($this->total, (int)$this->curPage, (int)$this->perPage);
return $this->render(path: __FUNCTION__);
}
diff --git a/extdbms/lib/Controllers/DBMS/GearlistController.php b/extdbms/lib/Controllers/DBMS/GearlistController.php
new file mode 100644
index 0000000..5451a42
--- /dev/null
+++ b/extdbms/lib/Controllers/DBMS/GearlistController.php
@@ -0,0 +1,55 @@
+getView()->setPath('gearlist');
+ } //
+ public function getGearlistService(): GearlistService
+ {
+ if ($this->_serverService === null) {
+ $this->_serverService = new GearlistService();
+ }
+ 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->getGearlistService()->getCountByMode("all", $cpu, $spec);
+ $entity->use = $this->getGearlistService()->getCountByMode("use", $cpu, $spec);
+ $entity->empty = $this->getGearlistService()->getCountByMode("empty", $cpu, $spec);
+ $entity->format = $this->getGearlistService()->getCountByMode("format", $cpu, $spec);
+ return $entity;
+ }
+ public function index(array $params): string
+ {
+ $entities = $this->getGearlistService()->getEntitiesForLineUp();
+ foreach ($entities as $idx => $entity) {
+ $entity = $this->setMode($entity);
+ }
+ $oldGearlists = [
+ ['process' => "INTEL i5(구세대)", 'spec' => "i5-2.xx", "cpuname" => "i5-2", 'price' => "23"],
+ ['process' => "INTEL i7(구세대)", 'spec' => "i7-2.xx", "cpuname" => "i7-2", 'price' => "45"],
+ ['process' => "INTEL i7(4세대)", 'spec' => "i7-4.xx", "cpuname" => "i7-4", 'price' => "45"],
+ ];
+ foreach ($oldGearlists as $oldGearlist) {
+ $entities[] = $this->setMode(new GearlistEntity($oldGearlist));
+ }
+ $this->entities = $entities;
+ return $this->render(__FUNCTION__);
+ }
+} //Class
diff --git a/extdbms/lib/Controllers/DBMS/NavigatorController.php b/extdbms/lib/Controllers/DBMS/NavigatorController.php
index de622ac..10ea7f1 100644
--- a/extdbms/lib/Controllers/DBMS/NavigatorController.php
+++ b/extdbms/lib/Controllers/DBMS/NavigatorController.php
@@ -2,8 +2,9 @@
namespace lib\Controllers\DBMS;
-use lib\Services\ClientService;
use lib\Helpers\ServiceHelper;
+use lib\Services\ClientService;
+use lib\Utils\Pagination;
class NavigatorController extends DBMSController
{
@@ -28,22 +29,18 @@ class NavigatorController extends DBMSController
//WEB 접속방법 : http://localhost/site/navigator/ipsearch
public function ipsearch(array $params): string
{
- $ip = array_key_exists('ip', $params) ? $params['ip'] : null;
+ $ip = array_key_exists('ip', $params) ?? null;
+ if (!$ip) {
+ $ip = $this->request->get('ip') ?? null;
+ }
//전체 고객정보
$this->clients = $this->getClientService()->getEntities();
//IP형식이 ipv4인지 확인 후 값가져오기
- $services = [];
- if ($ip && $this->helper->isIPAddress($ip)) {
- $this->getServiceService()->getModel()->where('service_ip', $ip);
- $services[] = $this->getServiceService()->getEntity();
- } elseif ($ip) {
- $this->getServiceService()->getModel()->like('service_ip', $ip);
- $services = $this->getServiceService()->getEntities();
- } else {
- $services = $this->getServiceService()->getEntities();
- }
+ $this->curPage = intval($params['curPage'] ?? $this->request->get('curPage') ?? 1);
+ $this->perPage = intval($params['perPage'] ?? $this->request->get('perPage') ?? VIEW_LIST_PERPAGE);
+ [$this->total, $this->entities] = $this->getServiceService()->getEntitiesForIpSearch($this->curPage, $this->perPage, $ip, $this->helper->isIPAddress($ip));
$this->ip = $ip;
- $this->services = $services;
+ $this->pagination = new Pagination($this->total, (int)$this->curPage, (int)$this->perPage);
return $this->render(__FUNCTION__);
}
} //Class
diff --git a/extdbms/lib/Controllers/DBMS/ServerController.php b/extdbms/lib/Controllers/DBMS/ServerController.php
index 2f01bed..1252a18 100644
--- a/extdbms/lib/Controllers/DBMS/ServerController.php
+++ b/extdbms/lib/Controllers/DBMS/ServerController.php
@@ -2,14 +2,12 @@
namespace lib\Controllers\DBMS;
-use lib\Entities\GearlistEntity;
-use lib\Services\GearlistService;
+use lib\Entities\ServerEntity;
use lib\Services\ServerService;
class ServerController extends DBMSController
{
private ?ServerService $_serverService = null;
- private ?GearlistService $_gearlistService = null;
public function __construct()
{
parent::__construct();
@@ -22,55 +20,4 @@ class ServerController extends DBMSController
}
return $this->_serverService;
}
- public function getGearlistSrvice(): GearlistService
- {
- if ($this->_gearlistService === null) {
- $this->_gearlistService = new GearlistService();
- }
- return $this->_gearlistService;
- }
-
- //방어 server_use.php
- //CLI 접속방법 : php index.php site/server/use
- //WEB 접속방법 : http://localhost site/server/use
- private function use_getGearlistEntity(GearlistEntity $entity): GearlistEntity
- {
- $lineup_explode = explode('.', $entity->getSpec());
- $spec = $lineup_explode[0];
- $cpu = $entity->getCPUName();
- $this->getServerService()->getModel()->like(["server_cpuname" => "%$cpu%", "server_spec" => "%$spec%"]);
- $entity->all = $this->getServerService()->getCount();
-
- $this->getServerService()->getModel()->where("server_use_status", "n");
- $this->getServerService()->getModel()->like(["server_cpuname" => "%$cpu%", "server_spec" => "%$spec%"]);
- $entity->use = $this->getServerService()->getCount();
-
- $this->getServerService()->getModel()->where("server_use_status", "y");
- $this->getServerService()->getModel()->like(["server_cpuname" => "%$cpu%", "server_spec" => "%$spec%"]);
- $entity->empty = $this->getServerService()->getCount();
-
- $this->getServerService()->getModel()->where("server_use_status", "y");
- $this->getServerService()->getModel()->where("server_fomat_date !='NULL'");
- $this->getServerService()->getModel()->like(["server_cpuname" => "%$cpu%"]);
- $entity->format = $this->getServerService()->getCount();
- return $entity;
- }
- public function use(array $params): string
- {
- $temps = [];
- $gearlineupEntities = $this->getGearlistSrvice()->getLineUpEntities();
- foreach ($gearlineupEntities as $idx => $entity) {
- $entity = $this->use_getGearlistEntity($entity);
- }
- $oldServers = [
- ['process' => "INTEL i5(구세대)", 'spec' => "i5-2.xx", "cpuname" => "i5-2", 'price' => "23"],
- ['process' => "INTEL i7(구세대)", 'spec' => "i7-2.xx", "cpuname" => "i7-2", 'price' => "45"],
- ['process' => "INTEL i7(4세대)", 'spec' => "i7-4.xx", "cpuname" => "i7-4", 'price' => "45"],
- ];
- foreach ($oldServers as $oldServer) {
- $temps[] = $this->use_getGearlistEntity(new GearlistEntity($oldServer));
- }
- $this->gearlineupEntities = $temps;
- return $this->render(__FUNCTION__);
- }
} //Class
diff --git a/extdbms/lib/Controllers/DBMS/ServiceController.php b/extdbms/lib/Controllers/DBMS/ServiceController.php
index f9ba244..7a1fc34 100644
--- a/extdbms/lib/Controllers/DBMS/ServiceController.php
+++ b/extdbms/lib/Controllers/DBMS/ServiceController.php
@@ -2,8 +2,9 @@
namespace lib\Controllers\DBMS;
-use lib\Services\ClientService;
use lib\Services\AddDbService;
+use lib\Services\ClientService;
+use lib\Utils\Pagination;
class ServiceController extends DBMSController
{
@@ -42,20 +43,21 @@ class ServiceController extends DBMSController
$adddb_code = urldecode($params['adddb_code']);
//해당 부가서비스의 services_code 목록 가져오기
//segment의 값이 한글인경우 urldecode가 필요
+ $addDbEntities = $this->$this->getAddDbService()->getEntitiesByCode($adddb_code);
$service_codes = [];
- $this->getAddDbService()->getModel()->where('addDB_code', $adddb_code);
- $entitys = $this->getAddDbService()->getEntities();
- foreach ($entitys as $entity) {
+ foreach ($addDbEntities as $entity) {
$service_codes[] = $entity->getServiceCode();
}
if (!count($service_codes)) {
throw new \Exception("[{$adddb_code}] 값에 해당하는 부가서비스정보가 존재하지 않습니다.");
}
- //부가서비스용 서비스목록 가져오기
- $this->getServiceService()->getModel()->whereIn('service_code', $service_codes);
- $this->services = $this->getServiceService()->getEntities();
//전체 사용자정보
$this->clients = $this->getClientService()->getEntities();
+ //부가서비스용 서비스목록 가져오기
+ $this->curPage = intval($params['curPage'] ?? $this->request->get('curPage') ?? 1);
+ $this->perPage = intval($params['perPage'] ?? $this->request->get('perPage') ?? VIEW_LIST_PERPAGE);
+ [$this->total, $this->entities] = $this->getServiceService()->getEntitiesForExtra($this->curPage, $this->perPage, $service_codes);
+ $this->pagination = new Pagination($this->total, (int)$this->curPage, (int)$this->perPage);
return $this->render(__FUNCTION__);
}
} //Class
diff --git a/extdbms/lib/Services/AddDbService.php b/extdbms/lib/Services/AddDbService.php
index b16e00a..55c414d 100644
--- a/extdbms/lib/Services/AddDbService.php
+++ b/extdbms/lib/Services/AddDbService.php
@@ -32,4 +32,9 @@ class AddDbService extends CommonService
$this->getModel()->where('addDB_code', $key);
return $this->getEntity();
}
+ public function getEntitiesByCode(string $key): array
+ {
+ $this->getModel()->where('addDB_code', $key);
+ return $this->getEntities();
+ }
}
diff --git a/extdbms/lib/Services/GearlistService.php b/extdbms/lib/Services/GearlistService.php
index f332352..8948013 100644
--- a/extdbms/lib/Services/GearlistService.php
+++ b/extdbms/lib/Services/GearlistService.php
@@ -28,57 +28,36 @@ class GearlistService extends CommonService
return Entity::class;
}
- public function getLineUpEntities(): array
+ public function getEntitiesForLineUp(): array
{
- $this->getModel()->whereNotIn("process", [
- '',
- 'COLOCATION',
- 'XEON Single',
- 'CUSTOM',
- 'INS-일회성',
- 'NEHALEM',
- 'Cisco Router',
- ]);
- $this->getModel()->whereNotIn("cpuname", [
- '',
- 'X6-Q',
- 'C2800',
- 'C2600',
- 'COL',
- 'CUS',
- 'NX227',
- 'NX20',
- 'NX21',
- 'DQ28',
- 'DQ26',
- 'DQ31',
- 'DQ18',
- 'DQ23',
- 'DQ20',
- 'DX34',
- 'DX38',
- 'DX28',
- 'DX32',
- 'DX36',
- 'DX30',
- 'MD32',
- 'MD30',
- 'Q16R',
- 'Q316',
- 'Q310',
- 'Q283',
- 'Q266',
- 'Q25R',
- 'Q213',
- 'Q20R',
- 'Q186',
- 'Q24',
- 'Q20',
- 'Q240',
- 'DX3',
- 'DQ233'
- ]);
+ $this->getModel()->whereNotIn("process", DBMS_GEARLIST_PROCESS_TYPES);
+ $this->getModel()->whereNotIn("cpuname", DBMS_GEARLIST_CPU_TYPES);
$this->getModel()->orderBy(["process" => "ASC", "price" => "ASC", "cpuname" => "asc"]);
return $this->getEntities();
}
+
+ public function getCountByMode(string $mode, string $cpu, ?string $spec = null): int
+ {
+ switch ($mode) {
+ case 'all':
+ $this->getModel()->like(["server_cpuname" => "%$cpu%", "server_spec" => "%$spec%"]);
+ break;
+ case 'use':
+ $this->getModel()->where("server_use_status", "n");
+ $this->getModel()->like(["server_cpuname" => "%$cpu%", "server_spec" => "%$spec%"]);
+ break;
+ case 'empty':
+ $this->getModel()->where("server_use_status", "y");
+ $this->getModel()->like(["server_cpuname" => "%$cpu%", "server_spec" => "%$spec%"]);
+ break;
+ case 'format':
+ $this->getModel()->where("server_use_status", "y");
+ $this->getModel()->where("server_fomat_date !='NULL'");
+ $this->getModel()->like(["server_cpuname" => "%$cpu%"]);
+ break;
+ default:
+ throw new \InvalidArgumentException("Invalid mode: $mode");
+ }
+ return $this->getCount();
+ }
}
diff --git a/extdbms/lib/Services/ServiceService.php b/extdbms/lib/Services/ServiceService.php
index 622c36f..6982206 100644
--- a/extdbms/lib/Services/ServiceService.php
+++ b/extdbms/lib/Services/ServiceService.php
@@ -36,6 +36,7 @@ class ServiceService extends CommonService
$this->getModel()->where('service_code', $key);
return $this->getEntity();
}
+
//사용자별 서비스리스트트
public function getEntitiesByClient(int $curPage, int $perPage, string $client_code): array
{
@@ -51,7 +52,7 @@ class ServiceService extends CommonService
}
//미지급금 리스트
- public function getNonPaymentEntitiesByMode(int $curPage, int $perPage, string $mode, array $exclude_clients): array
+ public function getEntitiesForNonPayment(int $curPage, int $perPage, string $mode, array $exclude_clients): array
{
switch ($mode) {
case 'today':
@@ -88,6 +89,36 @@ class ServiceService extends CommonService
return [$total, $this->getEntities()];
}
+ //미지급금 리스트
+ public function getEntitiesForIpSearch(int $curPage, int $perPage, ?string $ip = null, $isIPV4 = true): array
+ {
+ if ($ip && $isIPV4) {
+ $this->getModel()->where('service_ip', $ip);
+ } elseif ($ip) {
+ $this->getModel()->like('service_ip', $ip);
+ }
+ //Query문 Rest여부 -> 같은조건에 Count 받고, 결과값을 받고 싶을때는 continue()
+ $this->getModel()->setContinue(true);
+ $total = $this->getCount();
+ //limit, offset 설정
+ $this->getModel()->limit($perPage);
+ $this->getModel()->offset(($curPage - 1) * $perPage);
+ return [$total, $this->getEntities()];
+ }
+
+ //부가서비스스
+ public function getEntitiesForExtra(int $curPage, int $perPage, array $service_codes): array
+ {
+ $this->getModel()->whereIn('service_code', $service_codes);
+ //Query문 Rest여부 -> 같은조건에 Count 받고, 결과값을 받고 싶을때는 continue()
+ $this->getModel()->setContinue(true);
+ $total = $this->getCount();
+ //limit, offset 설정
+ $this->getModel()->limit($perPage);
+ $this->getModel()->offset(($curPage - 1) * $perPage);
+ return [$total, $this->getEntities()];
+ }
+
//최근 $day일간 신규서비스 카운트
public function getLatestCount(int $day, array $excepts): int|string
{
diff --git a/extdbms/lib/Views/dbms/server/use.php b/extdbms/lib/Views/dbms/gearlist/index.php
similarity index 68%
rename from extdbms/lib/Views/dbms/server/use.php
rename to extdbms/lib/Views/dbms/gearlist/index.php
index c50feeb..eda85f8 100644
--- a/extdbms/lib/Views/dbms/server/use.php
+++ b/extdbms/lib/Views/dbms/gearlist/index.php
@@ -1,12 +1,4 @@
-* CPU 명칭 :
-싱글 코어 = 1개 코어 /
-듀얼 코어 = 2개 코어 /
-트리플 코어 = 3개 코어 /
-쿼드 코어(Q) = 4개 코어 /
-헥사 코어(H) = 6개 코어 /
-옥타 코어(O) = 8개 코어 /
-도데카(D) = 12개 코어 /
-헥사데시멀 코어 = 16개코어
+* CPU 명칭 : 싱글 코어 = 1개 코어 / 듀얼 코어 = 2개 코어 / 트리플 코어 = 3개 코어 / 쿼드 코어(Q) = 4개 코어 / 헥사 코어(H) = 6개 코어 / 옥타 코어(O) = 8개 코어 / 도데카(D) = 12개 코어 / 헥사데시멀 코어 = 16개코어
* 도쿄 회선 + 1U상면비 : 60만원 (50+10) / 치바 회선 + 1U상면비 : 40만원 (30+10)
* HDD : 1단위당 일회성 10만원 / 메모리 : 2G당 1회성 5만원 / 방어서비스 : CS방어 40만원 , BL상시 60만원 , CS-Pre상시 300만원 , CF방어 도메인당 40만원 , 인증방어 사이트당 80만원(+유동CS4개 기본)
| = $entity->getProcess() ?> | @@ -40,16 +32,5 @@|||||||
| 합계 | -- | - | - | - | - | - | - |