dbms_primeidc_init...1
This commit is contained in:
parent
178f94882d
commit
d0d78151fe
@ -11,10 +11,11 @@ abstract class BaseController extends CommonController
|
|||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
//View의 추가디렉토리
|
||||||
$this->getView()->setPath('dbms');
|
$this->getView()->setPath('dbms');
|
||||||
} //
|
} //
|
||||||
|
|
||||||
final public function getService(): ServiceService
|
final public function getServiceervice(): ServiceService
|
||||||
{
|
{
|
||||||
if ($this->_service === null) {
|
if ($this->_service === null) {
|
||||||
$this->_service = new ServiceService();
|
$this->_service = new ServiceService();
|
||||||
|
|||||||
@ -69,11 +69,11 @@ class DashboardController extends BaseController
|
|||||||
//예외,service_line = "test","substitution"
|
//예외,service_line = "test","substitution"
|
||||||
$excepts = ["test", "substitution"];
|
$excepts = ["test", "substitution"];
|
||||||
$this->day = intval($_ENV['SITE_DASHBOARD_DAY'] ?? $_SERVER['SITE_DASHBOARD_DAY'] ?? 7);
|
$this->day = intval($_ENV['SITE_DASHBOARD_DAY'] ?? $_SERVER['SITE_DASHBOARD_DAY'] ?? 7);
|
||||||
$this->newServers = $this->getService()->getNewServerCount($this->day, $excepts);
|
$this->newServers = $this->getServiceervice()->getNewServerCount($this->day, $excepts);
|
||||||
// 금일기준 미납서버수
|
// 금일기준 미납서버수
|
||||||
//예외,service_line = "test","substitution",C012:게임윙,C116:WinIDC,C219:IDC-JP
|
//예외,service_line = "test","substitution",C012:게임윙,C116:WinIDC,C219:IDC-JP
|
||||||
$excepts = ["test", "substitution", 'C116', 'C012', 'C219'];
|
$excepts = ["test", "substitution", 'C116', 'C012', 'C219'];
|
||||||
$this->unPayments = $this->getService()->getUnPaymentCount($excepts);
|
$this->unPayments = $this->getServiceervice()->getUnPaymentCount($excepts);
|
||||||
return $this->render(__FUNCTION__);
|
return $this->render(__FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ class DashboardController extends BaseController
|
|||||||
}
|
}
|
||||||
//사이트 정보 가져오기
|
//사이트 정보 가져오기
|
||||||
$this->siteInfo = DBMS_SITEINFOS[$sitekey];
|
$this->siteInfo = DBMS_SITEINFOS[$sitekey];
|
||||||
$this->totalcount = $this->getService()->getTotalCount($this->siteInfo);
|
$this->totalcount = $this->getServiceervice()->getTotalCount($this->siteInfo);
|
||||||
$summary = array();
|
$summary = array();
|
||||||
foreach ($this->siteInfo['totalcount_types'] as $type) {
|
foreach ($this->siteInfo['totalcount_types'] as $type) {
|
||||||
$summary[$type] = array("Tokyo" => 0, "Chiba" => 0);
|
$summary[$type] = array("Tokyo" => 0, "Chiba" => 0);
|
||||||
@ -120,8 +120,8 @@ class DashboardController extends BaseController
|
|||||||
{
|
{
|
||||||
//신규서버정보
|
//신규서버정보
|
||||||
$this->limit = intval($limit);
|
$this->limit = intval($limit);
|
||||||
$this->entitys = $this->getService()->getNews($this->limit);
|
$this->entitys = $this->getServiceervice()->getNews($this->limit);
|
||||||
// echo $this->getService()->getModel()->getLastQuery();
|
// echo $this->getServiceervice()->getModel()->getLastQuery();
|
||||||
// 배열 초기화를 명시적으로 수행
|
// 배열 초기화를 명시적으로 수행
|
||||||
$users = [];
|
$users = [];
|
||||||
$clients = [];
|
$clients = [];
|
||||||
@ -133,7 +133,7 @@ class DashboardController extends BaseController
|
|||||||
//관리자정보(등록자)
|
//관리자정보(등록자)
|
||||||
$users[$serviceCode] = $entity->getMemberCode() ? $this->getMemberService()->getEntitById($entity->getMemberCode()) : "";
|
$users[$serviceCode] = $entity->getMemberCode() ? $this->getMemberService()->getEntitById($entity->getMemberCode()) : "";
|
||||||
//고객정보
|
//고객정보
|
||||||
$clients[$serviceCode] = $this->getClientService()->getEntitByCode($entity->getClientCode());
|
$clients[$serviceCode] = $this->getClientService()->getEntityByCode($entity->getClientCode());
|
||||||
//VPC정보
|
//VPC정보
|
||||||
$vpcs[$serviceCode] = $this->getVPCService()->getCountByServiceCode($serviceCode);
|
$vpcs[$serviceCode] = $this->getVPCService()->getCountByServiceCode($serviceCode);
|
||||||
//KCS정보
|
//KCS정보
|
||||||
@ -161,10 +161,10 @@ class DashboardController extends BaseController
|
|||||||
foreach ($this->entitys as $entity) {
|
foreach ($this->entitys as $entity) {
|
||||||
$pk = $entity->getPK();
|
$pk = $entity->getPK();
|
||||||
//서비스정보가져오기
|
//서비스정보가져오기
|
||||||
$service = $this->getService()->getServiceByServiceCode($entity->getServiceCode());
|
$service = $this->getServiceervice()->getEntityByCode($entity->getServiceCode());
|
||||||
if ($service) {
|
if ($service) {
|
||||||
//고객정보
|
//고객정보
|
||||||
$clients[$pk] = $this->getClientService()->getEntitByCode($service->getClientCode());
|
$clients[$pk] = $this->getClientService()->getEntityByCode($service->getClientCode());
|
||||||
//서비스정보
|
//서비스정보
|
||||||
$services[$pk] = $service;
|
$services[$pk] = $service;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
namespace lib\Controllers\DBMS;
|
namespace lib\Controllers\DBMS;
|
||||||
|
|
||||||
use lib\Services\ClientService;
|
use lib\Services\ClientService;
|
||||||
|
use lib\Helpers\ServiceHelper;
|
||||||
|
|
||||||
class NavigatorController extends BaseController
|
class NavigatorController extends BaseController
|
||||||
{
|
{
|
||||||
@ -12,6 +13,7 @@ class NavigatorController extends BaseController
|
|||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->getView()->setPath('navigator');
|
$this->getView()->setPath('navigator');
|
||||||
|
$this->helper = new ServiceHelper();
|
||||||
} //
|
} //
|
||||||
public function getClientService(): ClientService
|
public function getClientService(): ClientService
|
||||||
{
|
{
|
||||||
@ -24,12 +26,14 @@ class NavigatorController extends BaseController
|
|||||||
//부가서비스 : 닷디펜더,딥파인더 등, deepfinder_list.php,dotdefender_list.php
|
//부가서비스 : 닷디펜더,딥파인더 등, deepfinder_list.php,dotdefender_list.php
|
||||||
//CLI 접속방법 : php index.php SiteController/extraservice/client_code/코드번호
|
//CLI 접속방법 : php index.php SiteController/extraservice/client_code/코드번호
|
||||||
//WEB 접속방법 : http://localhost/SiteController/extraservice/sitekey/dbms.prime-idc.jp/client_code/코드번호
|
//WEB 접속방법 : http://localhost/SiteController/extraservice/sitekey/dbms.prime-idc.jp/client_code/코드번호
|
||||||
public function ipsearch(mixed $ip = null): string
|
public function ipsearch(): string
|
||||||
{
|
{
|
||||||
$clients = [];
|
$clients = [];
|
||||||
$services = $this->getService()->getServicesByIP($ip);
|
$ip = $this->getRequest('ip');
|
||||||
|
//IP형식이 ipv4인지 확인 후 값가져오기
|
||||||
|
$services = $ip && $this->helper->isIPAddress($ip) ? $this->getServiceervice()->getEntitysByIP($ip) : $this->getServiceervice()->getEntitys();
|
||||||
foreach ($services as $service) {
|
foreach ($services as $service) {
|
||||||
$clients[$service->getPK()] = $this->getClientService()->getEntitByCode($service->getClientCode());
|
$clients[$service->getPK()] = $this->getClientService()->getEntityByCode($service->getClientCode());
|
||||||
}
|
}
|
||||||
$this->services = $services;
|
$this->services = $services;
|
||||||
$this->clients = $clients;
|
$this->clients = $clients;
|
||||||
|
|||||||
@ -43,7 +43,7 @@ class PaymentController extends BaseController
|
|||||||
if (!$this->siteInfo) {
|
if (!$this->siteInfo) {
|
||||||
throw new \Exception("[{$sitekey}] 값에 해당하는 사이트정보가 존재하지 않습니다.");
|
throw new \Exception("[{$sitekey}] 값에 해당하는 사이트정보가 존재하지 않습니다.");
|
||||||
}
|
}
|
||||||
$this->client = $this->getClientService()->getEntitByCode($client_code);
|
$this->client = $this->getClientService()->getEntityByCode($client_code);
|
||||||
if (!$this->client) {
|
if (!$this->client) {
|
||||||
throw new \Exception("[{$client_code}] 값에 해당하는 고객정보가 존재하지 않습니다.");
|
throw new \Exception("[{$client_code}] 값에 해당하는 고객정보가 존재하지 않습니다.");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -42,16 +42,22 @@ class ServiceController extends BaseController
|
|||||||
throw new \Exception("adddb_code 값이 정의되지 않았습니다.");
|
throw new \Exception("adddb_code 값이 정의되지 않았습니다.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//해당 부가서비스의 services_code 목록 가져오기
|
||||||
//segment의 값이 한글인경우 urldecode가 필요
|
//segment의 값이 한글인경우 urldecode가 필요
|
||||||
$adddb_code = urldecode($adddb_code);
|
$service_codes = [];
|
||||||
$service_codes = $this->getAddDbService()->getServiceCodesByCode($adddb_code);
|
$entitys = $this->getAddDbService()->getEntitysByCode(urldecode($adddb_code));
|
||||||
|
var_dump($entitys);
|
||||||
|
exit;
|
||||||
|
foreach ($entity as $entity) {
|
||||||
|
$service_codes[] = $entity->getServiceCode();
|
||||||
|
}
|
||||||
if (!count($service_codes)) {
|
if (!count($service_codes)) {
|
||||||
throw new \Exception("[{$adddb_code}] 값에 해당하는 부가서비스정보가 존재하지 않습니다.");
|
throw new \Exception("[{$adddb_code}] 값에 해당하는 부가서비스정보가 존재하지 않습니다.");
|
||||||
}
|
}
|
||||||
$clients = [];
|
$clients = [];
|
||||||
$services = $this->getService()->geServicesBytExtras($service_codes);
|
$services = $this->getServiceervice()->getEntitysByCodes($service_codes);
|
||||||
foreach ($services as $service) {
|
foreach ($services as $service) {
|
||||||
$clients[$service->getPK()] = $this->getClientService()->getEntitByCode($service->getClientCode());
|
$clients[$service->getPK()] = $this->getClientService()->getEntityByCode($service->getClientCode());
|
||||||
}
|
}
|
||||||
$this->services = $services;
|
$this->services = $services;
|
||||||
$this->clients = $clients;
|
$this->clients = $clients;
|
||||||
|
|||||||
@ -8,6 +8,7 @@ use lib\Configs\View;
|
|||||||
|
|
||||||
abstract class Controller
|
abstract class Controller
|
||||||
{
|
{
|
||||||
|
private $_request = null;
|
||||||
private ?View $_view = null;
|
private ?View $_view = null;
|
||||||
private $_segments = [];
|
private $_segments = [];
|
||||||
protected function __construct()
|
protected function __construct()
|
||||||
@ -37,6 +38,16 @@ abstract class Controller
|
|||||||
}
|
}
|
||||||
return array_key_exists($key, $this->_segments) ? $this->_segments[$key] : null;
|
return array_key_exists($key, $this->_segments) ? $this->_segments[$key] : null;
|
||||||
}
|
}
|
||||||
|
final public function getRequest(mixed $key = null, string $method = "GET"): mixed
|
||||||
|
{
|
||||||
|
$requestDatas = $method === "POST" ? $_POST : $_GET;
|
||||||
|
$result = null;
|
||||||
|
if (!$key)
|
||||||
|
$result = $requestDatas;
|
||||||
|
else
|
||||||
|
$result = array_key_exists($key, $requestDatas) ? $requestDatas[$key] : null;
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
public function render(string $path)
|
public function render(string $path)
|
||||||
{
|
{
|
||||||
return $this->getView()->render($path);
|
return $this->getView()->render($path);
|
||||||
|
|||||||
@ -160,13 +160,13 @@ abstract class Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Result
|
//Result
|
||||||
protected function getResult($mode = PDO::FETCH_ASSOC): mixed
|
public function getResult($mode = PDO::FETCH_ASSOC): mixed
|
||||||
{
|
{
|
||||||
$query = "{$this->_querys['SELECT']} FROM {$this->getTable()} {$this->_querys['JOIN']} {$this->getWhere()} {$this->_querys['ORDERBY']} {$this->_querys['LIMIT']}";
|
$query = "{$this->_querys['SELECT']} FROM {$this->getTable()} {$this->_querys['JOIN']} {$this->getWhere()} {$this->_querys['ORDERBY']} {$this->_querys['LIMIT']}";
|
||||||
$stmt = $this->execute($query);
|
$stmt = $this->execute($query);
|
||||||
return $stmt->fetch($mode);
|
return $stmt->fetch($mode);
|
||||||
}
|
}
|
||||||
protected function getResults($mode = PDO::FETCH_ASSOC): mixed
|
public function getResults($mode = PDO::FETCH_ASSOC): mixed
|
||||||
{
|
{
|
||||||
$query = "{$this->_querys["SELECT"]} FROM {$this->getTable()} {$this->_querys['JOIN']} {$this->getWhere()} {$this->_querys['ORDERBY']} {$this->_querys['LIMIT']}";
|
$query = "{$this->_querys["SELECT"]} FROM {$this->getTable()} {$this->_querys['JOIN']} {$this->getWhere()} {$this->_querys['ORDERBY']} {$this->_querys['LIMIT']}";
|
||||||
$stmt = $this->execute($query);
|
$stmt = $this->execute($query);
|
||||||
|
|||||||
@ -66,7 +66,7 @@ abstract class CommonHelper extends Core
|
|||||||
return preg_match($pattern_validation, $domain);
|
return preg_match($pattern_validation, $domain);
|
||||||
}
|
}
|
||||||
|
|
||||||
final public function isIPAddress(string $ip, $type = false): bool
|
final public function isIPAddress(string $ip, $type = 'ipv4'): bool
|
||||||
{
|
{
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'ipv4':
|
case 'ipv4':
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace lib\Models;
|
namespace lib\Models;
|
||||||
|
|
||||||
use lib\Entities\AddDbEntity as Entity;
|
|
||||||
use lib\Models\CommonModel as Model;
|
use lib\Models\CommonModel as Model;
|
||||||
|
|
||||||
class AddDbModel extends Model
|
class AddDbModel extends Model
|
||||||
@ -14,8 +13,4 @@ class AddDbModel extends Model
|
|||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
} //
|
} //
|
||||||
public function getEntityClass(): string
|
|
||||||
{
|
|
||||||
return Entity::class;
|
|
||||||
}
|
|
||||||
} //Class
|
} //Class
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace lib\Models;
|
namespace lib\Models;
|
||||||
|
|
||||||
use lib\Entities\ClientEntity as Entity;
|
|
||||||
use lib\Models\CommonModel as Model;
|
use lib\Models\CommonModel as Model;
|
||||||
|
|
||||||
class ClientModel extends Model
|
class ClientModel extends Model
|
||||||
@ -14,8 +13,4 @@ class ClientModel extends Model
|
|||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
} //
|
} //
|
||||||
public function getEntityClass(): string
|
|
||||||
{
|
|
||||||
return Entity::class;
|
|
||||||
}
|
|
||||||
} //Class
|
} //Class
|
||||||
|
|||||||
@ -10,8 +10,6 @@ abstract class CommonModel extends Core
|
|||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
} //
|
} //
|
||||||
abstract public function getEntityClass(): string;
|
|
||||||
|
|
||||||
// self:: → 컴파일 타임에 결정되므로 BaseModel의 상수를 참조하게 됨.
|
// self:: → 컴파일 타임에 결정되므로 BaseModel의 상수를 참조하게 됨.
|
||||||
// static:: → 실행 타임에 결정되므로 상속받은 클래스의 상수를 참조함.
|
// static:: → 실행 타임에 결정되므로 상속받은 클래스의 상수를 참조함.
|
||||||
final public function getTable(): string
|
final public function getTable(): string
|
||||||
@ -26,23 +24,4 @@ abstract class CommonModel extends Core
|
|||||||
{
|
{
|
||||||
return constant("static::TitleField");
|
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
|
} //Class
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace lib\Models;
|
namespace lib\Models;
|
||||||
|
|
||||||
use lib\Entities\HistoryEntity as Entity;
|
|
||||||
use lib\Models\CommonModel as Model;
|
use lib\Models\CommonModel as Model;
|
||||||
|
|
||||||
class HistoryModel extends Model
|
class HistoryModel extends Model
|
||||||
@ -14,8 +13,4 @@ class HistoryModel extends Model
|
|||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
} //
|
} //
|
||||||
public function getEntityClass(): string
|
|
||||||
{
|
|
||||||
return Entity::class;
|
|
||||||
}
|
|
||||||
} //Class
|
} //Class
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace lib\Models;
|
namespace lib\Models;
|
||||||
|
|
||||||
use lib\Entities\KCSEntity as Entity;
|
|
||||||
use lib\Models\CommonModel as Model;
|
use lib\Models\CommonModel as Model;
|
||||||
|
|
||||||
class KCSModel extends Model
|
class KCSModel extends Model
|
||||||
@ -14,8 +13,4 @@ class KCSModel extends Model
|
|||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
} //
|
} //
|
||||||
public function getEntityClass(): string
|
|
||||||
{
|
|
||||||
return Entity::class;
|
|
||||||
}
|
|
||||||
} //Class
|
} //Class
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace lib\Models;
|
namespace lib\Models;
|
||||||
|
|
||||||
use lib\Entities\MemberEntity as Entity;
|
|
||||||
use lib\Models\CommonModel as Model;
|
use lib\Models\CommonModel as Model;
|
||||||
|
|
||||||
class MemberModel extends Model
|
class MemberModel extends Model
|
||||||
@ -14,8 +13,4 @@ class MemberModel extends Model
|
|||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
} //
|
} //
|
||||||
public function getEntityClass(): string
|
|
||||||
{
|
|
||||||
return Entity::class;
|
|
||||||
}
|
|
||||||
} //Class
|
} //Class
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace lib\Models;
|
namespace lib\Models;
|
||||||
|
|
||||||
use lib\Entities\ServiceEntity as Entity;
|
|
||||||
use lib\Models\CommonModel as Model;
|
use lib\Models\CommonModel as Model;
|
||||||
|
|
||||||
class ServiceModel extends Model
|
class ServiceModel extends Model
|
||||||
@ -14,8 +13,4 @@ class ServiceModel extends Model
|
|||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
} //
|
} //
|
||||||
public function getEntityClass(): string
|
|
||||||
{
|
|
||||||
return Entity::class;
|
|
||||||
}
|
|
||||||
} //Class
|
} //Class
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace lib\Models;
|
namespace lib\Models;
|
||||||
|
|
||||||
use lib\Entities\VPCEntity as Entity;
|
|
||||||
use lib\Models\CommonModel as Model;
|
use lib\Models\CommonModel as Model;
|
||||||
|
|
||||||
class VPCModel extends Model
|
class VPCModel extends Model
|
||||||
@ -14,8 +13,4 @@ class VPCModel extends Model
|
|||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
} //
|
} //
|
||||||
public function getEntityClass(): string
|
|
||||||
{
|
|
||||||
return Entity::class;
|
|
||||||
}
|
|
||||||
} //Class
|
} //Class
|
||||||
|
|||||||
@ -7,7 +7,6 @@ use lib\Models\AddDbModel as Model;
|
|||||||
|
|
||||||
class AddDbService extends CommonService
|
class AddDbService extends CommonService
|
||||||
{
|
{
|
||||||
private ?Model $_model = null;
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
@ -20,24 +19,19 @@ class AddDbService extends CommonService
|
|||||||
{
|
{
|
||||||
return $this->getClassName();
|
return $this->getClassName();
|
||||||
}
|
}
|
||||||
protected function getModel(): Model
|
public function getModelClass(): string
|
||||||
{
|
{
|
||||||
if ($this->_model === null) {
|
return Model::class;
|
||||||
$this->_model = new Model();
|
|
||||||
// $this->_model->setDebug(true);
|
|
||||||
}
|
|
||||||
return $this->_model;
|
|
||||||
}
|
}
|
||||||
|
public function getEntityClass(): string
|
||||||
public function getServiceCodesByCode(string $adddb_code): array
|
{
|
||||||
|
return Entity::class;
|
||||||
|
}
|
||||||
|
public function getEntitysByCode(string $value): array
|
||||||
{
|
{
|
||||||
//AddDBService에서 해당코드의(닷디펜더,딥파인더 등) Service_Code를 가져와서 배열에 저장
|
//AddDBService에서 해당코드의(닷디펜더,딥파인더 등) Service_Code를 가져와서 배열에 저장
|
||||||
$this->getModel()->select('DISTINCT(service_code) AS service_code');
|
$this->getModel()->select('DISTINCT(service_code) AS service_code');
|
||||||
$this->getModel()->where('AddDB_code', $adddb_code);
|
$this->getModel()->where('AddDB_code', $value);
|
||||||
$service_codes = [];
|
return $this->getEntitys();
|
||||||
foreach ($this->getModel()->getEntitys() as $entity) {
|
|
||||||
$service_codes[] = $entity->getServiceCode();
|
|
||||||
}
|
|
||||||
return $service_codes;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,7 +7,6 @@ use lib\Models\ClientModel as Model;
|
|||||||
|
|
||||||
class ClientService extends CommonService
|
class ClientService extends CommonService
|
||||||
{
|
{
|
||||||
private ?Model $_model = null;
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
@ -20,17 +19,17 @@ class ClientService extends CommonService
|
|||||||
{
|
{
|
||||||
return $this->getClassName();
|
return $this->getClassName();
|
||||||
}
|
}
|
||||||
protected function getModel(): Model
|
public function getModelClass(): string
|
||||||
{
|
{
|
||||||
if ($this->_model === null) {
|
return Model::class;
|
||||||
$this->_model = new Model();
|
|
||||||
// $this->_model->setDebug(true);
|
|
||||||
}
|
|
||||||
return $this->_model;
|
|
||||||
}
|
}
|
||||||
public function getEntitByCode(string $code): Entity|null|false
|
public function getEntityClass(): string
|
||||||
{
|
{
|
||||||
$this->getModel()->where("Client_Code", $code);
|
return Entity::class;
|
||||||
return $this->getModel()->getEntity();
|
}
|
||||||
|
public function getEntityByCode(string $value): mixed
|
||||||
|
{
|
||||||
|
$this->getModel()->where("Client_Code", $value);
|
||||||
|
return $this->getEntity();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,13 +3,47 @@
|
|||||||
namespace lib\Services;
|
namespace lib\Services;
|
||||||
|
|
||||||
use lib\Core\Service as Core;
|
use lib\Core\Service as Core;
|
||||||
use lib\Core\Model as Model;
|
|
||||||
|
|
||||||
abstract class CommonService extends Core
|
abstract class CommonService extends Core
|
||||||
{
|
{
|
||||||
|
private $_model = null;
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
} //
|
} //
|
||||||
abstract protected function getModel(): Model;
|
abstract public function getModelClass(): string;
|
||||||
|
abstract public function getEntityClass(): string;
|
||||||
|
final public function getModel(): mixed
|
||||||
|
{
|
||||||
|
if ($this->_model === null) {
|
||||||
|
$modelClass = $this->getModelClass();
|
||||||
|
$this->_model = new $modelClass();
|
||||||
|
// $this->_model->setDebug(true);
|
||||||
|
}
|
||||||
|
return $this->_model;
|
||||||
|
}
|
||||||
|
final public function getEntity(): mixed
|
||||||
|
{
|
||||||
|
$result = $this->getModel()->getResult();
|
||||||
|
if (!$result) { //결과값이 없으면 null
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
$entityClass = $this->getEntityClass();
|
||||||
|
return new $entityClass($result);
|
||||||
|
}
|
||||||
|
final public function getEntitys(): array
|
||||||
|
{
|
||||||
|
$entitys = [];
|
||||||
|
foreach ($this->getModel()->getResults() as $result) {
|
||||||
|
$entityClass = $this->getEntityClass();
|
||||||
|
$entitys[] = new $entityClass($result);
|
||||||
|
}
|
||||||
|
return $entitys;
|
||||||
|
} //
|
||||||
|
final public function getCount(): int
|
||||||
|
{
|
||||||
|
$count = $this->getModel()->countAllResults();
|
||||||
|
// echo "<BR>" . $this->getModel()->getLastQuery();
|
||||||
|
return $count;
|
||||||
|
}
|
||||||
} //Class
|
} //Class
|
||||||
|
|||||||
@ -7,7 +7,6 @@ use lib\Models\HistoryModel as Model;
|
|||||||
|
|
||||||
class HistoryService extends CommonService
|
class HistoryService extends CommonService
|
||||||
{
|
{
|
||||||
private ?Model $_model = null;
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
@ -20,19 +19,18 @@ class HistoryService extends CommonService
|
|||||||
{
|
{
|
||||||
return $this->getClassName();
|
return $this->getClassName();
|
||||||
}
|
}
|
||||||
protected function getModel(): Model
|
public function getModelClass(): string
|
||||||
{
|
{
|
||||||
if ($this->_model === null) {
|
return Model::class;
|
||||||
$this->_model = new Model();
|
}
|
||||||
// $this->_model->setDebug(true);
|
public function getEntityClass(): string
|
||||||
}
|
{
|
||||||
return $this->_model;
|
return Entity::class;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getNews(int $limit = 5): array
|
public function getNews(int $limit = 5): array
|
||||||
{
|
{
|
||||||
$this->getModel()->orderBy($this->getModel()->getPKField(), 'DESC');
|
$this->getModel()->orderBy($this->getModel()->getPKField(), 'DESC');
|
||||||
$this->getModel()->limit($limit);
|
$this->getModel()->limit($limit);
|
||||||
return $this->getModel()->getEntitys();
|
return $this->getEntitys();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,7 +7,6 @@ use lib\Models\KCSModel as Model;
|
|||||||
|
|
||||||
class KCSService extends CommonService
|
class KCSService extends CommonService
|
||||||
{
|
{
|
||||||
private ?Model $_model = null;
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
@ -20,20 +19,17 @@ class KCSService extends CommonService
|
|||||||
{
|
{
|
||||||
return $this->getClassName();
|
return $this->getClassName();
|
||||||
}
|
}
|
||||||
protected function getModel(): Model
|
public function getModelClass(): string
|
||||||
{
|
{
|
||||||
if ($this->_model === null) {
|
return Model::class;
|
||||||
$this->_model = new Model();
|
}
|
||||||
// $this->_model->setDebug(true);
|
public function getEntityClass(): string
|
||||||
}
|
{
|
||||||
return $this->_model;
|
return Entity::class;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCountByServiceCode(string $service_code): int
|
public function getCountByServiceCode(string $service_code): int
|
||||||
{
|
{
|
||||||
$this->getModel()->where("service_code", $service_code);
|
$this->getModel()->where("service_code", $service_code);
|
||||||
$count = $this->getModel()->countAllResults();
|
return $this->getCount();
|
||||||
// echo "<BR>" . $this->getModel()->getLastQuery();
|
|
||||||
return $count;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,7 +7,6 @@ use lib\Models\MemberModel as Model;
|
|||||||
|
|
||||||
class MemberService extends CommonService
|
class MemberService extends CommonService
|
||||||
{
|
{
|
||||||
private ?Model $_model = null;
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
@ -20,17 +19,17 @@ class MemberService extends CommonService
|
|||||||
{
|
{
|
||||||
return $this->getClassName();
|
return $this->getClassName();
|
||||||
}
|
}
|
||||||
public function getModel(): Model
|
public function getModelClass(): string
|
||||||
{
|
{
|
||||||
if ($this->_model === null) {
|
return Model::class;
|
||||||
$this->_model = new Model();
|
}
|
||||||
// $this->_model->setDebug(true);
|
public function getEntityClass(): string
|
||||||
}
|
{
|
||||||
return $this->_model;
|
return Entity::class;
|
||||||
}
|
}
|
||||||
public function getEntitById(string $id): Entity
|
public function getEntitById(string $id): Entity
|
||||||
{
|
{
|
||||||
$this->getModel()->where($this->getModel()->getPKField(), $id);
|
$this->getModel()->where($this->getModel()->getPKField(), $id);
|
||||||
return $this->getModel()->getEntity();
|
return $this->getEntity();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,15 +3,10 @@
|
|||||||
namespace lib\Services;
|
namespace lib\Services;
|
||||||
|
|
||||||
use lib\Entities\ServiceEntity as Entity;
|
use lib\Entities\ServiceEntity as Entity;
|
||||||
use lib\Models\AdddbModel;
|
|
||||||
use lib\Models\ClientModel;
|
|
||||||
use lib\Models\ServiceModel as Model;
|
use lib\Models\ServiceModel as Model;
|
||||||
|
|
||||||
class ServiceService extends CommonService
|
class ServiceService extends CommonService
|
||||||
{
|
{
|
||||||
private ?ClientModel $_clientModel = null;
|
|
||||||
private ?Model $_model = null;
|
|
||||||
private ?AdddbModel $_adddbModel = null;
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
@ -24,27 +19,28 @@ class ServiceService extends CommonService
|
|||||||
{
|
{
|
||||||
return $this->getClassName();
|
return $this->getClassName();
|
||||||
}
|
}
|
||||||
public function getModel(): Model
|
public function getModelClass(): string
|
||||||
{
|
{
|
||||||
if ($this->_model === null) {
|
return Model::class;
|
||||||
$this->_model = new Model();
|
|
||||||
// $this->_model->setDebug(true);
|
|
||||||
}
|
|
||||||
return $this->_model;
|
|
||||||
}
|
}
|
||||||
final public function getClientModel(): ClientModel
|
public function getEntityClass(): string
|
||||||
{
|
{
|
||||||
if ($this->_clientModel === null) {
|
return Entity::class;
|
||||||
$this->_clientModel = new ClientModel();
|
|
||||||
}
|
|
||||||
return $this->_clientModel;
|
|
||||||
}
|
}
|
||||||
public function getAdddbModel(): AdddbModel
|
public function getEntityByCode(string $value): mixed
|
||||||
{
|
{
|
||||||
if ($this->_adddbModel === null) {
|
$this->getModel()->where("service_code", $value);
|
||||||
$this->_adddbModel = new AdddbModel();
|
return $this->getEntity();
|
||||||
}
|
}
|
||||||
return $this->_adddbModel;
|
public function getEntitysByIP(string $value): mixed
|
||||||
|
{
|
||||||
|
$this->getModel()->where("service_ip", $value);
|
||||||
|
return $this->getEntity();
|
||||||
|
}
|
||||||
|
public function getEntitysByCodes(array $values): array
|
||||||
|
{
|
||||||
|
$this->getModel()->whereIn('service_code', $values);
|
||||||
|
return $this->getEntitys();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getNewServerCount(int $day, array $excepts): int|string
|
public function getNewServerCount(int $day, array $excepts): int|string
|
||||||
@ -88,51 +84,11 @@ class ServiceService extends CommonService
|
|||||||
} //foreach
|
} //foreach
|
||||||
return $temps;
|
return $temps;
|
||||||
}
|
}
|
||||||
final public function geServicesBytExtras(array $service_codes): mixed
|
|
||||||
{
|
|
||||||
// 공백 값 제거
|
|
||||||
$service_codes = array_filter($service_codes, function ($value) {
|
|
||||||
return !empty(trim($value)); // 공백 제거 후 비어있지 않은 값만 필터링
|
|
||||||
});
|
|
||||||
// 배열 키를 다시 정렬 (선택 사항)
|
|
||||||
$service_codes = array_values($service_codes);
|
|
||||||
// echo "<BR>" . $this->getAdddbModel()->getLastQuery();
|
|
||||||
// dd($service_codes);
|
|
||||||
if (!count($service_codes)) {
|
|
||||||
// echo $this->getAdddbModel()->getLastQuery();
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
// $this->getModel()->select("clientdb.Client_Name,{$this->getModel()->getTable()}.server_code,{$this->getModel()->getTable()}.service_ip,{$this->getModel()->getTable()}.service_os,{$this->getModel()->getTable()}.service_sw");
|
|
||||||
// $this->getModel()->join('clientdb', "{$this->getModel()->getTable()}.client_code=clientdb.Client_Code");
|
|
||||||
// $this->getModel()->whereIn('service_code', $service_codes);
|
|
||||||
// // $sql = sprintf("SELECT C.Client_Name,S.server_code,S.service_ip,S.service_os,S.service_sw
|
|
||||||
// FROM servicedb AS S JOIN clientdb AS C ON S.client_code = C.Client_Code
|
|
||||||
// WHERE S.service_code IN (SELECT service_code FROM adddb WHERE addDB_code ='%s')", $code);
|
|
||||||
// return $this->getRows($sql);
|
|
||||||
$this->getModel()->whereIn('service_code', $service_codes);
|
|
||||||
return $this->getModel()->getEntitys();
|
|
||||||
}
|
|
||||||
|
|
||||||
final public function getServicesByIP(string $ip): mixed
|
|
||||||
{
|
|
||||||
// 공백 값 제거
|
|
||||||
$ip = trim($ip);
|
|
||||||
// $this->getModel()->select("clientdb.*,{$this->getModel()->getTable()}.*");
|
|
||||||
// $this->getModel()->join('clientdb', "{$this->getModel()->getTable()}.client_code=clientdb.Client_Code");
|
|
||||||
$this->getModel()->where('service_ip', $ip);
|
|
||||||
return $this->getModel()->getEntitys();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getNews(int $limit): array
|
public function getNews(int $limit): array
|
||||||
{
|
{
|
||||||
$this->getModel()->orderBy($this->getModel()->getPKField(), 'DESC');
|
$this->getModel()->orderBy($this->getModel()->getPKField(), 'DESC');
|
||||||
$this->getModel()->limit($limit);
|
$this->getModel()->limit($limit);
|
||||||
return $this->getModel()->getEntitys();
|
return $this->getEntitys();
|
||||||
}
|
|
||||||
|
|
||||||
public function getServiceByServiceCode(string $service_code): Entity|null
|
|
||||||
{
|
|
||||||
$this->getModel()->where("service_code", $service_code);
|
|
||||||
return $this->getModel()->getEntity();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,12 +2,11 @@
|
|||||||
|
|
||||||
namespace lib\Services;
|
namespace lib\Services;
|
||||||
|
|
||||||
use lib\Entities\VPCEntity;
|
use lib\Entities\VPCEntity as Entity;
|
||||||
use lib\Models\VPCModel;
|
use lib\Models\VPCModel as Model;
|
||||||
|
|
||||||
class VPCService extends CommonService
|
class VPCService extends CommonService
|
||||||
{
|
{
|
||||||
private ?VPCModel $_model = null;
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
@ -20,20 +19,17 @@ class VPCService extends CommonService
|
|||||||
{
|
{
|
||||||
return $this->getClassName();
|
return $this->getClassName();
|
||||||
}
|
}
|
||||||
public function getModel(): VPCModel
|
public function getModelClass(): string
|
||||||
{
|
{
|
||||||
if ($this->_model === null) {
|
return Model::class;
|
||||||
$this->_model = new VPCModel();
|
}
|
||||||
// $this->_model->setDebug(true);
|
public function getEntityClass(): string
|
||||||
}
|
{
|
||||||
return $this->_model;
|
return Entity::class;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCountByServiceCode(string $service_code): int
|
public function getCountByServiceCode(string $service_code): int
|
||||||
{
|
{
|
||||||
$this->getModel()->where("service_code", $service_code);
|
$this->getModel()->where("service_code", $service_code);
|
||||||
$count = $this->getModel()->countAllResults();
|
return $this->getCount();
|
||||||
// echo "<BR>" . $this->getModel()->getLastQuery();
|
|
||||||
return $count;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user