From 97240a5fe51a4b46417ad5adcf055bdddf8174e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=A4=80=ED=9D=A0?= Date: Tue, 1 Apr 2025 15:24:53 +0900 Subject: [PATCH] dbsms_primeidc init...1 --- extdbms/index.php | 12 +- extdbms/lib/Configs/App.php | 13 -- extdbms/lib/Configs/Route.php | 35 +++++ extdbms/lib/Controllers/ClientController.php | 23 ---- extdbms/lib/Controllers/CommonController.php | 2 +- extdbms/lib/Controllers/HomeController.php | 15 +++ extdbms/lib/Controllers/SiteController.php | 56 +++++--- extdbms/lib/Core/App.php | 78 ----------- extdbms/lib/Core/Model.php | 3 - extdbms/lib/Core/Route.php | 132 +++++++++++++++++++ extdbms/lib/Entities/AddDbEntity.php | 5 +- extdbms/lib/Entities/ClientEntity.php | 9 +- extdbms/lib/Entities/CommonEntity.php | 15 ++- extdbms/lib/Entities/HistoryEntity.php | 13 +- extdbms/lib/Entities/KCSEntity.php | 5 +- extdbms/lib/Entities/MemberEntity.php | 10 +- extdbms/lib/Entities/ServiceEntity.php | 11 +- extdbms/lib/Entities/VPCEntity.php | 5 +- extdbms/lib/Models/AddDbModel.php | 35 +---- extdbms/lib/Models/ClientModel.php | 33 +---- extdbms/lib/Models/CommonModel.php | 36 ++++- extdbms/lib/Models/HistoryModel.php | 33 +---- extdbms/lib/Models/KCSModel.php | 33 +---- extdbms/lib/Models/MemberModel.php | 33 +---- extdbms/lib/Models/ServiceModel.php | 33 +---- extdbms/lib/Models/VPCModel.php | 33 +---- extdbms/lib/Services/ClientService.php | 2 +- extdbms/lib/View/newhistorys.php | 22 ++++ 28 files changed, 375 insertions(+), 360 deletions(-) delete mode 100644 extdbms/lib/Configs/App.php create mode 100644 extdbms/lib/Configs/Route.php delete mode 100644 extdbms/lib/Controllers/ClientController.php create mode 100644 extdbms/lib/Controllers/HomeController.php delete mode 100644 extdbms/lib/Core/App.php create mode 100644 extdbms/lib/Core/Route.php create mode 100644 extdbms/lib/View/newhistorys.php diff --git a/extdbms/index.php b/extdbms/index.php index 27cc3e2..ae19312 100644 --- a/extdbms/index.php +++ b/extdbms/index.php @@ -1,12 +1,10 @@ load(); @@ -14,10 +12,8 @@ try { // 요청된 URL 경로 가져오기 $url = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : false; $url = !$url && isset($argv[1]) ? $argv[1] : false; - $app = new App(trim($url, '/')); - $controller = $app->getController(); - $method = $app->getMethod(); - return $controller->$method(); + $route = new Route(trim($url, '/')); + return $route->run(); } catch (\Exception $e) { echo $e->getMessage(); } diff --git a/extdbms/lib/Configs/App.php b/extdbms/lib/Configs/App.php deleted file mode 100644 index 9e9c9aa..0000000 --- a/extdbms/lib/Configs/App.php +++ /dev/null @@ -1,13 +0,0 @@ -view->siteinfo = $this->getSiteInfo(); - $this->getClientModel()->where(["Client_Code" => $datas['client_code']]); - $entity = $this->getClientModel()->getEntity(); - if (!$entity) { - throw new \Exception($datas['client_code'] . "에 해당하는 고객이 존재하지 않습니다."); - } - $this->view->client = $entity; - return $this->render('depositbillpaper'); - } -} diff --git a/extdbms/lib/Controllers/CommonController.php b/extdbms/lib/Controllers/CommonController.php index 657fe4b..511ada7 100644 --- a/extdbms/lib/Controllers/CommonController.php +++ b/extdbms/lib/Controllers/CommonController.php @@ -6,7 +6,7 @@ use lib\Core\Controller as Core; use lib\Models\ClientModel; use lib\Models\ServiceModel; -abstract class CommonController extends Core +class CommonController extends Core { protected function __construct() { diff --git a/extdbms/lib/Controllers/HomeController.php b/extdbms/lib/Controllers/HomeController.php new file mode 100644 index 0000000..d0c40ec --- /dev/null +++ b/extdbms/lib/Controllers/HomeController.php @@ -0,0 +1,15 @@ +getSegments('sitekey'); if ($sitekey === null) { - throw new \Exception("sitekey 값이 정의되지 않았습니다."); + $sitekey = $this->getSegments('sitekey'); + if ($sitekey === null) { + throw new \Exception("sitekey 값이 정의되지 않았습니다."); + } } + $this->siteInfo = $this->getConfig()->getSiteInfo($sitekey); - if ($this->siteInfo === null) { + if (!$this->siteInfo) { throw new \Exception("[{$sitekey}] 값에 해당하는 사이트정보가 존재하지 않습니다."); } $this->totalcount = $this->getService()->getTotalCount($this->siteInfo); @@ -138,10 +141,10 @@ class SiteController extends CommonController //신규서버현황 new_server_list.php //CLI 접속방법 : php index.php SiteController/newservices/limit/5 //WEB 접속방법 : http://localhost/SiteController/newservices/limit/5 - public function newservices(): string + public function newservices(mixed $limit = 5): string { //신규서버정보 - $this->limit = intval($this->getSegments('limit') ?? 5); + $this->limit = intval($limit); $this->entitys = $this->getService()->getNews($this->limit); // echo $this->getService()->getModel()->getLastQuery(); // 배열 초기화를 명시적으로 수행 @@ -172,10 +175,10 @@ class SiteController extends CommonController } //CLI 접속방법 : php index.php SiteController/newhistorys/limit/5 //WEB 접속방법 : http://localhost/SiteController/newhistorys/limit/5 - public function newhistorys(): string + public function newhistorys(mixed $limit = 5): string { //신규서버정보 - $this->limit = intval($this->getSegments('limit') ?? 5); + $this->limit = intval($limit); $this->entitys = $this->getHistoryService()->getNews($this->limit); // 배열 초기화를 명시적으로 수행 $services = []; @@ -186,7 +189,7 @@ class SiteController extends CommonController $service = $this->getService()->getServiceByServiceCode($entity->getServiceCode()); if ($service) { //고객정보 - $clients[$pk] = $this->getClientService()->getEntitByCode($entity->getClientCode()); + $clients[$pk] = $this->getClientService()->getEntitByCode($service->getClientCode()); //서비스정보 $services[$pk] = $service; } @@ -199,32 +202,47 @@ class SiteController extends CommonController //청구서페이지, depositbillpaper.php //CLI 접속방법 : php index.php SiteController/billpaper/sitekey/dbms.prime-idc.jp/client_code/코드번호 //WEB 접속방법 : http://localhost/SiteController/billpaper/sitekey/dbms.prime-idc.jp/client_code/코드번호 - public function billpaper(): string + public function billpaper(mixed $sitekey = null, mixed $client_code = null): string { - $sitekey = $this->getSegments('sitekey'); if ($sitekey === null) { - throw new \Exception("sitekey 값이 정의되지 않았습니다."); + $sitekey = $this->getSegments('sitekey'); + if ($sitekey === null) { + throw new \Exception("sitekey 값이 정의되지 않았습니다."); + } } - $client_code = $this->getSegments('client_code'); if ($client_code === null) { - throw new \Exception("client_code 값이 정의되지 않았습니다."); + $client_code = $this->getSegments('client_code'); + if ($client_code === null) { + throw new \Exception("client_code 값이 정의되지 않았습니다."); + } } $this->siteInfo = $this->getConfig()->getSiteInfo($sitekey); + if (!$this->siteInfo) { + throw new \Exception("[{$sitekey}] 값에 해당하는 사이트정보가 존재하지 않습니다."); + } $this->client = $this->getClientService()->getEntitByCode($client_code); + if (!$this->client) { + throw new \Exception("[{$client_code}] 값에 해당하는 고객정보가 존재하지 않습니다."); + } return $this->render(__FUNCTION__); } //부가서비스 : 닷디펜더,딥파인더 등, deepfinder_list.php,dotdefender_list.php //CLI 접속방법 : php index.php SiteController/extraservice/client_code/코드번호 //WEB 접속방법 : http://localhost/SiteController/extraservice/sitekey/dbms.prime-idc.jp/client_code/코드번호 - public function extraservice(): string + public function extraservice(mixed $addb_code = null,): string { - $addb_code = $this->getSegments('addb_code'); if ($addb_code === null) { - throw new \Exception("addb_code 값이 정의되지 않았습니다."); + $addb_code = $this->getSegments('addb_code'); + if ($addb_code === null) { + throw new \Exception("addb_code 값이 정의되지 않았습니다."); + } } //segment의 값이 한글인경우 urldecode가 필요 $adddb_code = urldecode($addb_code); $service_codes = $this->getAddDbService()->getServiceCodesByCode($adddb_code); + if (!count($service_codes)) { + throw new \Exception("[{$adddb_code}] 값에 해당하는 부가서비스정보가 존재하지 않습니다."); + } $this->services = $this->getService()->getExtras($service_codes); return $this->render(__FUNCTION__); } diff --git a/extdbms/lib/Core/App.php b/extdbms/lib/Core/App.php deleted file mode 100644 index 855fb11..0000000 --- a/extdbms/lib/Core/App.php +++ /dev/null @@ -1,78 +0,0 @@ -_controller = new $control(); - } - //Method추출 - if (isset($arguments[1])) { - $route = ""; - switch ($arguments[1]) { - case 'service': - $route = "newservices"; - break; - case 'history': - $route = "newhistorys"; - break; - default: - $route = $arguments[1]; - break; - } - $this->_method = $route; - } - //세그먼트 추출 - $segments = []; - if (count($arguments) > 2) { - $isKey = true; - $key = ""; - foreach (array_slice($arguments, 2) as $argument) { - if ($isKey) { - $segments[$argument] = null; - $key = $argument; - $isKey = false; //Value값을 넣어야하므로 - } else { - $segments[$key] = $argument; - $isKey = true; //Key로 설정해야하므로 - } - } - } - $this->_controller->setSegments($segments); - } // - - final public function getController(): Controller - { - if ($this->_controller === null) { - throw new \Exception("Method 사용법 : 'http://test.com/Control/Method/arg1/arg2' 혹은 php index.php Control/Method/arg1/arg2"); - } - return $this->_controller; - } - final public function getMethod(): string - { - if ($this->_method === null) { - throw new \Exception("Method 사용법 : 'http://test.com/Control/Method/arg1/arg2' 혹은 php index.php Control/Method/arg1/arg2"); - } - return $this->_method; - } -} //Class diff --git a/extdbms/lib/Core/Model.php b/extdbms/lib/Core/Model.php index f488b32..f0b76eb 100644 --- a/extdbms/lib/Core/Model.php +++ b/extdbms/lib/Core/Model.php @@ -3,7 +3,6 @@ namespace lib\Core; use \PDO; -use lib\Core\Entity; use PDOException; use PDOStatement; @@ -20,8 +19,6 @@ abstract class Model abstract public function getTable(): string; abstract public function getPKField(): string; abstract public function getTitleField(): string; - abstract public function getEntity(): Entity; - abstract public function getEntitys(): mixed; final public function getConnect(): PDO { if ($this->_db === null) { diff --git a/extdbms/lib/Core/Route.php b/extdbms/lib/Core/Route.php new file mode 100644 index 0000000..147421d --- /dev/null +++ b/extdbms/lib/Core/Route.php @@ -0,0 +1,132 @@ +_url = $url; + $this->init(); + } + final public function getURL(): string + { + return $this->_url; + } + private function init(): void + { + $path = parse_url($this->getURL(), PHP_URL_PATH); + $arguments = explode('/', trim($path, '/')); + + // 컨트롤러와 메서드를 설정 + $this->setController($arguments); + $this->setMethod($arguments); + + // 남은 세그먼트를 파라미터로 설정 + $this->setSegments($arguments); + } + final protected function getController(): Controller + { + return $this->_controller; + } + + protected function routeController(string $route): string + { + return $route; + } + private function setController(array &$segments): void + { + $route = $segments[0] ? $segments[0] : 'HomeController'; + // echo $route; + // exit; + $controller = "lib\\Controllers\\" . ucfirst($this->routeController($route)); + if (class_exists($controller)) { + $this->_controller = new $controller(); + } else { + throw new \Exception("[{$controller}] 해당 Controller를 찾을수 없습니다."); + } + array_shift($segments); + } + final protected function getMethod(): string + { + return $this->_method; + } + protected function routeMethod(string $route): string + { + return $route; + } + final protected function setMethod(array &$segments): void + { + //$segments[0]인이유는 setController에서 $segments를 array_shift했기때문 + $route = count($segments) ? $segments[0] : 'index'; + // echo $route; + // exit; + $this->_method = strtolower($this->routeMethod($route)); + array_shift($segments); + } + + final public function getSegments(): array + { + return $this->_segments; + } + final protected function setSegments(array &$segments): void + { + // 세그먼트 배열을 key/value 쌍으로 변환 + $params = []; + for ($i = 0; $i < count($segments); $i += 2) { + if (isset($segments[$i + 1])) { + $params[$segments[$i]] = $segments[$i + 1]; + } + } + $this->_segments = $params; + } + final public function run(): mixed + { + $controller = $this->getController(); + $method = $this->getMethod(); + + if (!method_exists($controller, $method)) { + throw new \Exception("해당 함수[{$method}]를 " . get_class($this->_controller) . "에서 찾을수 없습니다."); + } + + // 컨트롤러에 세그먼트 전달 + $controller->setSegments($this->getSegments()); + + // 키/값 형태로 세그먼트 처리 + $params = []; + $segments = $this->getSegments(); + + // 메서드의 매개변수 정보 가져오기 + $reflectionMethod = new \ReflectionMethod($controller, $method); + $parameters = $reflectionMethod->getParameters(); + + if (count($parameters) > 0) { + // 매개변수가 존재하면 URL 세그먼트를 순서대로 매개변수에 매핑 + foreach ($parameters as $i => $param) { + // 매개변수 이름을 가져와서 세그먼트에서 값을 찾기 + $paramName = $param->getName(); + if (isset($segments[$paramName])) { + $params[] = $segments[$paramName]; + } else if (isset($segments[$i])) { + $params[] = $segments[$i]; + } else if ($param->isDefaultValueAvailable()) { + $params[] = $param->getDefaultValue(); + } else { + $params[] = null; + } + } + } else { + // 매개변수가 없으면 빈 배열 전달 + $params = []; + } + + return call_user_func_array([$controller, $method], $params); + } +} diff --git a/extdbms/lib/Entities/AddDbEntity.php b/extdbms/lib/Entities/AddDbEntity.php index 07e7b06..ac448f4 100644 --- a/extdbms/lib/Entities/AddDbEntity.php +++ b/extdbms/lib/Entities/AddDbEntity.php @@ -2,10 +2,13 @@ namespace lib\Entities; -use lib\Core\Entity; +use lib\Entities\CommonEntity as Entity; +use lib\Models\AddDbModel as Model; class AddDbEntity extends Entity { + const PKField = Model::PKField; + const TitleField = Model::TitleField; public function __construct($datas) { parent::__construct($datas); diff --git a/extdbms/lib/Entities/ClientEntity.php b/extdbms/lib/Entities/ClientEntity.php index d5dfaa2..4b8674f 100644 --- a/extdbms/lib/Entities/ClientEntity.php +++ b/extdbms/lib/Entities/ClientEntity.php @@ -2,16 +2,15 @@ namespace lib\Entities; -use lib\Core\Entity; +use lib\Entities\CommonEntity as Entity; +use lib\Models\ClientModel as Model; class ClientEntity extends Entity { + const PKField = Model::PKField; + const TitleField = Model::TitleField; public function __construct($datas) { parent::__construct($datas); } // - public function getTitle() - { - $this->Client_Name; - } } //Class diff --git a/extdbms/lib/Entities/CommonEntity.php b/extdbms/lib/Entities/CommonEntity.php index c5a3dbe..3419c2b 100644 --- a/extdbms/lib/Entities/CommonEntity.php +++ b/extdbms/lib/Entities/CommonEntity.php @@ -1,15 +1,22 @@ service_code; + } + public function getClientName(): string + { + return $this->client_name; + } } //Class diff --git a/extdbms/lib/Entities/KCSEntity.php b/extdbms/lib/Entities/KCSEntity.php index 88d6bd1..317b963 100644 --- a/extdbms/lib/Entities/KCSEntity.php +++ b/extdbms/lib/Entities/KCSEntity.php @@ -2,10 +2,13 @@ namespace lib\Entities; -use lib\Core\Entity; +use lib\Entities\CommonEntity as Entity; +use lib\Models\KCSModel as Model; class KCSEntity extends Entity { + const PKField = Model::PKField; + const TitleField = Model::TitleField; public function __construct($datas) { parent::__construct($datas); diff --git a/extdbms/lib/Entities/MemberEntity.php b/extdbms/lib/Entities/MemberEntity.php index 4c9caef..29a4927 100644 --- a/extdbms/lib/Entities/MemberEntity.php +++ b/extdbms/lib/Entities/MemberEntity.php @@ -2,19 +2,17 @@ namespace lib\Entities; -use lib\Core\Entity; +use lib\Entities\CommonEntity as Entity; +use lib\Models\MemberModel as Model; class MemberEntity extends Entity { + const PKField = Model::PKField; + const TitleField = Model::TitleField; public function __construct($datas) { parent::__construct($datas); } // - public function getTitle(): string - { - return $this->getName(); - } - //공통부분 public function getId(): string { return $this->id; diff --git a/extdbms/lib/Entities/ServiceEntity.php b/extdbms/lib/Entities/ServiceEntity.php index 4b1b758..4307688 100644 --- a/extdbms/lib/Entities/ServiceEntity.php +++ b/extdbms/lib/Entities/ServiceEntity.php @@ -2,24 +2,27 @@ namespace lib\Entities; -use lib\Core\Entity; +use lib\Entities\CommonEntity as Entity; +use lib\Models\ServiceModel as Model; class ServiceEntity extends Entity { + const PKField = Model::PKField; + const TitleField = Model::TitleField; public function __construct($datas) { parent::__construct($datas); } // - public function getServiceCode(): mixed + public function getServiceCode(): string { return $this->service_code; } - public function getMemberCode(): mixed + public function getMemberCode(): string { return $this->service_manager; } - public function getClientCode(): mixed + public function getClientCode(): string { return $this->client_code; } diff --git a/extdbms/lib/Entities/VPCEntity.php b/extdbms/lib/Entities/VPCEntity.php index d27d549..4b46988 100644 --- a/extdbms/lib/Entities/VPCEntity.php +++ b/extdbms/lib/Entities/VPCEntity.php @@ -2,10 +2,13 @@ namespace lib\Entities; -use lib\Core\Entity; +use lib\Entities\CommonEntity as Entity; +use lib\Models\VPCModel as Model; class VPCEntity extends Entity { + const PKField = Model::PKField; + const TitleField = Model::TitleField; public function __construct($datas) { parent::__construct($datas); diff --git a/extdbms/lib/Models/AddDbModel.php b/extdbms/lib/Models/AddDbModel.php index a642e88..4f371a1 100644 --- a/extdbms/lib/Models/AddDbModel.php +++ b/extdbms/lib/Models/AddDbModel.php @@ -2,41 +2,20 @@ namespace lib\Models; -use lib\Entities\AdddbEntity as Entity; +use lib\Entities\AddDbEntity as Entity; +use lib\Models\CommonModel as Model; -class AddDbModel extends CommonModel +class AddDbModel extends Model { const TABLE = "adddb"; - const PK = "addDB_num"; - const TITLE = "addDB_case"; + const PKField = "addDB_num"; + const TitleField = "addDB_case"; public function __construct() { parent::__construct(); } // - - final public function getTable(): string + public function getEntityClass(): string { - return self::TABLE; + return Entity::class; } - final public function getPKField(): string - { - return self::PK; - } - final public function getTitleField(): string - { - return self::TITLE; - } - - final public function getEntity(): Entity - { - return new Entity($this->getResult()); - } // - final public function getEntitys(): array - { - $entitys = []; - foreach ($this->getResults() as $row) { - $entitys[] = new Entity($row); - } - return $entitys; - } // } //Class diff --git a/extdbms/lib/Models/ClientModel.php b/extdbms/lib/Models/ClientModel.php index eede908..04db295 100644 --- a/extdbms/lib/Models/ClientModel.php +++ b/extdbms/lib/Models/ClientModel.php @@ -3,40 +3,19 @@ namespace lib\Models; use lib\Entities\ClientEntity as Entity; +use lib\Models\CommonModel as Model; -class ClientModel extends CommonModel +class ClientModel extends Model { const TABLE = "clientdb"; - const PK = "Client_Num"; - const TITLE = "Client_Name"; + const PKField = "Client_Num"; + const TitleField = "Client_Name"; public function __construct() { parent::__construct(); } // - - final public function getTable(): string + public function getEntityClass(): string { - return self::TABLE; + return Entity::class; } - final public function getPKField(): string - { - return self::PK; - } - final public function getTitleField(): string - { - return self::TITLE; - } - - final public function getEntity(): Entity - { - return new Entity($this->getResult()); - } // - final public function getEntitys(): array - { - $entitys = []; - foreach ($this->getResults() as $result) { - $entitys[] = new Entity($result); - } - return $entitys; - } // } //Class diff --git a/extdbms/lib/Models/CommonModel.php b/extdbms/lib/Models/CommonModel.php index f3ea1c6..48e18b4 100644 --- a/extdbms/lib/Models/CommonModel.php +++ b/extdbms/lib/Models/CommonModel.php @@ -3,7 +3,6 @@ namespace lib\Models; use lib\Core\Model as Core; -use lib\Entity\Entity; abstract class CommonModel extends Core { @@ -11,4 +10,39 @@ abstract class CommonModel extends Core { parent::__construct(); } // + abstract public function getEntityClass(): string; + + // self:: → 컴파일 타임에 결정되므로 BaseModel의 상수를 참조하게 됨. + // static:: → 실행 타임에 결정되므로 상속받은 클래스의 상수를 참조함. + final public function getTable(): string + { + return constant("static::TABLE"); + } + final public function getPKField(): string + { + return constant("static::PKField"); + } + final public function getTitleField(): string + { + return constant("static::TitleField"); + } + public function getEntity(mixed $result = null): mixed + { + if (!$result) { + $result = $this->getResult(); + if (!$result) { //결과값이 없으면 null + return $result; + } + } + $entityClass = $this->getEntityClass(); + return new $entityClass($result); + } + public function getEntitys(): array + { + $entitys = []; + foreach ($this->getResults() as $result) { + $entitys[] = $this->getEntity($result); + } + return $entitys; + } // } //Class diff --git a/extdbms/lib/Models/HistoryModel.php b/extdbms/lib/Models/HistoryModel.php index e64fc9d..5e8aaa4 100644 --- a/extdbms/lib/Models/HistoryModel.php +++ b/extdbms/lib/Models/HistoryModel.php @@ -3,40 +3,19 @@ namespace lib\Models; use lib\Entities\HistoryEntity as Entity; +use lib\Models\CommonModel as Model; -class HistoryModel extends CommonModel +class HistoryModel extends Model { const TABLE = "historydb"; - const PK = "history_num"; - const TITLE = "behavior"; + const PKField = "history_num"; + const TitleField = "behavior"; public function __construct() { parent::__construct(); } // - - final public function getTable(): string + public function getEntityClass(): string { - return self::TABLE; + return Entity::class; } - final public function getPKField(): string - { - return self::PK; - } - final public function getTitleField(): string - { - return self::TITLE; - } - - final public function getEntity(): Entity - { - return new Entity($this->getResult()); - } // - final public function getEntitys(): array - { - $entitys = []; - foreach ($this->getResults() as $result) { - $entitys[] = new Entity($result); - } - return $entitys; - } // } //Class diff --git a/extdbms/lib/Models/KCSModel.php b/extdbms/lib/Models/KCSModel.php index 73bf404..159adcf 100644 --- a/extdbms/lib/Models/KCSModel.php +++ b/extdbms/lib/Models/KCSModel.php @@ -3,40 +3,19 @@ namespace lib\Models; use lib\Entities\KCSEntity as Entity; +use lib\Models\CommonModel as Model; -class KCSModel extends CommonModel +class KCSModel extends Model { const TABLE = "kcsdb"; - const PK = "kcs_num"; - const TITLE = "kcs_code"; + const PKField = "kcs_num"; + const TitleField = "kcs_code"; public function __construct() { parent::__construct(); } // - - final public function getTable(): string + public function getEntityClass(): string { - return self::TABLE; + return Entity::class; } - final public function getPKField(): string - { - return self::PK; - } - final public function getTitleField(): string - { - return self::TITLE; - } - - final public function getEntity(): Entity - { - return new Entity($this->getResult()); - } // - final public function getEntitys(): array - { - $entitys = []; - foreach ($this->getResults() as $result) { - $entitys[] = new Entity($result); - } - return $entitys; - } // } //Class diff --git a/extdbms/lib/Models/MemberModel.php b/extdbms/lib/Models/MemberModel.php index add886b..d21915a 100644 --- a/extdbms/lib/Models/MemberModel.php +++ b/extdbms/lib/Models/MemberModel.php @@ -3,40 +3,19 @@ namespace lib\Models; use lib\Entities\MemberEntity as Entity; +use lib\Models\CommonModel as Model; -class MemberModel extends CommonModel +class MemberModel extends Model { const TABLE = "memberdb"; - const PK = "id"; - const TITLE = "name"; + const PKField = "id"; + const TitleField = "name"; public function __construct() { parent::__construct(); } // - - final public function getTable(): string + public function getEntityClass(): string { - return self::TABLE; + return Entity::class; } - final public function getPKField(): string - { - return self::PK; - } - final public function getTitleField(): string - { - return self::TITLE; - } - - final public function getEntity(): Entity - { - return new Entity($this->getResult()); - } // - final public function getEntitys(): array - { - $entitys = []; - foreach ($this->getResults() as $result) { - $entitys[] = new Entity($result); - } - return $entitys; - } // } //Class diff --git a/extdbms/lib/Models/ServiceModel.php b/extdbms/lib/Models/ServiceModel.php index a2f2c31..3b55c0c 100644 --- a/extdbms/lib/Models/ServiceModel.php +++ b/extdbms/lib/Models/ServiceModel.php @@ -3,40 +3,19 @@ namespace lib\Models; use lib\Entities\ServiceEntity as Entity; +use lib\Models\CommonModel as Model; -class ServiceModel extends CommonModel +class ServiceModel extends Model { const TABLE = "servicedb"; - const PK = "service_num"; - const TITLE = "service_code"; + const PKField = "service_num"; + const TitleField = "service_code"; public function __construct() { parent::__construct(); } // - - final public function getTable(): string + public function getEntityClass(): string { - return self::TABLE; + return Entity::class; } - final public function getPKField(): string - { - return self::PK; - } - final public function getTitleField(): string - { - return self::TITLE; - } - - final public function getEntity(): Entity - { - return new Entity($this->getResult()); - } // - final public function getEntitys(): array - { - $entitys = []; - foreach ($this->getResults() as $result) { - $entitys[] = new Entity($result); - } - return $entitys; - } // } //Class diff --git a/extdbms/lib/Models/VPCModel.php b/extdbms/lib/Models/VPCModel.php index d5010d4..2d53a30 100644 --- a/extdbms/lib/Models/VPCModel.php +++ b/extdbms/lib/Models/VPCModel.php @@ -3,40 +3,19 @@ namespace lib\Models; use lib\Entities\VPCEntity as Entity; +use lib\Models\CommonModel as Model; -class VPCModel extends CommonModel +class VPCModel extends Model { const TABLE = "vpcdb"; - const PK = "vpc_num"; - const TITLE = "vpc_code"; + const PKField = "vpc_num"; + const TitleField = "vpc_code"; public function __construct() { parent::__construct(); } // - - final public function getTable(): string + public function getEntityClass(): string { - return self::TABLE; + return Entity::class; } - final public function getPKField(): string - { - return self::PK; - } - final public function getTitleField(): string - { - return self::TITLE; - } - - final public function getEntity(): Entity - { - return new Entity($this->getResult()); - } // - final public function getEntitys(): array - { - $entitys = []; - foreach ($this->getResults() as $result) { - $entitys[] = new Entity($result); - } - return $entitys; - } // } //Class diff --git a/extdbms/lib/Services/ClientService.php b/extdbms/lib/Services/ClientService.php index 1c92b0f..36dc915 100644 --- a/extdbms/lib/Services/ClientService.php +++ b/extdbms/lib/Services/ClientService.php @@ -28,7 +28,7 @@ class ClientService extends CommonService } return $this->_model; } - public function getEntitByCode(string $code): Entity + public function getEntitByCode(string $code): Entity|null|false { $this->getModel()->where("Client_Code", $code); return $this->getModel()->getEntity(); diff --git a/extdbms/lib/View/newhistorys.php b/extdbms/lib/View/newhistorys.php new file mode 100644 index 0000000..d518433 --- /dev/null +++ b/extdbms/lib/View/newhistorys.php @@ -0,0 +1,22 @@ + +
패스워드용 난수 :
+ + getPK(), $this->services)) { ?> +
+ + [ clients[$entity->getPK()]->getTitle() ?> ] getPK()]->server_code ?> / behavior ?> + note ?> +
+ + \ No newline at end of file