diff --git a/extdbms/lib/Controllers/DBMS/Client/ClientController.php b/extdbms/lib/Controllers/DBMS/Client/ClientController.php new file mode 100644 index 0000000..ea6ee86 --- /dev/null +++ b/extdbms/lib/Controllers/DBMS/Client/ClientController.php @@ -0,0 +1,25 @@ +getView()->setPath('client'); + } // + final public function getClientService(): ClientService + { + if ($this->_clientService === null) { + $this->_clientService = new ClientService(); + } + return $this->_clientService; + } +} //Class diff --git a/extdbms/lib/Controllers/DBMS/CouponController.php b/extdbms/lib/Controllers/DBMS/Client/CouponController.php similarity index 79% rename from extdbms/lib/Controllers/DBMS/CouponController.php rename to extdbms/lib/Controllers/DBMS/Client/CouponController.php index f8dcb54..583de76 100644 --- a/extdbms/lib/Controllers/DBMS/CouponController.php +++ b/extdbms/lib/Controllers/DBMS/Client/CouponController.php @@ -1,8 +1,8 @@ getView()->setPath('dashboard'); + } // + + //서비스카운팅 , total_counting_customer.php + //CLI 접속방법 : php index.php site/client/dashboard/totalcount/client_code/코드번호 + //WEB 접속방법 : http://localhost/site/client/dashboard/totalcount/client_code/코드번호 + public function totalcount(mixed $client_code = null) + { + if ($client_code === null) { + $client_code = $this->getSegments('client_code'); + if ($client_code === null) { + throw new \Exception("client_code 값이 정의되지 않았습니다."); + } + } + $this->client_code = $client_code; + $dashboard = []; + foreach (DBMS_SERVICE_SWITCHCODE as $district => $switchcodes) { + $switchcode_begin = $switchcodes['begin']; + $switchcode_end = $switchcodes['end']; + $dashboard[$district] = $this->getServiceService()->getDistrictCountByClient( + $client_code, + $switchcode_begin, + $switchcode_end + ); + } //foreach + foreach (array_keys(DBMS_SERVICE_LINE) as $service_line) { + $dashboard[$service_line] = $this->getServiceService()->getServiceLineCountByClient($client_code, $service_line); + } //foreach + $dashboard['coupon'] = $this->getServiceService()->getCouponCountByClient($client_code); + $this->dashboard = $dashboard; + return $this->render(__FUNCTION__); + } +} //Class diff --git a/extdbms/lib/Controllers/DBMS/Client/MemoController.php b/extdbms/lib/Controllers/DBMS/Client/MemoController.php new file mode 100644 index 0000000..acced51 --- /dev/null +++ b/extdbms/lib/Controllers/DBMS/Client/MemoController.php @@ -0,0 +1,28 @@ +getView()->setPath('memo'); + } // + //사용자용메모장 , customer_memo.php + //CLI 접속방법 : php index.php site/client/memo/insert_form/client_code/코드번호 + //WEB 접속방법 : http://localhost/site/client/memo/insert_form/client_code/코드번호 + public function insert_form(mixed $client_code = null) + { + if ($client_code === null) { + $client_code = $this->getSegments('client_code'); + if ($client_code === null) { + throw new \Exception("client_code 값이 정의되지 않았습니다."); + } + } + $this->entity = $this->getClientService()->getModel()->where("Client_Code", $client_code); + return $this->render(__FUNCTION__); + } +} //Class diff --git a/extdbms/lib/Controllers/DBMS/Client/PaymentController.php b/extdbms/lib/Controllers/DBMS/Client/PaymentController.php new file mode 100644 index 0000000..f23ab2f --- /dev/null +++ b/extdbms/lib/Controllers/DBMS/Client/PaymentController.php @@ -0,0 +1,22 @@ +getView()->setPath('payment'); + } // + public function getClientService(): ClientService + { + if ($this->_clientService === null) { + $this->_clientService = new ClientService(); + } + return $this->_clientService; + } +} //Class diff --git a/extdbms/lib/Controllers/DBMS/BaseController.php b/extdbms/lib/Controllers/DBMS/DBMSController.php similarity index 90% rename from extdbms/lib/Controllers/DBMS/BaseController.php rename to extdbms/lib/Controllers/DBMS/DBMSController.php index e80694a..16f6443 100644 --- a/extdbms/lib/Controllers/DBMS/BaseController.php +++ b/extdbms/lib/Controllers/DBMS/DBMSController.php @@ -5,7 +5,7 @@ namespace lib\Controllers\DBMS; use lib\Controllers\CommonController; use lib\Services\ServiceService; -abstract class BaseController extends CommonController +abstract class DBMSController extends CommonController { private ?ServiceService $_service = null; public function __construct() diff --git a/extdbms/lib/Controllers/DBMS/DashboardController.php b/extdbms/lib/Controllers/DBMS/DashboardController.php index 58de243..8e5c837 100644 --- a/extdbms/lib/Controllers/DBMS/DashboardController.php +++ b/extdbms/lib/Controllers/DBMS/DashboardController.php @@ -9,7 +9,7 @@ use lib\Services\KCSService; use lib\Services\HistoryService; use lib\Helpers\ServiceHelper; -class DashboardController extends BaseController +class DashboardController extends DBMSController { private ?MemberService $_memberService = null; private ?ClientService $_clientService = null; diff --git a/extdbms/lib/Controllers/DBMS/DefenceController.php b/extdbms/lib/Controllers/DBMS/DefenceController.php index 8d987c2..adce951 100644 --- a/extdbms/lib/Controllers/DBMS/DefenceController.php +++ b/extdbms/lib/Controllers/DBMS/DefenceController.php @@ -4,7 +4,7 @@ namespace lib\Controllers\DBMS; use lib\Services\DefenceService; -class DefenceController extends BaseController +class DefenceController extends DBMSController { private ?DefenceService $_clientService = null; public function __construct() diff --git a/extdbms/lib/Controllers/DBMS/NavigatorController.php b/extdbms/lib/Controllers/DBMS/NavigatorController.php index b66bfb0..4ebaca8 100644 --- a/extdbms/lib/Controllers/DBMS/NavigatorController.php +++ b/extdbms/lib/Controllers/DBMS/NavigatorController.php @@ -5,7 +5,7 @@ namespace lib\Controllers\DBMS; use lib\Services\ClientService; use lib\Helpers\ServiceHelper; -class NavigatorController extends BaseController +class NavigatorController extends DBMSController { private ?ClientService $_clientService = null; diff --git a/extdbms/lib/Controllers/DBMS/PaymentController.php b/extdbms/lib/Controllers/DBMS/PaymentController.php deleted file mode 100644 index e423219..0000000 --- a/extdbms/lib/Controllers/DBMS/PaymentController.php +++ /dev/null @@ -1,50 +0,0 @@ -getView()->setPath('payment'); - } // - public function getClientService(): ClientService - { - if ($this->_clientService === null) { - $this->_clientService = new ClientService(); - } - return $this->_clientService; - } - - //청구서 - //CLI 접속방법 : php index.php site/payment/billpaper/sitekey/도메인/client_code/코드번호 - //WEB 접속방법 : http://localhost/site/payment/billpaper/sitekey/도메인/client_code/코드번호 - public function billpaper(mixed $sitekey = null, mixed $client_code = null): string - { - if ($sitekey === null) { - $sitekey = $this->getSegments('sitekey'); - if ($sitekey === null) { - throw new \Exception("sitekey 값이 정의되지 않았습니다."); - } - } - if ($client_code === null) { - $client_code = $this->getSegments('client_code'); - if ($client_code === null) { - throw new \Exception("client_code 값이 정의되지 않았습니다."); - } - } - $this->siteInfo = DBMS_SITEINFOS[$sitekey]; - if (!$this->siteInfo) { - throw new \Exception("[{$sitekey}] 값에 해당하는 사이트정보가 존재하지 않습니다."); - } - $this->client = $this->getClientService()->getEntityByCode($client_code); - if (!$this->client) { - throw new \Exception("[{$client_code}] 값에 해당하는 고객정보가 존재하지 않습니다."); - } - return $this->render(__FUNCTION__); - } -} //Class diff --git a/extdbms/lib/Controllers/DBMS/ServiceController.php b/extdbms/lib/Controllers/DBMS/ServiceController.php index c98cc8b..9b50238 100644 --- a/extdbms/lib/Controllers/DBMS/ServiceController.php +++ b/extdbms/lib/Controllers/DBMS/ServiceController.php @@ -5,7 +5,7 @@ namespace lib\Controllers\DBMS; use lib\Services\ClientService; use lib\Services\AddDbService; -class ServiceController extends BaseController +class ServiceController extends DBMSController { private ?ClientService $_clientService = null; @@ -31,35 +31,6 @@ class ServiceController extends BaseController return $this->_addDbService; } - //서비스카운팅 , total_counting_customer.php - //CLI 접속방법 : php index.php site/service/dashboard/client_code/코드번호 - //WEB 접속방법 : http://localhost/site/service/dashboard/client_code/코드번호 - public function dashboard(mixed $client_code = null) - { - if ($client_code === null) { - $client_code = $this->getSegments('client_code'); - if ($client_code === null) { - throw new \Exception("client_code 값이 정의되지 않았습니다."); - } - } - $this->client_code = $client_code; - $dashboard = []; - foreach (DBMS_SERVICE_SWITCHCODE as $district => $switchcodes) { - $switchcode_begin = $switchcodes['begin']; - $switchcode_end = $switchcodes['end']; - $dashboard[$district] = $this->getServiceService()->getDistrictCountByClient( - $client_code, - $switchcode_begin, - $switchcode_end - ); - } //foreach - foreach (array_keys(DBMS_SERVICE_LINE) as $service_line) { - $dashboard[$service_line] = $this->getServiceService()->getServiceLineCountByClient($client_code, $service_line); - } //foreach - $dashboard['coupon'] = $this->getServiceService()->getCouponCountByClient($client_code); - $this->dashboard = $dashboard; - return $this->render(__FUNCTION__); - } //부가서비스 : 닷디펜더,딥파인더 등, deepfinder_list.php,dotdefender_list.php //CLI 접속방법 : php index.php site/service//extra/adddb_code/코드번호 //WEB 접속방법 : http://localhost/site/service/extra/adddb_code/코드번호 diff --git a/extdbms/lib/Core/App.php b/extdbms/lib/Core/App.php index ebe9724..a5b2fbd 100644 --- a/extdbms/lib/Core/App.php +++ b/extdbms/lib/Core/App.php @@ -7,7 +7,8 @@ use lib\Core\Controller; abstract class App { private string $_url = ""; - private string $_module = ""; + private string $_baseControllerPath = 'lib' . DIRECTORY_SEPARATOR . 'Controllers' . DIRECTORY_SEPARATOR; + private array $_controllerPaths = []; protected ?Controller $_controller; protected string $_method = ""; protected array $_segments = []; @@ -27,7 +28,7 @@ abstract class App $arguments = explode('/', trim($path, '/')); // var_dump($arguments); //컨트롤러와 메서드를 설정 - $this->setModule($arguments); + $this->setControllerPath($arguments); $this->setController($arguments); $this->setMethod($arguments); // 남은 세그먼트를 파라미터로 설정 @@ -45,18 +46,20 @@ abstract class App { return $route; } - final protected function getModule(): string + private function getControllerPath(): string { - return $this->_module; + return implode(DIRECTORY_SEPARATOR, $this->_controllerPaths); } - private function setModule(array &$segments): void + private function setControllerPath(array &$segments): void { $route = count($segments) ? $segments[0] : ''; $route = $this->routeModule($route); - $module = "lib" . DIRECTORY_SEPARATOR . "Controllers" . DIRECTORY_SEPARATOR . $route; - if (is_dir(ROOT_PATH . DIRECTORY_SEPARATOR . $module)) { + $fullDirectoryPath = ROOT_PATH . DIRECTORY_SEPARATOR . $this->_baseControllerPath . $this->getControllerPath() . DIRECTORY_SEPARATOR . $route; + // echo "Full RoutePath:{$fullRoutePath}\n"; + if (is_dir($fullDirectoryPath)) { array_shift($segments); - $this->_module = $module . DIRECTORY_SEPARATOR; + $this->_controllerPaths[] = $route; + $this->setControllerPath($segments); } } final protected function getController(): Controller @@ -65,11 +68,11 @@ abstract class App } private function setController(array &$segments): void { - $route = count($segments) ? $segments[0] : 'Home'; - $route = $this->routeController($route); - $controller = $this->getModule() . $route; - // Ensure namespace separator - $controller = str_replace('/', '\\', $controller); + // echo $this->getControllerPath() . "\n"; + // var_dump($segments); + // exit; + $route = count($segments) ? $segments[0] : 'Home'; + $controller = str_replace('/', '\\', $this->_baseControllerPath . $this->getControllerPath() . DIRECTORY_SEPARATOR . $this->routeController($route)); if (class_exists($controller, true)) { $this->_controller = new $controller(); } else { diff --git a/extdbms/lib/Core/Controller.php b/extdbms/lib/Core/Controller.php index 1f0a268..005e493 100644 --- a/extdbms/lib/Core/Controller.php +++ b/extdbms/lib/Core/Controller.php @@ -8,11 +8,13 @@ use lib\Configs\View; abstract class Controller { + private $_module = ""; private $_request = null; private ?View $_view = null; private $_segments = []; - protected function __construct() + protected function __construct(string $module = "") { + $this->_module = $module; $this->_view = new View(); } // final public function getView(): View @@ -27,6 +29,10 @@ abstract class Controller { $this->getView()->$name = $value; } + final public function getModule(): string + { + return $this->_module; + } final public function setSegments(array $segments) { $this->_segments = $segments; diff --git a/extdbms/lib/Core/Model.php b/extdbms/lib/Core/Model.php index 45ec5d2..984f93b 100644 --- a/extdbms/lib/Core/Model.php +++ b/extdbms/lib/Core/Model.php @@ -71,7 +71,7 @@ abstract class Model { $value = ""; if ($datas === null) { - return "NULL"; + return ""; } if (is_array($datas)) { $temps = []; @@ -192,9 +192,8 @@ abstract class Model $this->orderBy($column, $direction ?? $default_direction); } } else { - $columns = "{$columns} {$default_direction}"; + $this->_querys['ORDERBY'][] = "{$columns} {$default_direction}"; } - $this->_querys['ORDERBY'][] = $orderBy; } final public function limit(int $start, int $offset = 0): void { @@ -207,7 +206,7 @@ abstract class Model { $join = count($this->_querys['JOIN']) ? implode(",", $this->_querys['JOIN']) : ""; $where = $this->getWhere(); - $orderby = count($this->_querys['ORDERBY']) ? implode(",", $this->_querys['ORDERBY']) : ""; + $orderby = count($this->_querys['ORDERBY']) ? "ORDER BY " . implode(",", $this->_querys['ORDERBY']) : ""; return "{$head} FROM {$this->getTable()} {$join} {$where} {$tail} {$orderby} {$this->_querys['LIMIT']}"; } public function getResult($mode = PDO::FETCH_ASSOC): mixed diff --git a/extdbms/lib/Entities/ClientEntity.php b/extdbms/lib/Entities/ClientEntity.php index 30bb033..d85687a 100644 --- a/extdbms/lib/Entities/ClientEntity.php +++ b/extdbms/lib/Entities/ClientEntity.php @@ -14,6 +14,10 @@ class ClientEntity extends Entity { parent::__construct($datas); } // + public function getClientCode(): string + { + return $this->Client_Code; + } public function getPhone(string $field = "", string $delimeter = ","): string { return $field ? $this->$field : "{$this->Client_Phone1} {$delimeter} {$this->Client_Phone2}"; @@ -22,4 +26,8 @@ class ClientEntity extends Entity { return $field ? $this->$field : "{$this->Client_EMail1} {$delimeter} {$this->Client_EMail2}"; } + public function getNote(): string + { + return $this->Client_Note; + } } //Class diff --git a/extdbms/lib/Services/DefenceService.php b/extdbms/lib/Services/DefenceService.php index 2a0bbe6..ea0eacc 100644 --- a/extdbms/lib/Services/DefenceService.php +++ b/extdbms/lib/Services/DefenceService.php @@ -33,6 +33,7 @@ class DefenceService extends CommonService if ($zone !== null) { $this->getModel()->setWhere(['zone' => $zone]); } - return $this->getModel()->orderBy(['zone' => 'asc', 'parent' => 'asc', 'child' => 'asc']); + $this->getModel()->orderBy(['zone' => 'asc', 'parents' => 'asc', 'child' => 'asc']); + return $this->getEntities(); } } diff --git a/extdbms/lib/Views/dbms/service/dashboard.php b/extdbms/lib/Views/dbms/client/dashboard/totalcount.php similarity index 100% rename from extdbms/lib/Views/dbms/service/dashboard.php rename to extdbms/lib/Views/dbms/client/dashboard/totalcount.php diff --git a/extdbms/lib/Views/dbms/client/memo/insert_formphp b/extdbms/lib/Views/dbms/client/memo/insert_formphp new file mode 100644 index 0000000..da98550 --- /dev/null +++ b/extdbms/lib/Views/dbms/client/memo/insert_formphp @@ -0,0 +1,14 @@ +
\ No newline at end of file diff --git a/idcproject/WebContent/jsp/service/serviceDetail.jsp b/idcproject/WebContent/jsp/service/serviceDetail.jsp index a885b73..676ba8b 100644 --- a/idcproject/WebContent/jsp/service/serviceDetail.jsp +++ b/idcproject/WebContent/jsp/service/serviceDetail.jsp @@ -973,7 +973,7 @@ $(function() -