diff --git a/extdbms/lib/Configs/Route.php b/extdbms/lib/Configs/Route.php
index eca3727..59f5dc7 100644
--- a/extdbms/lib/Configs/Route.php
+++ b/extdbms/lib/Configs/Route.php
@@ -3,14 +3,53 @@
namespace lib\Configs;
use extra;
+use lib\Controllers\DBMS\Client\OnetimeController;
use lib\Controllers\DBMS\Client\MemoController;
use lib\Controllers\DBMS\DashboardController;
use lib\Controllers\DBMS\DefenceController;
use lib\Controllers\DBMS\NavigatorController;
+use lib\Controllers\DBMS\ServerController;
use lib\Controllers\DBMS\ServiceController;
-use lib\Core\Response;
use lib\Core\Router;
+$router->group('dbms/client/dashboard', function (Router $router) {
+ // 동적 파라미터 없이 기본 path에 추가 파라미터를 받아 key/value 형식으로 처리
+ $router->add('GET', 'totalcount', function ($params) {
+ $controller = new \lib\Controllers\DBMS\Client\DashboardController();
+ return $controller->totalcount($params);
+ // Response::view($result);
+ });
+});
+$router->group('dbms/client/memo', function (Router $router) {
+ $router->add('GET', 'update_form', function ($params) {
+ $controller = new MemoController();
+ return $controller->update_form($params);
+ // Response::view($result);
+ });
+ $router->add('POST', 'update', function ($params) {
+ $controller = new MemoController();
+ return $controller->update($params);
+ // Response::view($result);
+ });
+});
+$router->group('dbms/client/onetime', function (Router $router) {
+ $router->add('GET', 'coupon', function ($params) {
+ $controller = new OnetimeController();
+ return $controller->coupon($params);
+ // Response::view($result);
+ });
+ // $router->add('POST', 'buy', function ($params) {
+ // $controller = new OnetimeController();
+ // return $controller->update($params);
+ // // Response::view($result);
+ // });
+ // $router->add('POST', 'use', function ($params) {
+ // $controller = new OnetimeController();
+ // return $controller->update($params);
+ // // Response::view($result);
+ // });
+});
+
// 예제 라우트 그룹: dbms/dashboard/index 이후에 key/value 파라미터 허용
$router->group('dbms/dashboard', function (Router $router) {
// // 동적 파라미터 없이 기본 path에 추가 파라미터를 받아 key/value 형식으로 처리
@@ -80,24 +119,10 @@ $router->group('dbms/service', function (Router $router) {
});
});
-$router->group('dbms/client/dashboard', function (Router $router) {
- // 동적 파라미터 없이 기본 path에 추가 파라미터를 받아 key/value 형식으로 처리
- $router->add('GET', 'totalcount', function ($params) {
- $controller = new \lib\Controllers\DBMS\Client\DashboardController();
- return $controller->totalcount($params);
- // Response::view($result);
- });
-});
-
-$router->group('dbms/client/memo', function (Router $router) {
- $router->add('GET', 'update_form', function ($params) {
- $controller = new MemoController();
- return $controller->update_form($params);
- // Response::view($result);
- });
- $router->add('POST', 'update', function ($params) {
- $controller = new MemoController();
- return $controller->update($params);
+$router->group('dbms/server', function (Router $router) {
+ $router->add('GET', 'use', function ($params) {
+ $controller = new ServerController();
+ return $controller->use($params);
// Response::view($result);
});
});
diff --git a/extdbms/lib/Controllers/DBMS/Client/CouponController.php b/extdbms/lib/Controllers/DBMS/Client/CouponController.php
deleted file mode 100644
index 583de76..0000000
--- a/extdbms/lib/Controllers/DBMS/Client/CouponController.php
+++ /dev/null
@@ -1,19 +0,0 @@
-getView()->setPath('coupon');
- } //
-
- //CLI 접속방법 : php index.php site/counpon
- //WEB 접속방법 : http://localhost/site/coupon
- public function index()
- {
- return $this->render(__FUNCTION__);
- }
-} //Class
diff --git a/extdbms/lib/Controllers/DBMS/Client/OnetimeController.php b/extdbms/lib/Controllers/DBMS/Client/OnetimeController.php
new file mode 100644
index 0000000..a9812e4
--- /dev/null
+++ b/extdbms/lib/Controllers/DBMS/Client/OnetimeController.php
@@ -0,0 +1,47 @@
+getView()->setPath('onetime');
+ } //
+
+ public function getOnetimeService(): OnetimeService
+ {
+ if ($this->_onetimeService === null) {
+ $this->_onetimeService = new OnetimeService();
+ }
+ return $this->_onetimeService;
+ }
+ public function getMemberService(): MemberService
+ {
+ if ($this->_memberService === null) {
+ $this->_memberService = new MemberService();
+ }
+ return $this->_memberService;
+ }
+ //domain_buy_list.php
+ //CLI 접속방법 : php index.php site/counpon
+ //WEB 접속방법 : http://localhost/site/coupon
+ public function coupon()
+ {
+ //쿠폰내역
+ $this->getOnetimeService()->getModel()->whereLike("onetime_case", "domain");
+ $this->getOnetimeService()->getModel()->orderBy("onetime_request_date", "DESC");
+ $this->entities = $this->getOnetimeService()->getEntities();
+ //해당 고객정보
+ $this->clients = $this->getClientService()->getEntities();
+ //전체 관리자정보(등록자)
+ $this->members = $this->getMemberService()->getEntities();
+ return $this->render(__FUNCTION__);
+ }
+} //Class
diff --git a/extdbms/lib/Controllers/DBMS/ServerController.php b/extdbms/lib/Controllers/DBMS/ServerController.php
index 403d6c7..0654ac2 100644
--- a/extdbms/lib/Controllers/DBMS/ServerController.php
+++ b/extdbms/lib/Controllers/DBMS/ServerController.php
@@ -2,11 +2,14 @@
namespace lib\Controllers\DBMS;
+use lib\Entities\GearlistEntity;
+use lib\Services\GearlistService;
use lib\Services\ServerService;
class ServerController extends DBMSController
{
private ?ServerService $_serverService = null;
+ private ?GearlistService $_gearlistService = null;
public function __construct()
{
parent::__construct();
@@ -19,18 +22,58 @@ class ServerController extends DBMSController
}
return $this->_serverService;
}
+ public function getGearlistSrvice(): GearlistService
+ {
+ if ($this->_gearlistService === null) {
+ $this->_gearlistService = new GearlistService();
+ }
+ return $this->_gearlistService;
+ }
- //방어 defense_index.php
- //CLI 접속방법 : php index.php site/defence/mk/zone/존/parent/부모키/child/자식키
- //WEB 접속방법 : http://localhostsite/defence/mk/zone/존/parent/부모키/child/자식키
+ //방어 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()->whereLike("server_cpuname", $cpu, "both");
+ $this->getServerService()->getModel()->whereLike("server_spec", $spec, "both");
+ $entity->all = $this->getServerService()->getCount();
+
+ $this->getServerService()->getModel()->where("server_use_status", "n");
+ $this->getServerService()->getModel()->whereLike("server_cpuname", $cpu, "both");
+ $this->getServerService()->getModel()->whereLike("server_spec", $spec, "both");
+ $entity->use = $this->getServerService()->getCount();
+
+ $this->getServerService()->getModel()->where("server_use_status", "y");
+ $this->getServerService()->getModel()->whereLike("server_cpuname", $cpu, "both");
+ $this->getServerService()->getModel()->whereLike("server_spec", $spec, "both");
+ $entity->empty = $this->getServerService()->getCount();
+
+ $this->getServerService()->getModel()->where("server_use_status", "y");
+ $this->getServerService()->getModel()->whereLike("server_cpuname", $cpu, "both");
+ $this->getServerService()->getModel()->where("server_fomat_date !='NULL'");
+ $entity->format = $this->getServerService()->getCount();
+ return $entity;
+ }
public function use(array $params): string
{
- if (!array_key_exists('zone', $params)) {
- throw new \Exception("zone 값이 정의되지 않았습니다.");
+ $temps = [];
+ $gearlineupEntities = $this->getGearlistSrvice()->getLineUpEntities();
+ foreach ($gearlineupEntities as $idx => $entity) {
+ $entity = $this->use_getGearlistEntity($entity);
}
- $zone = $params['szone'];
- $this->entities = $this->getServerService()->getMKList($zone);
- $this->zone = $zone;
+ $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/Entities/GearlistEntity.php b/extdbms/lib/Entities/GearlistEntity.php
new file mode 100644
index 0000000..eb890fe
--- /dev/null
+++ b/extdbms/lib/Entities/GearlistEntity.php
@@ -0,0 +1,33 @@
+process;
+ } //
+ public function getSpec(): string
+ {
+ return $this->spec;
+ } //
+ public function getCPUName(): string
+ {
+ return $this->cpuname;
+ } //
+ public function getPrice(): string
+ {
+ return $this->price;
+ } //
+} //Class
diff --git a/extdbms/lib/Entities/OnetimeEntity.php b/extdbms/lib/Entities/OnetimeEntity.php
new file mode 100644
index 0000000..992e328
--- /dev/null
+++ b/extdbms/lib/Entities/OnetimeEntity.php
@@ -0,0 +1,50 @@
+service_code;
+ }
+ public function getMemberCode(): string
+ {
+ return $this->onetime_manager;
+ }
+ public function getClientCode(): string
+ {
+ return $this->client_code;
+ }
+ public function getAmount(): string
+ {
+ return $this->onetime_amount;
+ }
+ public function getNonPayment(): string
+ {
+ return $this->onetime_nonpayment;
+ }
+ public function getRequestDate(): string
+ {
+ return $this->onetime_request_date;
+ }
+ public function getPaymentDate(): string
+ {
+ return $this->onetime_payment_date;
+ }
+ public function getNote(): string
+ {
+ return $this->onetime_note;
+ }
+} //Class
diff --git a/extdbms/lib/Entities/ServerEntity.php b/extdbms/lib/Entities/ServerEntity.php
new file mode 100644
index 0000000..0d82401
--- /dev/null
+++ b/extdbms/lib/Entities/ServerEntity.php
@@ -0,0 +1,17 @@
+getClassName();
+ }
+ public function getModelClass(): string
+ {
+ return Model::class;
+ }
+ public function getEntityClass(): string
+ {
+ return Entity::class;
+ }
+
+ public function getLineUpEntities(): 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()->orderBy(["process" => "ASC", "price" => "ASC", "cpuname" => "asc"]);
+ return $this->getEntities();
+ }
+}
diff --git a/extdbms/lib/Services/OnetimeService.php b/extdbms/lib/Services/OnetimeService.php
new file mode 100644
index 0000000..c84ec05
--- /dev/null
+++ b/extdbms/lib/Services/OnetimeService.php
@@ -0,0 +1,41 @@
+getClassName();
+ }
+ public function getModelClass(): string
+ {
+ return Model::class;
+ }
+ public function getEntityClass(): string
+ {
+ return Entity::class;
+ }
+ public function getCountByServiceCode(string $service_code): int
+ {
+ $this->getModel()->where("service_code", $service_code);
+ return $this->getCount();
+ }
+
+ public function getCountByClientCode(string $client_code): int
+ {
+ $this->getModel()->where("client_code", $client_code);
+ return $this->getCount();
+ }
+}
diff --git a/extdbms/lib/Services/ServerService.php b/extdbms/lib/Services/ServerService.php
new file mode 100644
index 0000000..363714e
--- /dev/null
+++ b/extdbms/lib/Services/ServerService.php
@@ -0,0 +1,35 @@
+getClassName();
+ }
+ public function getModelClass(): string
+ {
+ return Model::class;
+ }
+ public function getEntityClass(): string
+ {
+ return Entity::class;
+ }
+ public function getCountByServiceCode(string $service_code): int
+ {
+ $this->getModel()->where("service_code", $service_code);
+ return $this->getCount();
+ }
+}
diff --git a/extdbms/lib/Views/dbms/client/onetime/coupon.php b/extdbms/lib/Views/dbms/client/onetime/coupon.php
new file mode 100644
index 0000000..b2ce551
--- /dev/null
+++ b/extdbms/lib/Views/dbms/client/onetime/coupon.php
@@ -0,0 +1,34 @@
+전체구매건수 : = count($this->entities) ?>
+
+
| 고객명 | +서비스코드 | +수량 | +결제금액 | +미납금액 | +신청일 | +결제일 | +비 고 | +담당자 | +
|---|---|---|---|---|---|---|---|---|
| = $this->clients[$entity->getClientCode()]->getTitle() ?> | += $entity->getServiceCode() ?> | += $entity->getTitle() ?> | += $entity->getAmount() ?> | += $entity->getNonPayment() ?> | += $entity->getRequestDate() ?> | += $entity->getPaymentDate() ?> | += $entity->getNote() ?> | + +