dbms_primeidc_init...1

This commit is contained in:
최준흠 2025-04-07 10:44:52 +09:00
parent 6e3182a07a
commit 3ff66ef683
20 changed files with 178 additions and 107 deletions

View File

@ -0,0 +1,25 @@
<?php
namespace lib\Controllers\DBMS\Client;
use lib\Services\ClientService;
use lib\Controllers\DBMS\DBMSController;
abstract class ClientController extends DBMSController
{
private ?ClientService $_clientService = null;
public function __construct()
{
parent::__construct();
$this->getView()->setPath('client');
} //
final public function getClientService(): ClientService
{
if ($this->_clientService === null) {
$this->_clientService = new ClientService();
}
return $this->_clientService;
}
} //Class

View File

@ -1,8 +1,8 @@
<?php
namespace lib\Controllers\DBMS;
namespace lib\Controllers\DBMS\Client;
class CouponController extends BaseController
class CouponController extends ClientController
{
public function __construct()
{

View File

@ -0,0 +1,44 @@
<?php
namespace lib\Controllers\DBMS\Client;
use lib\Services\ClientService;
class DashboardController extends ClientController
{
public function __construct()
{
parent::__construct();
$this->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

View File

@ -0,0 +1,28 @@
<?php
namespace lib\Controllers\DBMS\Client;
use lib\Services\ClientService;
class MemoController extends ClientController
{
public function __construct()
{
parent::__construct();
$this->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

View File

@ -0,0 +1,22 @@
<?php
namespace lib\Controllers\DBMS;
use lib\Services\ClientService;
class PaymentController extends DBMSController
{
private ?ClientService $_clientService = null;
public function __construct()
{
parent::__construct();
$this->getView()->setPath('payment');
} //
public function getClientService(): ClientService
{
if ($this->_clientService === null) {
$this->_clientService = new ClientService();
}
return $this->_clientService;
}
} //Class

View File

@ -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()

View File

@ -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;

View File

@ -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()

View File

@ -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;

View File

@ -1,50 +0,0 @@
<?php
namespace lib\Controllers\DBMS;
use lib\Services\ClientService;
class PaymentController extends BaseController
{
private ?ClientService $_clientService = null;
public function __construct()
{
parent::__construct();
$this->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

View File

@ -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/코드번호

View File

@ -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 {

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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();
}
}

View File

@ -0,0 +1,14 @@
<form method="post" action="http://<?= $_SERVER['HTTP_HOST'] ?>/insert">
<input type="hidden" name="client_code" value="<?= $entity->getClientCode() ?>">
<table width="100%" cellpadding="0" cellspacing="0" border="0" style="margin-bottom:0px">
<tr>
<td width="18%">
<div align="center"><strong>비&nbsp;&nbsp;&nbsp;&nbsp;고</strong></div>
</td>
<td width="72%"><textarea rows="7" cols="120" name="msg"><?= $entity->getNote() ?></textarea></td>
<td width="10%">
<div align="center"><input type="submit" value="저장" /></div>
</td>
</tr>
</table>
</form>

View File

@ -973,7 +973,7 @@ $(function()
</h4>
</div>
<!-- 사용정보 시작-->
<c:import url="${phpurl}/DBMS/service/dashboard/client_code/${client_code }" />
<c:import url="${phpurl}/DBMS/client/dashboard/client_code/${client_code }" />
<!-- end 사용정보 -->
<c:if test="${member.power5 eq 'o'}">
<div class="col-lg-4 col-md-12" style="padding:3px">

View File

@ -987,7 +987,7 @@ $(function()
</h4>
</div>
<!-- 사용정보 시작-->
<c:import url="${phpurl}/DBMS/service/dashboard/client_code/${client_code }" />
<c:import url="${phpurl}/DBMS/client/dashboard/client_code/${client_code }" />
<!-- end 사용정보 -->
<c:if test="${member.power5 eq 'o'}">
<div class="col-lg-4 col-md-12" style="padding:3px">