dbms_primeidc_init...1

This commit is contained in:
최준흠 2025-03-31 18:49:35 +09:00
parent 3a17120fd1
commit 0e1a73ecbf
41 changed files with 1163 additions and 349 deletions

View File

@ -1,240 +1,20 @@
<?
// 기본 설정 로딩
require_once 'config.php';
require_once 'function.php';
require_once 'lib.php';
<?php
//HTML 시작
use Dotenv\Dotenv;
?>
<!-- Start Base -->
<div id='base'>
<!-- Start Container -->
<div id='container'>
require_once __DIR__ . '/vendor/autoload.php';
$dotenv = Dotenv::createImmutable(__DIR__);
$dotenv->load();
<?
//if ($_GET[page]=='default'){$option='limit 0,5';} else { $option='';}
switch ($_GET[name]) {
case '송충호':$option2 = "or (receiver like '전체' and read_check not like ('%,$_GET[name]%')) or (receiver like '영업' and read_check not like ('%,$_GET[name]%')) ";
break;
case '김효영':$option2 = "or (receiver like '전체' and read_check not like ('%,$_GET[name]%')) or (receiver like '영업' and read_check not like ('%,$_GET[name]%')) ";
break;
#1팀
case '신인철':$option2 = "or (receiver like '전체' and read_check not like ('%,$_GET[name]%')) or (receiver like '팀장' and read_check not like ('%,$_GET[name]%')) or (receiver like '1팀' and read_check not like ('%,$_GET[name]%')) or (receiver like '네트워크' and read_check not like ('%,$_GET[name]%')) ";
break;
case '박요한':$option2 = "or (receiver like '전체' and read_check not like ('%,$_GET[name]%')) or (receiver like '영업' and read_check not like ('%,$_GET[name]%')) or (receiver like '1팀' and read_check not like ('%,$_GET[name]%')) or (receiver like '네트워크' and read_check not like ('%,$_GET[name]%')) ";
break;
case '이지승':$option2 = "or (receiver like '전체' and read_check not like ('%,$_GET[name]%')) or (receiver like '1팀' and read_check not like ('%,$_GET[name]%')) or (receiver like '시스템'and read_check not like ('%,$_GET[name]%')) ";
break;
case '조준희':$option2 = "or (receiver like '전체' and read_check not like ('%,$_GET[name]%')) or (receiver like '1팀' and read_check not like ('%,$_GET[name]%')) or (receiver like '네트워크' and read_check not like ('%,$_GET[name]%')) ";
break;
case '김대영':$option2 = "or (receiver like '전체' and read_check not like ('%,$_GET[name]%')) or (receiver like '1팀' and read_check not like ('%,$_GET[name]%')) or (receiver like '네트워크' and read_check not like ('%,$_GET[name]%')) ";
break;
#2팀
case '김용민':$option2 = "or (receiver like '전체' and read_check not like ('%,$_GET[name]%')) or (receiver like '팀장' and read_check not like ('%,$_GET[name]%')) or (receiver like '2팀'and read_check not like ('%,$_GET[name]%')) or (receiver like '시스템'and read_check not like ('%,$_GET[name]%')) ";
break;
case '이풍호':$option2 = "or (receiver like '전체' and read_check not like ('%,$_GET[name]%')) or (receiver like '2팀'and read_check not like ('%,$_GET[name]%')) or (receiver like '네트워크' and read_check not like ('%,$_GET[name]%')) ";
break;
case '강부중':$option2 = "or (receiver like '전체' and read_check not like ('%,$_GET[name]%')) or (receiver like '2팀'and read_check not like ('%,$_GET[name]%')) or (receiver like '네트워크' and read_check not like ('%,$_GET[name]%')) ";
break;
case '김은혁':$option2 = "or (receiver like '전체' and read_check not like ('%,$_GET[name]%')) or (receiver like '영업' and read_check not like ('%,$_GET[name]%')) or (receiver like '2팀'and read_check not like ('%,$_GET[name]%')) or (receiver like '네트워크' and read_check not like ('%,$_GET[name]%')) ";
break;
case '김영석':$option2 = "or (receiver like '전체' and read_check not like ('%,$_GET[name]%')) or (receiver like '2팀'and read_check not like ('%,$_GET[name]%')) or (receiver like '시스템'and read_check not like ('%,$_GET[name]%')) ";
break;
#기타
case '고병남':$option2 = "or (receiver like '전체' and read_check not like ('%,$_GET[name]%')) or (receiver like '팀장' and read_check not like ('%,$_GET[name]%')) or (receiver like '영업' and read_check not like ('%,$_GET[name]%')) ";
break;
case '최진호':$option2 = "or (receiver like '전체' and read_check not like ('%,$_GET[name]%')) or (receiver like '영업' and read_check not like ('%,$_GET[name]%')) ";
break;
#알바
case '류축복':$option2 = "or (receiver like '전체' and read_check not like ('%,$_GET[name]%')) or (receiver like '알바' and read_check not like ('%,$_GET[name]%')) ";
break;
case '박소영':$option2 = "or (receiver like '전체' and read_check not like ('%,$_GET[name]%')) or (receiver like '알바' and read_check not like ('%,$_GET[name]%')) ";
break;
case '이민제':$option2 = "or (receiver like '전체' and read_check not like ('%,$_GET[name]%')) or (receiver like '알바' and read_check not like ('%,$_GET[name]%')) ";
break;
case '류은총':$option2 = "or (receiver like '전체' and read_check not like ('%,$_GET[name]%')) or (receiver like '알바' and read_check not like ('%,$_GET[name]%')) ";
break;
/*
#기타
case '김효영': $option2="or receiver like '영업'";break;
#1팀
case '신인철': $option2="or receiver like '1팀' or receiver like '팀장' or receiver like '네트워크'";break;
case '박요한': $option2="or receiver like '1팀' or receiver like '영업' or receiver like '네트워크'";break;
case '이지승': $option2="or receiver like '1팀' or receiver like '시스템'";break;
case '조준희': $option2="or receiver like '1팀' or receiver like '네트워크'";break;
case '김대영': $option2="or receiver like '1팀' or receiver like '네트워크'";break;
#2팀
case '김용민': $option2="or receiver like '2팀' or receiver like '팀장' or receiver like '시스템'";break;
case '이풍호': $option2="or receiver like '2팀' or receiver like '네트워크'";break;
case '강부중': $option2="or receiver like '2팀' or receiver like '네트워크'";break;
case '김은혁': $option2="or receiver like '2팀' or receiver like '영업' or receiver like '네트워크'";break;
case '김영석': $option2="or receiver like '2팀' or receiver like '시스템'";break;
#기타
case '고병남': $option2="or receiver like '영업' or receiver like '팀장'";break;
case '최진호': $option2="or receiver like '영업'";break;
#알바
case '류축복': $option2="or receiver like '알바'";break;
case '박소영': $option2="or receiver like '알바'";break;
case '이민제': $option2="or receiver like '알바'";break;
case '류은총': $option2="or receiver like '알바'";break;
*/
default:$option2 = '';
break;
require_once "lib/Core/Config.php";
try {
$control = isset($argv[1]) ? $argv[1] : "lib\\Controllers\\SiteController";
$control = new $control();
$function = isset($argv[2]) ? $argv[2] : "dashboard";
$key_name = "sitekey";
$sitekey = array_key_exists($key_name, $_GET) ? $_GET[$key_name] : false;
$sitekey = isset($arvg[3]) ? $argv[1] : "dbms.prime-idc.jp";
return $control->$function($sitekey);
} catch (\Exception $e) {
echo $e->getMessage();
}
//$query="select * from commentdb where receiver like '$_GET[name]' $option2 or receiver like '전체' and read_check like '0' order by num desc";
//$query2="select * from commentdb where receiver like '$_GET[name]' or receiver like '2팀' or receiver like '팀장' or receiver like '시스템' or receiver like '전체' and read_check like '0' order by num desc";
//$query2="select * from commentdb where (receiver like '$_GET[name]' and read_check like '0') or (receiver like '2팀'and read_check not like ('%,$_GET[name]%')) or (receiver like '팀장'and read_check not like ('%,$_GET[name]%')) or (receiver like '시스템'and read_check not like ('%,$_GET[name]%')) or (receiver like '전체' and read_check not like ('%,$_GET[name]%')) or (receiver like '알바' and read_check not like ('%,$_GET[name]%')) or (receiver like '네트워크' and read_check not like ('%,$_GET[name]%')) or (receiver like '1팀' and read_check not like ('%,$_GET[name]%')) order by num desc";
$query2 = "select * from commentdb where (receiver like '$_GET[name]' and read_check like '0') $option2 order by num desc";
$total = mysql_num_rows(mysql_query($query2, $db_connect));
$total == "0" ? $newicon = "" : $newicon = "<img src=/new-icon.gif border=0><object width=0 height=0 data=\"/jarvis_email.mp3\" type=\"audio/mpeg\"></object>"
//if (isset($_SERVER['HTTP_REFERER']) && preg_match('@^[^/]+://[^/]+@', $_SERVER['HTTP_REFERER'], $match)) {}
// var_dump($match[0]);
?>
<?
/*
preg_match('@^(?:[url]http://)?([/url][^/]+)@i',"http://www.php.net/index.html", $matches);
$host = $matches[1];
preg_match('/[^.]+\.[^.]+$/', $host, $matches);
echo "domain name is: {$matches[0]}\n";
extract(parse_url($_SERVER['HTTP_REFERER']));
echo $scheme .'://'. $host;
*/
//echo $_GET['HTTP_HOST'];
?>
<div class="row">
<div class="col-lg-3 col-md-6">
<div class="panel panel-primary" onclick="location.href='/commentList.cm#receive';" style="cursor: pointer;">
<div class="panel-heading">
<div class="row">
<div class="col-xs-3">
<i class="fa fa-comments fa-5x"></i>
</div>
<div class="col-xs-9 text-right">
<div class="huge"><?=$newicon?><font color=white><?=$total?></font></div>
<div> 쪽지 알림</div>
</div>
</div>
</div>
<a href="#">
<div class="panel-footer">
<span class="pull-left">자세히보기</span>
<span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
<div class="clearfix"></div>
</div>
</a>
</div>
</div>
<?
$day7_server_query = "select service_status,service_open_date,service_line from servicedb where service_open_date > DATE_ADD(now(), INTERVAL -7 DAY) and service_status = 'o' and service_line not in ('test','substitution')";
$day7_server = mysql_num_rows(mysql_query($day7_server_query, $db_connect));
?>
<div class="col-lg-3 col-md-6">
<div class="panel panel-yellow" onclick="location.href='/serviceList.sev';" style="cursor: pointer;">
<div class="panel-heading">
<div class="row">
<div class="col-xs-3">
<i class="fa fa-plus-square-o fa-5x"></i>
</div>
<div class="col-xs-9 text-right">
<div class="huge"><?=$day7_server?></div>
<div>최근 7일간 신규서버 대수</div>
</div>
</div>
</div>
<a href="#">
<div class="panel-footer">
<span class="pull-left">자세히보기</span>
<span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
<div class="clearfix"></div>
</div>
</a>
</div>
</div>
<div class="col-lg-3 col-md-6">
<div class="panel panel-green">
<div class="panel-heading">
<div class="row">
<div class="col-xs-3">
<i class="fa fa-tasks fa-5x"></i>
</div>
<div class="col-xs-9 text-right">
<div class="huge">0</div>
<div>요청업무 알림</div>
</div>
</div>
</div>
<a href="#">
<div class="panel-footer">
<span class="pull-left">자세히보기</span>
<span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
<div class="clearfix"></div>
</div>
</a>
</div>
</div>
<?
$deposit_server_query = "select client_code,service_status,service_payment_date,service_line from servicedb where service_payment_date < now() and service_status = 'o' and service_line not in ('test','substitution') and client_code not in ('C116','C012','C219','')";
$deposit_server = mysql_num_rows(mysql_query($deposit_server_query, $db_connect));
?>
<div class="col-lg-3 col-md-6">
<div class="panel panel-red" onclick="location.href='/IdcDepositNonPaymentListMK.dep';" style="cursor: pointer;">
<div class="panel-heading">
<div class="row">
<div class="col-xs-3">
<i class="fa fa-support fa-5x"></i>
</div>
<div class="col-xs-9 text-right">
<div class="huge"><?=$deposit_server?></div>
<div>금일 기준 미납 서버</div>
</div>
</div>
</div>
<a href="#">
<div class="panel-footer">
<span class="pull-left">자세히보기</span>
<span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
<div class="clearfix"></div>
</div>
</a>
</div>
</div>
</div>
</div>
<!-- End Container -->
<!-- Start Footer -->
<div id='footer'></div>
<!-- End Footer -->
</div>
<!-- End Base -->
<?
//DB닫기
mysql_close($db_connect);
?>

View File

@ -1,17 +1,23 @@
<?php
namespace lib\Core;
use lib\Configs\Config;
use Dotenv\Dotenv;
require_once __DIR__ . '/vendor/autoload.php';
require_once "lib/Core/Constants.php";
require_once "lib/Configs/App.php";
try {
$control = "lib\\Controllers\\{$argv[1]}";
// $control = $argv[1];
$function = $argv[2];
$dotenv = Dotenv::createImmutable(__DIR__);
$dotenv->load();
$control = new $control();
return $control->$function(isset($arvg[3]) ? $argv[3] : "dbms.prime-idc.jp");
// 테스트 URL : "http://test.com/Control/Method/arg1/arg2";
// 요청된 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();
} catch (\Exception $e) {
echo $e->getMessage();
}

View File

@ -0,0 +1,13 @@
<?php
namespace lib\Configs;
use lib\Core\App as Core;
class App extends Core
{
public function __construct(string $url)
{
parent::__construct($url);
} //
}

View File

@ -0,0 +1,73 @@
<?php
namespace lib\Configs;
use lib\Core\Config as Core;
class Config extends Core
{
public function __construct()
{
parent::__construct();
} //
public function getSiteInfo(string $sitekey): array|null
{
$siteinfo = [];
switch ($sitekey) {
case 'dbms.prime-idc.jp':
$siteinfo = [
"id" => "PRIMEIDC",
"domain" => "dbms.prime-idc.jp",
"name" => "PrimeIDC",
"email" => "primeidc.jp@gmail.com",
"totalcount_types" => ["normal", "defence", "solo", "substitution", "test"],
"totalcount_customers" => [
"idcjp" => "Client_Code NOT IN ('C116','C012','C636')",
"winidc" => "Client_Code='C116'",
"gamewing" => "Client_Code='C012'",
"GDIDC" => "Client_Code='C636'",
],
"banks" => [
["id" => "331301-04-217387", "name" => '국민은행', "owner" => "주)듀나미스"],
],
];
break;
case 'dbms.itsolution-idc.jp':
$siteinfo = [
"id" => "ITSOLUTION",
"domain" => "dbms.itsolution-idc.jp",
"name" => "Itsolution",
"email" => "support@itsoution-idc.jp",
"totalcount_types" => ["normal", "defence", "solo", "substitution", "test"],
"totalcount_customers" => [
"winidc" => "Client_Code NOT IN ('C237')",
"bosch" => "Client_Code='C237'",
],
"banks" => [
["id" => "9002-1932-1654-1", "name" => '새마을금고', "owner" => "주식회사 르호봇"],
["id" => "351-0995-6751-73", "name" => '농협', "owner" => "주식회사 르호봇"],
],
];
break;
case 'dbms.gdidc.jp':
$siteinfo = [
"id" => "GDIDC",
"domain" => "dbms.gdidc.jp",
"name" => "GDIDC",
"email" => "support@gdidc.jp",
"totalcount_types" => ["normal", "defence", "solo", "substitution", "test"],
"totalcount_customers" => [
"gdidc" => "",
],
"banks" => [
["id" => "1005-204-100758", "name" => '우리은행', "owner" => " (주)브엘라해로이"],
],
];
break;
default:
$siteinfo = null;
break;
}
return $siteinfo;
}
}

View File

@ -0,0 +1,13 @@
<?php
namespace lib\Configs;
use lib\Core\View as Core;
class View extends Core
{
public function __construct()
{
parent::__construct();
} //
}

View File

@ -2,11 +2,11 @@
namespace lib\Controllers;
use lib\Core\Controller;
use lib\Core\Controller as Core;
use lib\Models\ClientModel;
use lib\Models\ServiceModel;
abstract class CommonController extends Controller
abstract class CommonController extends Core
{
protected function __construct()
{

View File

@ -2,14 +2,28 @@
namespace lib\Controllers;
use lib\Services\AddDbService;
use lib\Services\ClientService;
use lib\Services\HistoryService;
use lib\Services\KCSService;
use lib\Services\MemberService;
use lib\Services\ServiceService;
use lib\Services\VPCService;
use lib\Helpers\ServiceHelper;
class SiteController extends CommonController
{
private ?ServiceService $_service = null;
private ?MemberService $_memberService = null;
private ?ClientService $_clientService = null;
private ?VPCService $_vpcService = null;
private ?KCSService $_kcsService = null;
private ?HistoryService $_historyService = null;
private ?AddDbService $_addDbService = null;
public function __construct()
{
parent::__construct();
$this->helper = new ServiceHelper();
} //
public function getService(): ServiceService
@ -20,6 +34,54 @@ class SiteController extends CommonController
return $this->_service;
}
public function getMemberService(): MemberService
{
if ($this->_memberService === null) {
$this->_memberService = new MemberService();
}
return $this->_memberService;
}
public function getClientService(): ClientService
{
if ($this->_clientService === null) {
$this->_clientService = new ClientService();
}
return $this->_clientService;
}
public function getVPCService(): VPCService
{
if ($this->_vpcService === null) {
$this->_vpcService = new VPCService();
}
return $this->_vpcService;
}
public function getKCSService(): KCSService
{
if ($this->_kcsService === null) {
$this->_kcsService = new KCSService();
}
return $this->_kcsService;
}
public function getHistoryService(): HistoryService
{
if ($this->_historyService === null) {
$this->_historyService = new HistoryService();
}
return $this->_historyService;
}
public function getAddDbService(): AddDbService
{
if ($this->_addDbService === null) {
$this->_addDbService = new AddDbService();
}
return $this->_addDbService;
}
//Dashboard , default_alert.php
//CLI 접속방법 : php index.php SiteController/dashboard
//WEB 접속방법 : http://localhost/SiteController/dashboard
public function dashboard()
{
// 최근7일 신규서버수
@ -35,9 +97,18 @@ class SiteController extends CommonController
}
//서비스카운팅 , total_counting.php
public function totalcount(string $sitekey): string
//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
{
$this->siteInfo = DBMS_SITEINFOS[$sitekey];
$sitekey = $this->getSegments('sitekey');
if ($sitekey === null) {
throw new \Exception("sitekey 값이 정의되지 않았습니다.");
}
$this->siteInfo = $this->getConfig()->getSiteInfo($sitekey);
if ($this->siteInfo === null) {
throw new \Exception("[{$sitekey}] 값에 해당하는 사이트정보가 존재하지 않습니다.");
}
$this->totalcount = $this->getService()->getTotalCount($this->siteInfo);
// echo $sitekey;
// dd($this->siteInfo);
@ -63,4 +134,98 @@ class SiteController extends CommonController
$this->total = $total;
return $this->render(__FUNCTION__);
}
//신규서버현황 new_server_list.php
//CLI 접속방법 : php index.php SiteController/newservices/limit/5
//WEB 접속방법 : http://localhost/SiteController/newservices/limit/5
public function newservices(): string
{
//신규서버정보
$this->limit = intval($this->getSegments('limit') ?? 5);
$this->entitys = $this->getService()->getNews($this->limit);
// echo $this->getService()->getModel()->getLastQuery();
// 배열 초기화를 명시적으로 수행
$users = [];
$clients = [];
$vpcs = [];
$kcss = [];
$cnt = 1;
foreach ($this->entitys as $entity) {
$serviceCode = $entity->getServiceCode();
//관리자정보(등록자)
$users[$serviceCode] = $entity->getMemberCode() ? $this->getMemberService()->getEntitById($entity->getMemberCode()) : "";
//고객정보
$clients[$serviceCode] = $this->getClientService()->getEntitByCode($entity->getClientCode());
//VPC정보
$vpcs[$serviceCode] = $this->getVPCService()->getCountByServiceCode($serviceCode);
//KCS정보
$kcss[$serviceCode] = $this->getKCSService()->getCountByServiceCode($serviceCode);
$cnt++;
}
// dd($this->entitys);
// 루프가 끝난 후 한번에 속성 할당
$this->users = $users;
$this->clients = $clients;
$this->vpcs = $vpcs;
$this->kcss = $kcss;
return $this->render(__FUNCTION__);
}
//CLI 접속방법 : php index.php SiteController/newhistorys/limit/5
//WEB 접속방법 : http://localhost/SiteController/newhistorys/limit/5
public function newhistorys(): string
{
//신규서버정보
$this->limit = intval($this->getSegments('limit') ?? 5);
$this->entitys = $this->getHistoryService()->getNews($this->limit);
// 배열 초기화를 명시적으로 수행
$services = [];
$clients = [];
foreach ($this->entitys as $entity) {
$pk = $entity->getPK();
//서비스정보가져오기
$service = $this->getService()->getServiceByServiceCode($entity->getServiceCode());
if ($service) {
//고객정보
$clients[$pk] = $this->getClientService()->getEntitByCode($entity->getClientCode());
//서비스정보
$services[$pk] = $service;
}
}
// 루프가 끝난 후 한번에 속성 할당
$this->services = $services;
$this->clients = $clients;
return $this->render(__FUNCTION__);
}
//청구서페이지, 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
{
$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 값이 정의되지 않았습니다.");
}
$this->siteInfo = $this->getConfig()->getSiteInfo($sitekey);
$this->client = $this->getClientService()->getEntitByCode($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
{
$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);
$this->services = $this->getService()->getExtras($service_codes);
return $this->render(__FUNCTION__);
}
} //Class

78
extdbms/lib/Core/App.php Normal file
View File

@ -0,0 +1,78 @@
<?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

View File

@ -0,0 +1,27 @@
<?php
namespace lib\Core;
abstract class Config
{
private $_values = [];
private $_debug = false;
protected function __construct() {} //
final public function setDebug($debug)
{
$this->_debug = $debug;
}
final public function getDebug()
{
return $this->_debug;
}
final public function __get($name)
{
return $this->_values[$name];
}
final public function __set($name, $value)
{
$this->_values[$name] = $value;
}
} //Class

View File

@ -1,49 +0,0 @@
<?php
#SIteInfo
//DBMS Site정보
define('DBMS_SITEINFOS', [
'dbms.prime-idc.jp' => [
"id" => "PRIMEIDC",
"domain" => "dbms.prime-idc.jp",
"name" => "PrimeIDC",
"email" => "primeidc.jp@gmail.com",
"totalcount_types" => ["normal", "defence", "solo", "substitution", "test"],
"totalcount_customers" => [
"idcjp" => "Client_Code NOT IN ('C116','C012','C636')",
"winidc" => "Client_Code='C116'",
"gamewing" => "Client_Code='C012'",
"GDIDC" => "Client_Code='C636'",
],
"banks" => [
["id" => "331301-04-217387", "name" => '국민은행', "owner" => "주)듀나미스"]
]
],
'dbms.itsolution-idc.jp' => [
"id" => "ITSOLUTION",
"domain" => "dbms.itsolution-idc.jp",
"name" => "Itsolution",
"email" => "support@itsoution-idc.jp",
"totalcount_types" => ["normal", "defence", "solo", "substitution", "test"],
"totalcount_customers" => [
"winidc" => "Client_Code NOT IN ('C237')",
"bosch" => "Client_Code='C237'",
],
"banks" => [
["id" => "9002-1932-1654-1", "name" => '새마을금고', "owner" => "주식회사 르호봇"],
["id" => "351-0995-6751-73", "name" => '농협', "owner" => "주식회사 르호봇"],
],
],
'dbms.gdidc.jp' => [
"id" => "GDIDC",
"domain" => "dbms.gdidc.jp",
"name" => "GDIDC",
"email" => "support@gdidc.jp",
"totalcount_types" => ["normal", "defence", "solo", "substitution", "test"],
"totalcount_customers" => [
"gdidc" => "",
],
"banks" => [
["id" => "1005-204-100758", "name" => '우리은행', "owner" => " (주)브엘라해로이"],
],
]
]);

View File

@ -2,34 +2,44 @@
namespace lib\Core;
use lib\Core\View;
use lib\Configs\Config;
use lib\Configs\View;
abstract class Controller
{
private $_debug = false;
protected $view = null;
private ?Config $_config = null;
private ?View $_view = null;
private $_segments = [];
protected function __construct()
{
$this->view = new View();
$this->_config = new Config();
$this->_view = new View();
} //
final public function setDebug($debug)
final public function getConfig(): Config
{
$this->_debug = $debug;
return $this->_config;
}
final public function getDebug()
final public function setSegments(array $segments)
{
return $this->_debug;
$this->_segments = $segments;
}
final public function getSegments(string $key = ""): mixed
{
if ($key === "") {
return $this->_segments;
}
return array_key_exists($key, $this->_segments) ? $this->_segments[$key] : null;
}
final public function __get($name)
{
return $this->view->$name;
return $this->_view->$name;
}
final public function __set($name, $value)
{
$this->view->$name = $value;
$this->_view->$name = $value;
}
public function render($file)
{
return $this->view->render($file);
return $this->_view->render($file);
}
} //Class

View File

@ -2,13 +2,13 @@
namespace lib\Core;
class Entity
abstract class Entity
{
private $_values = [];
private $_debug = false;
public function __construct($datas)
protected function __construct($datas)
{
$this->values = $datas;
$this->_values = $datas;
} //
final public function setDebug($debug)
{

View File

@ -0,0 +1,8 @@
<?php
namespace lib\Core;
abstract class Helper
{
protected function __construct() {} //
} //Class

View File

@ -145,33 +145,33 @@ abstract class Model
{
$this->_querys["JOIN"] = " {$type} JOIN {$table} ON {$match}";
}
final public function orderBy(mixed $columns, mixed $direction = null): void
final public function orderBy(string $column, string $direction = "DESC"): void
{
$this->_querys["ORDERBY"] = " ORDERBY " . $this->makeQuery($columns, $direction, " ");
$this->_querys["ORDERBY"] = " ORDER BY {$column} {$direction}";
}
final public function limit(int $start, mixed $end = "", bool $offset = false): void
final public function limit(int $start, int $offset = 0): void
{
$this->_querys["LIMIT"] = " LIMIT {$start} " . $offset ? "OFFSET " : "," . $end;
$offset = $offset > 0 ? ",{$offset}" : "";
$this->_querys["LIMIT"] = " LIMIT {$start} {$offset}";
}
//Result
protected function getResult($mode = PDO::FETCH_ASSOC): mixed
{
$query = "{$this->_querys['SELECT']} FROM {$this->getTable()} {$this->getWhere()} {$this->_querys['JOIN']} {$this->_querys['ORDERBY']}";
$query = "{$this->_querys['SELECT']} FROM {$this->getTable()} {$this->getWhere()} {$this->_querys['JOIN']} {$this->_querys['LIMIT']} {$this->_querys['ORDERBY']}";
$stmt = $this->execute($query);
return $stmt->fetch($mode);
}
protected function getResults($mode = PDO::FETCH_ASSOC): mixed
{
$query = "{$this->_querys["SELECT"]} FROM {$this->getTable()} {$this->getWhere()} {$this->_querys['JOIN']} {$this->_querys['ORDERBY']}";
$query = "{$this->_querys['SELECT']} {$this->_querys['JOIN']} {$this->_querys['ORDERBY']}";
$query = "{$this->_querys["SELECT"]} FROM {$this->getTable()} {$this->getWhere()} {$this->_querys['JOIN']} {$this->_querys['ORDERBY']} {$this->_querys['LIMIT']}";
$stmt = $this->execute($query);
return $stmt->fetchAll($mode);
}
final public function countAllResults(string $column = "*", $reset = true): int
{
$this->_reset = $reset;
$query = "SELECT COUNT({$column}) FROM {$this->getTable()} {$this->getWhere()} {$this->_querys['JOIN']} {$this->_querys['ORDERBY']}";
$query = "SELECT COUNT({$column}) FROM {$this->getTable()} {$this->getWhere()} {$this->_querys['JOIN']}";
$stmt = $this->execute($query);
$count = $stmt->fetchColumn(0);
$this->_reset = true;

View File

@ -1,13 +1,12 @@
<?php
namespace lib\Core;
class View
abstract class View
{
private $_values = [];
private $_debug = false;
public function __construct()
{
} //
protected function __construct() {} //
final public function setDebug($debug)
{
$this->_debug = $debug;

View File

@ -10,4 +10,8 @@ class ClientEntity extends Entity
{
parent::__construct($datas);
} //
public function getTitle()
{
$this->Client_Name;
}
} //Class

View File

@ -2,10 +2,14 @@
namespace lib\Core;
abstract class CommonEntity extends Entity
use lib\Core\Entity as Core;
abstract class CommonEntity extends Core
{
public function __construct($datas)
{
parent::__construct($datas);
} //
abstract public function getTitle();
abstract public function getPK();
} //Class

View File

@ -0,0 +1,13 @@
<?php
namespace lib\Entities;
use lib\Core\Entity;
class HistoryEntity extends Entity
{
public function __construct($datas)
{
parent::__construct($datas);
} //
} //Class

View File

@ -0,0 +1,13 @@
<?php
namespace lib\Entities;
use lib\Core\Entity;
class KCSEntity extends Entity
{
public function __construct($datas)
{
parent::__construct($datas);
} //
} //Class

View File

@ -0,0 +1,34 @@
<?php
namespace lib\Entities;
use lib\Core\Entity;
class MemberEntity extends Entity
{
public function __construct($datas)
{
parent::__construct($datas);
} //
public function getTitle(): string
{
return $this->getName();
}
//공통부분
public function getId(): string
{
return $this->id;
}
public function getPassword(): string
{
return $this->pass;
}
public function getName(): string
{
return $this->name;
}
public function getRole(): string
{
return $this->role;
}
} //Class

View File

@ -10,4 +10,17 @@ class ServiceEntity extends Entity
{
parent::__construct($datas);
} //
public function getServiceCode(): mixed
{
return $this->service_code;
}
public function getMemberCode(): mixed
{
return $this->service_manager;
}
public function getClientCode(): mixed
{
return $this->client_code;
}
} //Class

View File

@ -0,0 +1,13 @@
<?php
namespace lib\Entities;
use lib\Core\Entity;
class VPCEntity extends Entity
{
public function __construct($datas)
{
parent::__construct($datas);
} //
} //Class

View File

@ -0,0 +1,135 @@
<?php
namespace lib\Helpers;
use lib\Core\Helper as Core;
abstract class CommonHelper extends Core
{
public function __construct()
{
parent::__construct();
} //
final public function getRandomString($length = 10, $characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
{
return substr(str_shuffle($characters), 0, $length);
}
final public function getPasswordString($length = 8)
{
return $this->getRandomString($length, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_-=+;:,.?");
}
final function truncateString(string $text, int $maxLength = 10): string
{
if (mb_strlen($text, 'UTF-8') > $maxLength) {
return mb_substr($text, 0, $maxLength, 'UTF-8') . "...";
}
return $text;
}
// byte값을 알아보기 쉽게 변환
final public function getSizeForHuman($bytes)
{
$ext = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
$unitCount = 0;
for (; $bytes > 1024; $unitCount++) {
$bytes /= 1024;
}
return floor($bytes) . $ext[$unitCount];
}
// Proxy등을 통하여 Client_IP가 알수없는경우 실제사용자의 IP를 가져오기 위한것
final public function getClientIP($clientIP = false)
{
if (isset($_SERVER['HTTP_CLIENT_IP'])) {
$clientIP = $_SERVER['HTTP_CLIENT_IP'];
} else if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$clientIP = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else if (isset($_SERVER['HTTP_X_FORWARDED'])) {
$clientIP = $_SERVER['HTTP_X_FORWARDED'];
} else if (isset($_SERVER['HTTP_FORWARDED_FOR'])) {
$clientIP = $_SERVER['HTTP_FORWARDED_FOR'];
} else if (isset($_SERVER['HTTP_FORWARDED'])) {
$clientIP = $_SERVER['HTTP_FORWARDED'];
} else if (isset($_SERVER['REMOTE_ADDR'])) {
$clientIP = $_SERVER['REMOTE_ADDR'];
}
return $clientIP;
}
final public function isDomain(string $domain): bool
{
$pattern_validation = '/((http|https)\:\/\/)?[a-zA-Z0-9\.\/\?\:@\-_=#]+\.([a-zA-Z0-9\&\.\/\?\:@\-_=#])*/';
return preg_match($pattern_validation, $domain);
}
final public function isIPAddress(string $ip, $type = false): bool
{
switch ($type) {
case 'ipv4':
$result = filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4);
break;
case 'ipv6':
$result = filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6);
break;
case 'all':
$result = filter_var($ip, FILTER_VALIDATE_IP);
break;
default:
$result = filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE);
break;
}
return $result;
}
final public function isHost(string $host): bool
{
$pattern_validation = '/[a-zA-Z0-9\.\/\?\:@\*\-_=#]/';
return preg_match($pattern_validation, $host);
}
// (EX:192.168.1.0 -> 192.168.001.000)
final public function convertIPV4toCIDR($cidr)
{
$temps = explode(".", $cidr);
return sprintf("%03d.%03d.%03d.%03d", $temps[0], $temps[1], $temps[2], $temps[3]);
}
// (EX:192.168.001.0000 -> 192.168.1.0)
final public function convertCIDRtoIPV4($ipv4)
{
$temps = explode(".", $ipv4);
return sprintf("%d.%d.%d.%d", $temps[0], $temps[1], $temps[2], $temps[3]);
}
final public function isMobile()
{
// Check the server headers to see if they're mobile friendly
if (isset($_SERVER["HTTP_X_WAP_PROFILE"])) {
return true;
}
// If the http_accept header supports wap then it's a mobile too
if (preg_match("/wap\.|\.wap/i", $_SERVER["HTTP_ACCEPT"])) {
return true;
}
// Still no luck? Let's have a look at the user agent on the browser. If it contains
// any of the following, it's probably a mobile device. Kappow!
if (isset($_SERVER["HTTP_USER_AGENT"])) {
$user_agents = array("midp", "j2me", "avantg", "docomo", "novarra", "palmos", "palmsource", "240x320", "opwv", "chtml", "pda", "windows\ ce", "mmp\/", "blackberry", "mib\/", "symbian", "wireless", "nokia", "hand", "mobi", "phone", "cdm", "up\.b", "audio", "SIE\-", "SEC\-", "samsung", "HTC", "mot\-", "mitsu", "sagem", "sony", "alcatel", "lg", "erics", "vx", "NEC", "philips", "mmm", "xx", "panasonic", "sharp", "wap", "sch", "rover", "pocket", "benq", "java", "pt", "pg", "vox", "amoi", "bird", "compal", "kg", "voda", "sany", "kdd", "dbt", "sendo", "sgh", "gradi", "jb", "\d\d\di", "moto");
foreach ($user_agents as $user_string) {
if (preg_match("/" . $user_string . "/i", $_SERVER["HTTP_USER_AGENT"])) {
return true;
}
}
}
// Let's NOT return "mobile" if it's an iPhone, because the iPhone can render normal pages quite well.
if (preg_match("/iphone/i", $_SERVER["HTTP_USER_AGENT"])) {
return false;
}
// None of the above? Then it's probably not a mobile device.
return false;
}
} //Class

View File

@ -0,0 +1,11 @@
<?php
namespace lib\Helpers;
class ServiceHelper extends CommonHelper
{
public function __construct()
{
parent::__construct();
} //
} //Class

View File

@ -6,6 +6,9 @@ use lib\Entities\AdddbEntity as Entity;
class AddDbModel extends CommonModel
{
const TABLE = "adddb";
const PK = "addDB_num";
const TITLE = "addDB_case";
public function __construct()
{
parent::__construct();
@ -13,15 +16,15 @@ class AddDbModel extends CommonModel
final public function getTable(): string
{
return 'adddb';
return self::TABLE;
}
final public function getPKField(): string
{
return 'addDB_num';
return self::PK;
}
final public function getTitleField(): string
{
return 'addDB_case';
return self::TITLE;
}
final public function getEntity(): Entity

View File

@ -2,9 +2,10 @@
namespace lib\Models;
use lib\Core\Model as Model;
use lib\Core\Model as Core;
use lib\Entity\Entity;
abstract class CommonModel extends Model
abstract class CommonModel extends Core
{
public function __construct()
{

View File

@ -0,0 +1,42 @@
<?php
namespace lib\Models;
use lib\Entities\HistoryEntity as Entity;
class HistoryModel extends CommonModel
{
const TABLE = "historydb";
const PK = "history_num";
const TITLE = "behavior";
public function __construct()
{
parent::__construct();
} //
final public function getTable(): string
{
return self::TABLE;
}
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

View File

@ -0,0 +1,42 @@
<?php
namespace lib\Models;
use lib\Entities\KCSEntity as Entity;
class KCSModel extends CommonModel
{
const TABLE = "kcsdb";
const PK = "kcs_num";
const TITLE = "kcs_code";
public function __construct()
{
parent::__construct();
} //
final public function getTable(): string
{
return self::TABLE;
}
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

View File

@ -0,0 +1,42 @@
<?php
namespace lib\Models;
use lib\Entities\MemberEntity as Entity;
class MemberModel extends CommonModel
{
const TABLE = "memberdb";
const PK = "id";
const TITLE = "name";
public function __construct()
{
parent::__construct();
} //
final public function getTable(): string
{
return self::TABLE;
}
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

View File

@ -0,0 +1,42 @@
<?php
namespace lib\Models;
use lib\Entities\VPCEntity as Entity;
class VPCModel extends CommonModel
{
const TABLE = "vpcdb";
const PK = "vpc_num";
const TITLE = "vpc_code";
public function __construct()
{
parent::__construct();
} //
final public function getTable(): string
{
return self::TABLE;
}
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

View File

@ -0,0 +1,43 @@
<?php
namespace lib\Services;
use lib\Entities\AddDbEntity as Entity;
use lib\Models\AddDbModel as Model;
class AddDbService extends CommonService
{
private ?Model $_model = null;
public function __construct()
{
parent::__construct();
}
final public function getClassName(): string
{
return "Adddb";
}
final public function getClassPath(): string
{
return $this->getClassName();
}
protected function getModel(): Model
{
if ($this->_model === null) {
$this->_model = new Model();
$this->_model->setDebug(true);
}
return $this->_model;
}
public function getServiceCodesByCode(string $adddb_code): array
{
//AddDBService에서 해당코드의(닷디펜더,딥파인더 등) Service_Code를 가져와서 배열에 저장
$this->getModel()->select('DISTINCT(service_code) AS service_code');
$this->getModel()->where('AddDB_code', $adddb_code);
$service_codes = [];
foreach ($this->getModel()->getEntitys() as $entity) {
$service_codes = $entity->getServiceCode();
}
return $service_codes;
}
}

View File

@ -0,0 +1,36 @@
<?php
namespace lib\Services;
use lib\Entities\ClientEntity as Entity;
use lib\Models\ClientModel as Model;
class ClientService extends CommonService
{
private ?Model $_model = null;
public function __construct()
{
parent::__construct();
}
final public function getClassName(): string
{
return "Client";
}
final public function getClassPath(): string
{
return $this->getClassName();
}
protected function getModel(): Model
{
if ($this->_model === null) {
$this->_model = new Model();
$this->_model->setDebug(true);
}
return $this->_model;
}
public function getEntitByCode(string $code): Entity
{
$this->getModel()->where("Client_Code", $code);
return $this->getModel()->getEntity();
}
}

View File

@ -2,12 +2,14 @@
namespace lib\Services;
use lib\Core\Service as Service;
use lib\Core\Service as Core;
use lib\Core\Model as Model;
abstract class CommonService extends Service
abstract class CommonService extends Core
{
public function __construct()
{
parent::__construct();
} //
abstract protected function getModel(): Model;
} //Class

View File

@ -0,0 +1,38 @@
<?php
namespace lib\Services;
use lib\Entities\HistoryEntity as Entity;
use lib\Models\HistoryModel as Model;
class HistoryService extends CommonService
{
private ?Model $_model = null;
public function __construct()
{
parent::__construct();
}
final public function getClassName(): string
{
return "History";
}
final public function getClassPath(): string
{
return $this->getClassName();
}
protected function getModel(): Model
{
if ($this->_model === null) {
$this->_model = new Model();
$this->_model->setDebug(true);
}
return $this->_model;
}
public function getNews(int $limit = 5): array
{
$this->getModel()->orderBy($this->getModel()->getPKField(), 'DESC');
$this->getModel()->limit($limit);
return $this->getModel()->getEntitys();
}
}

View File

@ -0,0 +1,39 @@
<?php
namespace lib\Services;
use lib\Entities\KCSEntity as Entity;
use lib\Models\KCSModel as Model;
class KCSService extends CommonService
{
private ?Model $_model = null;
public function __construct()
{
parent::__construct();
}
final public function getClassName(): string
{
return "KCS";
}
final public function getClassPath(): string
{
return $this->getClassName();
}
protected function getModel(): Model
{
if ($this->_model === null) {
$this->_model = new Model();
$this->_model->setDebug(true);
}
return $this->_model;
}
public function getCountByServiceCode(string $service_code): int
{
$this->getModel()->where("service_code", $service_code);
$count = $this->getModel()->countAllResults();
// echo "<BR>" . $this->getModel()->getLastQuery();
return $count;
}
}

View File

@ -0,0 +1,36 @@
<?php
namespace lib\Services;
use lib\Entities\MemberEntity as Entity;
use lib\Models\MemberModel as Model;
class MemberService extends CommonService
{
private ?Model $_model = null;
public function __construct()
{
parent::__construct();
}
final public function getClassName(): string
{
return "Member";
}
final public function getClassPath(): string
{
return $this->getClassName();
}
public function getModel(): Model
{
if ($this->_model === null) {
$this->_model = new Model();
$this->_model->setDebug(true);
}
return $this->_model;
}
public function getEntitById(string $id): Entity
{
$this->getModel()->where($this->getModel()->getPKField(), $id);
return $this->getModel()->getEntity();
}
}

View File

@ -2,15 +2,15 @@
namespace lib\Services;
use lib\Entities\ServiceEntity;
use lib\Entities\ServiceEntity as Entity;
use lib\Models\AdddbModel;
use lib\Models\ClientModel;
use lib\Models\ServiceModel;
use lib\Models\ServiceModel as Model;
class ServiceService extends CommonService
{
private ?ClientModel $_clientModel = null;
private ?ServiceModel $_model = null;
private ?Model $_model = null;
private ?AdddbModel $_adddbModel = null;
public function __construct()
{
@ -24,10 +24,10 @@ class ServiceService extends CommonService
{
return $this->getClassName();
}
public function getModel(): ServiceModel
public function getModel(): Model
{
if ($this->_model === null) {
$this->_model = new ServiceModel();
$this->_model = new Model();
$this->_model->setDebug(true);
}
return $this->_model;
@ -90,14 +90,8 @@ class ServiceService extends CommonService
} //foreach
return $temps;
}
final public function getExtras(string $addDB_code): mixed
final public function getExtras(array $service_codes): mixed
{
$this->getAdddbModel()->select('DISTINCT(service_code) AS service_code');
$this->getAdddbModel()->where('addDB_code', $addDB_code);
$service_codes = [];
foreach ($this->getAdddbModel()->getEntitys() as $entity) {
$service_codes = $entity->getServiceCode();
}
// 공백 값 제거
$service_codes = array_filter($service_codes, function ($value) {
return !empty(trim($value)); // 공백 제거 후 비어있지 않은 값만 필터링
@ -120,14 +114,14 @@ class ServiceService extends CommonService
return $this->getModel()->getEntitys();
}
public function getNews(int $limit = 5): array
public function getNews(int $limit): array
{
$this->getModel()->orderBy($this->getModel()->getPKField(), direction: 'DESC');
$this->getModel()->orderBy($this->getModel()->getPKField(), 'DESC');
$this->getModel()->limit($limit);
return $this->getModel()->getEntitys();
}
public function getServiceByServiceCode(string $service_code): ServiceEntity|null
public function getServiceByServiceCode(string $service_code): Entity|null
{
$this->getModel()->where("service_code", $service_code);
return $this->getModel()->getEntity();

View File

@ -0,0 +1,39 @@
<?php
namespace lib\Services;
use lib\Entities\VPCEntity;
use lib\Models\VPCModel;
class VPCService extends CommonService
{
private ?VPCModel $_model = null;
public function __construct()
{
parent::__construct();
}
final public function getClassName(): string
{
return "VPC";
}
final public function getClassPath(): string
{
return $this->getClassName();
}
public function getModel(): VPCModel
{
if ($this->_model === null) {
$this->_model = new VPCModel();
$this->_model->setDebug(true);
}
return $this->_model;
}
public function getCountByServiceCode(string $service_code): int
{
$this->getModel()->where("service_code", $service_code);
$count = $this->getModel()->countAllResults();
// echo "<BR>" . $this->getModel()->getLastQuery();
return $count;
}
}

View File

@ -0,0 +1,43 @@
<table class="table table-bordered table-hover table-striped">
<thead>
<tr>
<th style="text-align:center;width:100px;">서비스코드</th>
<th style="text-align:center;width:100px;">업체명</th>
<th style="text-align:center;width:80px;">구분</th>
<th style="text-align:center;width:100px;">장비번호</th>
<th style="text-align:center;width:140px;">스위치정보</th>
<th style="text-align:center;width:140px;">IP정보</th>
<th style="text-align:center;width:50px;">CS</th>
<th style="text-align:center;width:80px;">등록자</th>
<th style="text-align:center;width:100px;">비고</th>
</tr>
</thead>
<tbody>
<?php foreach ($this->entitys as $entity): ?>
<?php $this->entity = $entity ?>
<tr>
<td style="text-align:center;"><a href="/serviceDetailSolo.sev?client_code=<?= $entity->client_code ?>&service_code=<?= $entity->service_code ?>"><?= $entity->service_code ?></a></td>
<td style="text-align:center;">
<nobr style=" display:block;"><?= $this->clients[$entity->getServiceCode()]->getTitle() ?></nobr>
</td>
<td style="text-align:center;"><?= $entity->service_line ?></td>
<td style="text-align:center;">
<nobr style=" display:block;"><?= $entity->service_code ?></nobr>
</td>
<td style="text-align:center;">
<nobr style=" display:block;"><?= $entity->service_sw ?></nobr>
</td>
<td style="text-align:center;"><?= $entity->service_ip ?></td>
<td style="text-align:center;">
<a href="/vpcInfo.sev?client_code=<?= $entity->client_code ?>&csInfoFlag=true&service_code=<?= $entity->service_code ?>"><?= $this->vpcs[$entity->getServiceCode()] ?></a>
/
<a href="/vpcInfo.sev?client_code=<?= $entity->client_code ?>&csInfoFlag=true&service_code=<?= $entity->service_code ?>"><?= $this->kcss[$entity->getServiceCode()] ?></a>
</td>
<td style="text-align:center;"><?= !$this->users[$entity->getServiceCode()] ? "" : $this->users[$entity->getServiceCode()]->getTitle() ?></td>
<td>
<nobr style=" display:block;"><?= $this->helper->truncateString($entity->service_note, 20) ?></nobr>
</td>
</tr>
<?php endforeach ?>
</tbody>
</table>

View File

@ -1,11 +1,20 @@
<?php
namespace lib\Controllers;
use Dotenv\Dotenv;
require_once "lib/autoload.php";
require_once __DIR__ . '/vendor/autoload.php';
$dotenv = Dotenv::createImmutable(__DIR__);
$dotenv->load();
require_once "lib/Configs/Config.php";
try {
$control = new DashboardController();
return $control->mainPage();
$control = isset($argv[1]) ? $argv[1] : "lib\\Controllers\\SiteController";
$control = new $control();
$function = isset($argv[2]) ? $argv[2] : "totalcount";
$key_name = "sitekey";
$sitekey = array_key_exists($key_name, $_GET) ? $_GET[$key_name] : false;
$sitekey = isset($arvg[3]) ? $argv[1] : "dbms.prime-idc.jp";
return $control->$function($sitekey);
} catch (\Exception $e) {
die($e->getMessage());
echo $e->getMessage();
}