dbsms_primeidc init...1
This commit is contained in:
parent
0e1a73ecbf
commit
97240a5fe5
@ -1,12 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace lib\Core;
|
||||
|
||||
use lib\Configs\Config;
|
||||
use Dotenv\Dotenv;
|
||||
use lib\Configs\Route;
|
||||
|
||||
require_once __DIR__ . '/vendor/autoload.php';
|
||||
require_once "lib/Configs/App.php";
|
||||
require_once __DIR__ . "/lib/Configs/Route.php";
|
||||
try {
|
||||
$dotenv = Dotenv::createImmutable(__DIR__);
|
||||
$dotenv->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();
|
||||
}
|
||||
|
||||
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace lib\Configs;
|
||||
|
||||
use lib\Core\App as Core;
|
||||
|
||||
class App extends Core
|
||||
{
|
||||
public function __construct(string $url)
|
||||
{
|
||||
parent::__construct($url);
|
||||
} //
|
||||
}
|
||||
35
extdbms/lib/Configs/Route.php
Normal file
35
extdbms/lib/Configs/Route.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace lib\Configs;
|
||||
|
||||
use lib\Core\Route as Core;
|
||||
|
||||
class Route extends Core
|
||||
{
|
||||
public function __construct(string $url)
|
||||
{
|
||||
parent::__construct($url);
|
||||
}
|
||||
|
||||
protected function routeController(string $route): string
|
||||
{
|
||||
switch ($route) {
|
||||
case 'site':
|
||||
$route = 'SiteController';
|
||||
break;
|
||||
}
|
||||
return parent::routeController($route);
|
||||
}
|
||||
protected function routeMethod(string $route): string
|
||||
{
|
||||
switch ($route) {
|
||||
case 'service':
|
||||
$route = 'newservices';
|
||||
break;
|
||||
case 'history':
|
||||
$route = 'newhistorys';
|
||||
break;
|
||||
}
|
||||
return parent::routeMethod($route);
|
||||
}
|
||||
}
|
||||
@ -1,23 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace lib\Controllers;
|
||||
|
||||
class ClientController extends CommonController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
} //
|
||||
|
||||
public function getBillingPaper(array $datas)
|
||||
{
|
||||
$this->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');
|
||||
}
|
||||
}
|
||||
@ -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()
|
||||
{
|
||||
|
||||
15
extdbms/lib/Controllers/HomeController.php
Normal file
15
extdbms/lib/Controllers/HomeController.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace lib\Controllers;
|
||||
|
||||
class HomeController extends CommonController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
} //
|
||||
public function index()
|
||||
{
|
||||
echo __FUNCTION__ . "실행완료";
|
||||
}
|
||||
} //Class
|
||||
@ -97,16 +97,19 @@ class SiteController extends CommonController
|
||||
}
|
||||
|
||||
//서비스카운팅 , total_counting.php
|
||||
//CLI 접속방법 : php index.php SiteController/totalcount/sitekey/dbms.prime-idc.jp
|
||||
//WEB 접속방법 : http://localhost/SiteController/totalcount/sitekey/dbms.prime-idc.jp
|
||||
public function totalcount(): string
|
||||
//CLI 접속방법 : php index.php site/totalcount/sitekey/dbms.prime-idc.jp
|
||||
//WEB 접속방법 : http://localhost/site/totalcount/sitekey/dbms.prime-idc.jp
|
||||
public function totalcount(mixed $sitekey = null): string
|
||||
{
|
||||
$sitekey = $this->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__);
|
||||
}
|
||||
|
||||
@ -1,78 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace lib\Core;
|
||||
|
||||
class App
|
||||
{
|
||||
private ?Controller $_controller = null;
|
||||
private $_method = null;
|
||||
public function __construct(string $url)
|
||||
{
|
||||
// URL에서 호스트 뒤의 경로를 가져옴
|
||||
$path = parse_url($url, PHP_URL_PATH);
|
||||
// 슬래시(`/`)를 기준으로 분할
|
||||
$arguments = explode('/', trim($path, '/'));
|
||||
//Controller 추출
|
||||
if (isset($arguments[0])) {
|
||||
$route = "";
|
||||
switch ($arguments[0]) {
|
||||
case 'new':
|
||||
$route = "SiteController";
|
||||
break;
|
||||
default:
|
||||
$route = $arguments[0];
|
||||
break;
|
||||
}
|
||||
$control = "lib\\Controllers\\" . $route;
|
||||
$this->_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
|
||||
@ -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) {
|
||||
|
||||
132
extdbms/lib/Core/Route.php
Normal file
132
extdbms/lib/Core/Route.php
Normal file
@ -0,0 +1,132 @@
|
||||
<?php
|
||||
|
||||
namespace lib\Core;
|
||||
|
||||
use lib\Core\Controller;
|
||||
|
||||
abstract class Route
|
||||
{
|
||||
private string $_url = "";
|
||||
protected ?Controller $_controller;
|
||||
protected string $_method = "";
|
||||
protected array $_segments = [];
|
||||
|
||||
public function __construct(string $url)
|
||||
{
|
||||
$this->_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);
|
||||
}
|
||||
}
|
||||
@ -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);
|
||||
|
||||
@ -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
|
||||
|
||||
@ -1,15 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace lib\Core;
|
||||
namespace lib\Entities;
|
||||
|
||||
use lib\Core\Entity as Core;
|
||||
|
||||
abstract class CommonEntity extends Core
|
||||
class CommonEntity extends Core
|
||||
{
|
||||
public function __construct($datas)
|
||||
{
|
||||
parent::__construct($datas);
|
||||
} //
|
||||
abstract public function getTitle();
|
||||
abstract public function getPK();
|
||||
public function getPK(): string
|
||||
{
|
||||
return constant("static::PKField");
|
||||
}
|
||||
public function getTitle(): string
|
||||
{
|
||||
return constant("static::TitleField");
|
||||
}
|
||||
//공통부분
|
||||
} //Class
|
||||
|
||||
@ -2,12 +2,23 @@
|
||||
|
||||
namespace lib\Entities;
|
||||
|
||||
use lib\Core\Entity;
|
||||
use lib\Entities\CommonEntity as Entity;
|
||||
use lib\Models\HistoryModel as Model;
|
||||
|
||||
class HistoryEntity extends Entity
|
||||
{
|
||||
const PKField = Model::PKField;
|
||||
const TitleField = Model::TitleField;
|
||||
public function __construct($datas)
|
||||
{
|
||||
parent::__construct($datas);
|
||||
} //
|
||||
public function getServiceCode(): string
|
||||
{
|
||||
return $this->service_code;
|
||||
}
|
||||
public function getClientName(): string
|
||||
{
|
||||
return $this->client_name;
|
||||
}
|
||||
} //Class
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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();
|
||||
|
||||
22
extdbms/lib/View/newhistorys.php
Normal file
22
extdbms/lib/View/newhistorys.php
Normal file
@ -0,0 +1,22 @@
|
||||
<style>
|
||||
input[type=text] {
|
||||
padding: 2px;
|
||||
border: 1px solid #ccc;
|
||||
-webkit-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
input[type=text]:focus {
|
||||
border-color: #333;
|
||||
}
|
||||
</style>
|
||||
<div><strong>패스워드용 난수 : </strong><input type=text style="width:290px;" value="<?= $this->helper->getRandomString() ?>"></div>
|
||||
<?php foreach ($viewDatas['entitys'] as $entity): ?>
|
||||
<?php if (array_key_exists($entity->getPK(), $this->services)) { ?>
|
||||
<div>
|
||||
<i class="fa fa-info-circle fa-fw"></i>
|
||||
<a href="/serviceDetailSolo.sev?client_code=<?= $this->clients[$entity->getPK()]->getPK() ?>&service_code=<?= $entity->getServiceCode() ?>" style="text-decoration: none;color:gray;font-size:10pt;line-height:1.6em;">[ <?= $this->clients[$entity->getPK()]->getTitle() ?> ] <?= $viewDatas['services'][$entity->getPK()]->server_code ?> / <?= $entity->behavior ?></a>
|
||||
<span class="pull-right text-muted small"><em><?= $entity->note ?></em></span>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php endforeach ?>
|
||||
Loading…
Reference in New Issue
Block a user