dbms_primeidc_init...1

This commit is contained in:
최준흠 2025-04-23 19:28:58 +09:00
parent abfa528c24
commit 3bbf8f87af
113 changed files with 5433 additions and 11 deletions

4
.gitignore vendored
View File

@ -38,9 +38,7 @@ replay_pid*
# ---> PHP
vendor
writeable
composer.lock
.env
test.php
writeable/logs/*
writeable/sessions/*
writeable/cache/*

21
extdbms/cli.php Normal file
View File

@ -0,0 +1,21 @@
<?php
$command = $argv[1] ?? null;
switch ($command) {
case 'serve':
case 'serv': // ← 이 줄 추가
$host = '0.0.0.0';
$port = '80';
$docRoot = __DIR__ . '/public'; // 또는 프레임워크의 public 폴더 경로
echo "Starting development server at http://$host:$port\n";
echo "Document root: $docRoot\n";
// 실제로 서버 실행
passthru("php -S $host:$port -t $docRoot");
break;
default:
echo "Usage: php cli.php [serve]\n";
break;
}

14
extdbms/composer.json Normal file
View File

@ -0,0 +1,14 @@
{
"description": "DBMS framework",
"type": "project",
"require": {
"php": ">=8.2",
"vlucas/phpdotenv": "^5.6",
"eftec/bladeone": "^4.18"
},
"autoload": {
"psr-4": {
"lib\\": "lib/"
}
}
}

1
extdbms/index.html Normal file
View File

@ -0,0 +1 @@
<script language='javascript'>alert('Error : [401] Unauthorized Access');history.back(-1);</script>

View File

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

View File

@ -0,0 +1,200 @@
<?php
//Application 관련
define('APP_URL', $_ENV['APP_URL'] ?? 'http://localhost');
define('APP_NAME', $_ENV['APP_NAME'] ?? 'DBMS');
define('APP_AUTHOR', $_ENV['APP_AUTHOR'] ?? 'Prime IDC');
define('APP_AUTHOR_EMAIL', $_ENV['APP_AUTHOR_EMAIL'] ?? 'choi.jh@prime-idc.jp');
define('APP_VERSION', $_ENV['APP_VERSION'] ?? '1.0.0');
//환경변수
define('APP_ENV', $_ENV['APP_ENV'] ?? 'production');
define('APP_TIMEZONE', $_ENV['APP_TIMEZONE'] ?? 'Asia/Seoul');
define('APP_LOCALE', $_ENV['APP_LOCALE'] ?? 'en');
define('APP_CHARSET', $_ENV['APP_CHARSET'] ?? 'UTF-8');
define('APP_DEBUG', $_ENV['APP_DEBUG'] ?? false);
define('APP_DEBUG_LEVEL', $_ENV['APP_DEBUG_LEVEL'] ?? 'error');
define('APP_WRITEABLE_PATH', $_ENV['APP_WRITEABLE_PATH'] ?? ROOT_PATH . 'writeable' . DIRECTORY_SEPARATOR);
//View 관련
define('APP_VIEW_PATH', $_ENV['APP_VIEW_PATH'] ?? APP_PATH . 'Views');
define('APP_VIEW_PATH_PERMISSION', $_ENV['APP_VIEW_PATH_PERMISSION'] ?? 0775);
define('APP_VIEW_CACHE_PATH', $_ENV['APP_VIEW_CACHE_PATH'] ?? APP_WRITEABLE_PATH . 'cache');
define('APP_VIEW_CACHE_PATH_PERMISSION', $_ENV['APP_VIEW_CACHE_PATH_PERMISSION'] ?? 0775);
define('APP_VIEW_LIST_PERPAGE', $_ENV['APP_VIEW_LIST_PERPAGE'] ?? $_SERVER['APP_VIEW_LIST_PERPAGE'] ?? 20);
define('APP_VIEW_LIST_PAGINATION_GROUPSIZE', $_ENV['APP_VIEW_LIST_PAGINATION_GROUPSIZE'] ?? $_SERVER['APP_VIEW_LIST_PAGINATION_GROUPSIZE'] ?? 10);
define('APP_VIEW_DEBUG', $_ENV['APP_VIEW_DEBUG'] ?? false);
define('APP_VIEW_DEBUG_LEVEL', $_ENV['APP_VIEW_DEBUG_LEVEL'] ?? 'error');
//Log관련
define('APP_LOG_PATH', $_ENV['APP_LOG_PATH'] ?? APP_WRITEABLE_PATH . 'logs');
define('APP_LOG_PERMISSION', $_ENV['APP_LOG_PERMISSION'] ?? 0775);
define('APP_LOG_FORMAT', $_ENV['APP_LOG_FORMAT'] ?? 'text');
define('APP_LOG_MAX_SIZE', $_ENV['APP_LOG_MAX_SIZE'] ?? 1048576); // 1MB
define('APP_LOG_MAX_FILES', $_ENV['APP_LOG_MAX_FILES'] ?? 5);
define('APP_LOG_DATE_FORMAT', $_ENV['APP_LOG_DATE_FORMAT'] ?? 'Y-m-d H:i:s');
define('APP_LOG_CHANNEL', $_ENV['APP_LOG_CHANNEL'] ?? 'default');
define('APP_LOG_LEVELS', $_ENV['APP_LOG_LEVELS'] ?? [
'emergency' => 0,
'alert' => 1,
'critical' => 2,
'error' => 3,
'warning' => 4,
'notice' => 5,
'info' => 6,
'debug' => 7,
]);
//Session 관련
define('APP_SESSION_DRIVER', $_ENV['APP_SESSION_DRIVER'] ?? 'file');
define('APP_SESSION_NAME', $_ENV['APP_SESSION_NAME'] ?? 'PHPSESSID');
define('APP_SESSION_LIFETIME', $_ENV['APP_SESSION_LIFETIME'] ?? 120);
define('APP_SESSION_PATH', $_ENV['APP_SESSION_PATH'] ?? APP_WRITEABLE_PATH . 'sessions');
define('APP_SESSION_PERMISSION', $_ENV['APP_SESSION_PERMISSION'] ?? 0775);
//Cookie 관련
define('APP_SESSION_COOKIE_PATH', $_ENV['APP_SESSION_COOKIE_PATH'] ?? '/');
define('APP_SESSION_COOKIE_EXPIRE', $_ENV['APP_SESSION_COOKIE_EXPIRE'] ?? 3600);
define('APP_SESSION_COOKIE_DOMAIN', $_ENV['APP_SESSION_COOKIE_DOMAIN'] ?? null);
define('APP_SESSION_COOKIE_SECURE', $_ENV['APP_SESSION_COOKIE_SECURE'] ?? false);
define('APP_SESSION_COOKIE_HTTPONLY', $_ENV['APP_SESSION_COOKIE_HTTPONLY'] ?? true);
define('APP_SESSION_USE_ONLY_COOKIES', $_ENV['APP_SESSION_USE_ONLY_COOKIES'] ?? true);
define('APP_SESSION_USE_STRICT_MODE', $_ENV['APP_SESSION_USE_STRICT_MODE'] ?? true);
define('APP_SESSION_USE_UNIQUE_ID', $_ENV['APP_SESSION_USE_UNIQUE_ID'] ?? false);
define('APP_SESSION_USE_FLASH', $_ENV['APP_SESSION_USE_FLASH'] ?? true);
define('APP_SESSION_USE_INPUT', $_ENV['APP_SESSION_USE_INPUT'] ?? true);
//CSRF 관련
define('APP_SESSION_USE_CSRF', $_ENV['APP_SESSION_USE_CSRF'] ?? true);
define('APP_SESSION_USE_CSRF_TOKEN', $_ENV['APP_SESSION_USE_CSRF_TOKEN'] ?? true);
define('APP_SESSION_USE_CSRF_NAME', $_ENV['APP_SESSION_USE_CSRF_NAME'] ?? 'csrf_token');
define('APP_SESSION_USE_CSRF_EXPIRE', $_ENV['APP_SESSION_USE_CSRF_EXPIRE'] ?? 3600);
define('APP_SESSION_USE_CSRF_EXCLUDE', $_ENV['APP_SESSION_USE_CSRF_EXCLUDE'] ?? []);
define('APP_SESSION_USE_CSRF_EXCLUDE_METHOD', $_ENV['APP_SESSION_USE_CSRF_EXCLUDE_METHOD'] ?? ['GET', 'HEAD', 'OPTIONS']);
define('APP_SESSION_USE_CSRF_EXCLUDE_URI', $_ENV['APP_SESSION_USE_CSRF_EXCLUDE_URI'] ?? []);
//Database 관련
define('DATABASE_DRIVER', $_ENV['DATABASE_DRIVER'] ?? $_SERVER['DATABASE_DRIVER'] ?? 'mysql');
define('DATABASE_HOST', $_ENV['DATABASE_HOST'] ?? $_SERVER['DATABASE_HOST'] ?? 'localhost');
define('DATABASE_DB', $_ENV['DATABASE_DB'] ?? $_SERVER['DATABASE_DB'] ?? 'test');
define('DATABASE_CHARSET', $_ENV['DATABASE_CHARSET'] ?? $_SERVER['DATABASE_CHARSET'] ?? 'utf8');
define('DATABASE_ID', $_ENV['DATABASE_ID'] ?? $_SERVER['DATABASE_ID'] ?? 'test');
define('DATABASE_PASSWORD', $_ENV['DATABASE_PASSWORD'] ?? $_SERVER['DATABASE_PASSWORD'] ?? 'test');
define('DATABASE_QUERY_DEBUG', $_ENV['DATABASE_QUERY_DEBUG'] ?? $_SERVER['DATABASE_QUERY_DEBUG'] ?? false);
//DBMS 관련정보보
define('DBMS_SITE_DASHBOARD_DAY', $_ENV['DBMS_SITE_DASHBOARD_DAY'] ?? $_SERVER['DBMS_SITE_DASHBOARD_DAY'] ?? 7);
define('DBMS_SITE_HOST', $_ENV['DBMS_SITE_HOST'] ?? $_SERVER['DBMS_SITE_HOST'] ?? "http://dbms.prime-idc.jp");
define('DBMS_SITE_JAVA_PORT', $_ENV['DBMS_SITE_JAVA_PORT'] ?? $_SERVER['DBMS_SITE_JAVA_PORT'] ?? 6752);
define('DBMS_SITE_URL', DBMS_SITE_HOST . ":" . DBMS_SITE_JAVA_PORT);
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" => " (주)브엘라해로이"],
],
]
]);
define('DBMS_SERVICE_SWITCHCODE', [
'Chiba' => ['begin' => 'C00%', 'end' => 'C64%'],
'Tokyo' => ['begin' => 'C80%', 'end' => 'C99%']
]);
define('DBMS_SERVICE_LINE_ALL', [
'normal' => '일반',
'defence' => '방어',
'solo' => '전용',
'substitution' => '대체',
'test' => '테스트',
'vpn' => 'VPN',
'event' => '이벤트',
]);
define('DBMS_GEARLIST_PROCESS_TYPES', [
'',
'COLOCATION',
'XEON Single',
'CUSTOM',
'INS-일회성',
'NEHALEM',
'Cisco Router',
]);
define('DBMS_GEARLIST_CPU_TYPES', [
'',
'X6-Q',
'C2800',
'C2600',
'COL',
'CUS',
'NX227',
'NX20',
'NX21',
'DQ28',
'DQ26',
'DQ31',
'DQ18',
'DQ23',
'DQ20',
'DX34',
'DX38',
'DX28',
'DX32',
'DX36',
'DX30',
'MD32',
'MD30',
'Q16R',
'Q316',
'Q310',
'Q283',
'Q266',
'Q25R',
'Q213',
'Q20R',
'Q186',
'Q24',
'Q20',
'Q240',
'DX3',
'DQ233'
]);
define('DBMS_CLIENT_POINT_TYPE', [
'deposit' => '입금',
'withdrawal' => '출금',
]);

View File

@ -0,0 +1,159 @@
<?php
namespace lib\Configs;
use lib\Controllers\Client\ClientController;
use lib\Controllers\Client\CouponController;
use lib\Controllers\Client\DashboardController as ClientDashboardController;
use lib\Controllers\Client\PaymentController;
use lib\Controllers\Client\PointController;
use lib\Controllers\DashboardController;
use lib\Controllers\DefenceController;
use lib\Controllers\GearlistController;
use lib\Controllers\ServiceController;
use lib\Core\Router;
//Client관련련
$router->group('dbms/client', function (Router $router) {
//Dashboard관련
$router->group('dashboard', function (Router $router) {
$router->add('GET', 'totalcount', function ($params) {
$controller = new ClientDashboardController($params);
return $controller->totalcount();
// Response::view($result);
});
});
//메모변경관련
$router->add('GET', 'update_form', function ($params) {
$controller = new ClientController($params);
return $controller->update_form();
// Response::view($result);
});
$router->add('POST', 'update', function ($params) {
$controller = new ClientController($params);
return $controller->update();
// Response::view($result);
});
//쿠폰관련
$router->group('coupon', function (Router $router) {
$router->add('GET', 'index', function ($params) {
$controller = new CouponController($params);
return $controller->index();
// Response::view($result);
});
$router->add('GET', 'insert_form', function ($params) {
$controller = new CouponController($params);
return $controller->insert_form();
// Response::view($result);
});
$router->add('POST', 'insert', function ($params) {
$controller = new CouponController($params);
return $controller->insert();
// Response::view($result);
});
});
//Point관련
$router->group('point', function (Router $router) {
$router->add('GET', 'index', function ($params) {
$controller = new PointController($params);
return $controller->index();
// Response::view($result);
});
$router->add('GET', 'insert_form', function ($params) {
$controller = new PointController($params);
return $controller->insert_form();
// Response::view($result);
});
$router->add('POST', 'insert', function ($params) {
$controller = new PointController($params);
return $controller->insert();
// Response::view($result);
});
});
//결제관련
$router->group('payment', function (Router $router) {
$router->add('GET', 'index', function ($params) {
$controller = new PaymentController($params);
return $controller->index();
// Response::view($result);
});
$router->add('GET', 'billpaper', function ($params) {
$controller = new PaymentController($params);
return $controller->billpaper();
// Response::view($result);
});
});
});
// 예제 라우트 그룹: dbms/dashboard/index 이후에 key/value 파라미터 허용
$router->group('dbms/dashboard', function (Router $router) {
// // 동적 파라미터 없이 기본 path에 추가 파라미터를 받아 key/value 형식으로 처리
// $router->add('GET', 'index', function ($params) {
// Response::json([
// 'message' => 'DashboardController::index 실행됨',
// 'params' => $params
// ]);
// });
// 동적 파라미터 없이 기본 path에 추가 파라미터를 받아 key/value 형식으로 처리
$router->add('GET', 'topboard', function ($params) {
$controller = new DashboardController($params);
return $controller->topboard();
// Response::view($result);
});
$router->add('GET', 'totalcount', function ($params) {
$controller = new DashboardController($params);
return $controller->totalcount();
// Response::view($result);
});
$router->add('GET', 'latest_service', function ($params) {
$controller = new DashboardController($params);
return $controller->latest_service();
// Response::view($result);
});
$router->add('GET', 'latest_history', function ($params) {
$controller = new DashboardController($params);
return $controller->latest_history();
// Response::view($result);
});
$router->add('GET', 'cscount', function ($params) {
$controller = new DashboardController($params);
return $controller->cscount();
// Response::view($result);
});
$router->add('GET', 'coupon', function ($params) {
$controller = new DashboardController($params);
return $controller->coupon();
// Response::view($result);
});
});
$router->group('dbms/defence', function (Router $router) {
// 동적 파라미터 없이 기본 path에 추가 파라미터를 받아 key/value 형식으로 처리
$router->add('GET', 'index', function ($params) {
$controller = new DefenceController($params);
return $controller->index();
// Response::view($result);
});
});
$router->group('dbms/service', function (Router $router) {
// 동적 파라미터 없이 기본 path에 추가 파라미터를 받아 key/value 형식으로 처리
$router->add('GET', 'extra', function ($params) {
$controller = new ServiceController($params);
return $controller->extra();
// Response::view($result);
});
$router->add('GET', 'ipsearch', function ($params) {
$controller = new ServiceController($params);
return $controller->ipsearch();
// Response::view($result);
});
});
$router->group('dbms/gearlist', function (Router $router) {
$router->add('GET', 'index', function ($params) {
$controller = new GearlistController($params);
return $controller->index();
// Response::view($result);
});
});

View File

@ -0,0 +1,89 @@
<?php
namespace lib\Controllers\Client;
use lib\Controllers\DBMSController;
use lib\Services\ClientService;
use lib\Services\MemberService;
class ClientController extends DBMSController
{
private ?ClientService $_clientService = null;
private ?MemberService $_memberService = null;
public function __construct(array $params = [])
{
parent::__construct($params);
$this->setPath('client');
} //
final public function getClientService(): ClientService
{
if ($this->_clientService === null) {
$this->_clientService = new ClientService();
}
return $this->_clientService;
}
final public function getMemberService(): MemberService
{
if ($this->_memberService === null) {
$this->_memberService = new MemberService();
}
return $this->_memberService;
}
//자식Controller에서 기본적으로 필요한 client_code, mkid, service_code를 설정합니다.
final protected function setDefaultRequestData($client = null, $member = null, $service = null): array
{
//사용자정보
$this->client_code = $this->request->get('client_code');
if ($client && !$this->client_code) {
throw new \Exception("[client_code]가 정의되지 않았습니다.");
}
if ($this->client_code) {
$this->getClientService()->getModel()->where('Client_Code', $this->client_code);
$client = $this->getClientService()->getEntity();
if (!$client) {
throw new \Exception("[$this->client_code]에 해당하는 고객정보가 존재하지 않습니다.");
}
}
//관리자정보(등록자)
$this->member_code = $this->request->get('member_code');
if ($member && !$this->member_code) {
throw new \Exception("[member_code]가 정의되지 않았습니다.");
}
if ($this->member_code) {
$this->getMemberService()->getModel()->where('id', $this->member_code);
$member = $this->getMemberService()->getEntity();
if (!$member) {
throw new \Exception("[$this->member_code]에 해당하는 관리자정보가 존재하지 않습니다.");
}
}
//서비스정보
$this->service_code = $this->request->get('service_code');
if ($service && !$this->service_code) {
throw new \Exception("[service_code]가 정의되지 않았습니다.");
}
if ($this->service_code) {
$this->getServiceService()->getModel()->where('service_code', $this->service_code);
$service = $this->getServiceService()->getEntity();
if (!$service) {
throw new \Exception("[$this->service_code]에 해당하는 서비스정보가 존재하지 않습니다.");
}
}
return [$client, $member, $service];
}
//사용자용메모장 , customer_memo.php
//CLI 접속방법 : php index.php site/client/update_form/client_code/코드번호
//WEB 접속방법 : http://localhost/site/client/update_form/client_code/코드번호
public function update_form()
{
//기본적으로 필요한 client_code, mkid, service_code를 설정합니다.
list($this->client, $this->member, $this->service) = $this->setDefaultRequestData(true, true);
return $this->render(__FUNCTION__);
}
public function update()
{
//기본적으로 필요한 client_code, mkid, service_code를 설정합니다.
list($this->client, $this->member, $this->service) = $this->setDefaultRequestData(true, true);
return $this->render(__FUNCTION__);
}
} //Class

View File

@ -0,0 +1,111 @@
<?php
namespace lib\Controllers\Client;
use lib\Entities\ClientEntity;
use lib\Services\HistoryService;
use lib\Services\OnetimeService;
use lib\Utils\Pagination;
class CouponController extends ClientController
{
private ?OnetimeService $_onetimeService = null;
private ?HistoryService $_historyService = null;
public function __construct(array $params = [])
{
parent::__construct($params);
$this->setPath('coupon');
} //
public function getOnetimeService(): OnetimeService
{
if ($this->_onetimeService === null) {
$this->_onetimeService = new OnetimeService();
}
return $this->_onetimeService;
}
public function getHistoryService(): HistoryService
{
if ($this->_historyService === null) {
$this->_historyService = new HistoryService();
}
return $this->_historyService;
}
//IdcCouponListMK.jsp -> domain_coupon.php
//CLI 접속방법 : php index.php site/client/counpon/index
//WEB 접속방법 : http://localhost/site/client/coupon/index
public function index()
{
//기본적으로 필요한 client_code, member_code, service_code를 설정합니다.
list($this->client, $this->member, $this->service) = $this->setDefaultRequestData();
//사용자별로 쿠폰정보보기
if ($this->client instanceof ClientEntity) {
// $this->getServiceService()->getModel()->where('client_code', $this->client->getClientCode());
}
//업체명_일회성만 나오게하기 위해서
$this->getServiceService()->getModel()->like('server_code', '%_일회성');
$this->curPage = intval($this->request->get('curPage', 1));
$this->perPage = intval($this->request->get('perPage', APP_VIEW_LIST_PERPAGE));
[$this->total, $this->entities] = $this->getServiceService()->getList($this->curPage, $this->perPage);
$this->pagination = new Pagination($this->total, (int)$this->curPage, (int)$this->perPage);
//고객이 지정되어 있는경우
if ($this->client) {
$total_coupon = 0;
foreach ($this->entities as $entity) {
$total_coupon += $entity->getCoupon();
}
$this->total_coupon = $total_coupon;
}
return $this->render(__FUNCTION__);
}
//IdcCouponBuyMK.jsp -> domain_coupon_buy.php
//CLI 접속방법 : php index.php site/client/counpon/insert_form
//WEB 접속방법 : http://localhost/site/client/coupon/insert_form
public function insert_form()
{
//기본적으로 필요한 client_code, member_code, service_code를 설정합니다.
list($this->client, $this->member, $this->service) = $this->setDefaultRequestData(null, true, true);
//기본적으로 필요한 client_code, mkid, service_code를 설정합니다.
list($client_code, $member_code, $service_code) = $this->setDefaultRequestData();
$this->today = date("Y-m-d");
return $this->render(__FUNCTION__);
}
//IdcCouponBuyMK.jsp -> domain_coupon_buy.php
//CLI 접속방법 : php index.php site/client/counpon/insert_form
//WEB 접속방법 : http://localhost/site/client/coupon/insert_form
public function insert()
{
//기본적으로 필요한 client_code, mkid, service_code를 설정합니다.
list($client_code, $member_code, $service_code) = $this->setDefaultRequestData();
//onetime_sub 도메인 구매 수량
$coupon = $this->request->get('coupon');
if (! $coupon || $coupon < 1) {
throw new \Exception("도메인 구매 수량 값이 정의되지 않았거나, 도메인 구매 수량은 1개 이상이어야 합니다.");
}
//onetime_note 도메인 구매 수량
$note = $this->request->get('note');
if (!$note) {
throw new \Exception("도메인 리스트 값이 정의되지 않았습니다.");
}
//onetime_case 사용용도
$onetime_case = $this->request->get('onetime_case', 'domain');
//onetime_request_date 사용일
$onetime_request_date = $this->request->get('onetime_request_date') ?? date("Y-m-d");
try {
$this->getServiceService()->beginTransaction();
//서비스쿠폰 갯수 수정
$this->getServiceService()->useCouponByService($this->service, $coupon);
//쿠폰 사용내역 onetime에 등록
$this->getOnetimeService()->useCouponByService($this->service, $this->client, $this->member, $onetime_case, $coupon, $note, $onetime_request_date);
//쿠폰 사용내역 history에 등록
$this->getHistoryService()->useCouponByService($this->service, $this->client, $onetime_case, $coupon, $note, $onetime_request_date);;
$this->getServiceService()->commit();
return $this->redirect->to(DBMS_SITE_URL . "/IdcCouponUseMK.cup?client_code=" . $this->service->getClientCode());
} catch (\Exception $e) {
$this->getServiceService()->rollback();
return $this->redirect->back()->withInput()->with('error', ['message' => '쿠폰 사용에 실패하였습니다.:' . $e->getMessage()]);
}
}
} //Class

View File

@ -0,0 +1,52 @@
<?php
namespace lib\Controllers\Client;
use lib\Entities\ClientEntity;
use lib\Services\ClientService;
use lib\Services\MemberService;
class DashboardController extends ClientController
{
public function __construct(array $params = [])
{
parent::__construct($params);
$this->setPath('dashboard');
} //
//서비스카운팅 , total_counting_customer.php
//CLI 접속방법 : php index.php site/client/totalcount/client_code/코드번호
//WEB 접속방법 : http://localhost/site/client/totalcount/client_code/코드번호
public function totalcount()
{
//기본적으로 필요한 client_code, member_code, service_code를 설정합니다.
list($this->client, $this->member, $this->service) = $this->setDefaultRequestData(true);
//사용자별로 쿠폰정보보기
if ($this->client instanceof ClientEntity) {
$this->getServiceService()->getModel()->where('client_code', $this->client->getClientCode());
}
//서비스위치별(치바,도쿄등)
$dashboard = [];
foreach (DBMS_SERVICE_SWITCHCODE as $district => $switchcodes) {
$switchcode_begin = $switchcodes['begin'];
$switchcode_end = $switchcodes['end'];
$this->getServiceService()->getModel()->where("client_code", "{$this->client->getClientCode()}");
$this->getServiceService()->getModel()->where("service_sw BETWEEN '{$switchcode_begin}' AND '{$switchcode_end}'");
$this->getServiceService()->getModel()->where("service_status", "o");
$this->getServiceService()->getModel()->whereNotIn("service_line", ['solo', 'test', 'event', 'substitution']);
$dashboard[$district] = $this->getServiceService()->getCount();
} //foreach
//서비스라인별(일반,방어,전용,테스트,대체,vpn,event등)
foreach (DBMS_SERVICE_LINE_ALL as $service_line => $label) {
$this->getServiceService()->getModel()->where('client_code', $this->client->getClientCode());
$this->getServiceService()->getModel()->where('service_line', $service_line);
$dashboard[$service_line] = $this->getServiceService()->getCount("SUM(coupon) as cnt");
} //foreach
//서비스상태별(일반,방어만)
$this->getServiceService()->getModel()->where("client_code", $this->client->getClientCode());
$this->getServiceService()->getModel()->whereNotIn("service_line", ['solo', 'test', 'event', 'substitution']);
$dashboard['coupon'] = $this->getServiceService()->getCount("SUM(coupon) as cnt");
$this->dashboard = $dashboard;
return $this->render(__FUNCTION__);
}
} //Class

View File

@ -0,0 +1,71 @@
<?php
namespace lib\Controllers\Client;
use lib\Utils\Pagination;
class PaymentController extends ClientController
{
public function __construct(array $params = [])
{
parent::__construct($params);
$this->setPath('payment');
} //
//청구서, depositbillpaper.php
//CLI 접속방법 : php index.php site/client/payment/billpaper
//WEB 접속방법 : http://localhostsite/client/payment/billpaper
public function billpaper()
{
$sitekey = $this->request->get('sitekey');
if (!$sitekey) {
throw new \Exception("sitekey 값이 정의되지 않았습니다.");
}
$this->siteInfo = DBMS_SITEINFOS[$sitekey];
//기본적으로 필요한 client_code, mkid, service_code를 설정합니다.
list($client_code, $member_code, $service_code) = $this->setDefaultRequestData();
return $this->render(__FUNCTION__);
}
//미납리스트트, NonPaymentList.php
//CLI 접속방법 : php index.php site/client/payment/index
//WEB 접속방법 : http://localhostsite/client/payment/index
public function index()
{
//Client_Code = ["C219"=>WinIDC,"C116"=>IDC-JP"] -> 미지급금계산 제외 Client_Code
$exclude_clients = ['C116', 'C219'];
//mode 당일,1일전,2일전,3일전,custom
$today = date("Y-m-d");;
$mode = $this->request->get('mode', 'all');
switch ($mode) {
case 'today':
$this->message = "[{$today}] 기준 당일 ";
$this->getServiceService()->getModel()->where("service_payment_date = CURDATE()");
break;
case '1day':
$nonpaymentDay = 1;
$this->message = "[{$today}] 기준 {$nonpaymentDay}일전";
$this->getServiceService()->getModel()->where("service_payment_date = Date_Add(CURDATE(),INTERVAL {$nonpaymentDay} DAY)");
break;
case '2day':
$nonpaymentDay = 2;
$this->message = "[{$today}] 기준 {$nonpaymentDay}일전";
$this->getServiceService()->getModel()->where("service_payment_date = Date_Add(CURDATE(),INTERVAL {$nonpaymentDay} DAY)");
break;
case '3day':
$nonpaymentDay = 3;
$this->message = "[{$today}] 기준 {$nonpaymentDay}일전";
$this->getServiceService()->getModel()->where("service_payment_date = Date_Add(CURDATE(),INTERVAL {$nonpaymentDay} DAY)");
break;
case 'all':
default:
$this->message = "[{$today}] 기준 전체";
break;
}
$this->mode = $mode;
$this->curPage = intval($this->request->get('curPage', 1));
$this->perPage = intval($this->request->get('perPage', APP_VIEW_LIST_PERPAGE));
[$this->total, $this->entities] = $this->getServiceService()->getEntitiesForNonPayment($this->curPage, $this->perPage, $exclude_clients);
$this->pagination = new Pagination($this->total, (int)$this->curPage, (int)$this->perPage);
return $this->render(__FUNCTION__);
}
} //Class

View File

@ -0,0 +1,144 @@
<?php
namespace lib\Controllers\Client;
use lib\Services\HistoryService;
use lib\Services\OnetimeService;
use lib\Services\PointService;
use lib\Utils\Pagination;
use lib\Helpers\Client\PointHelper;
class PointController extends ClientController
{
private ?PointService $_pointService = null;
private ?OnetimeService $_onetimeService = null;
private ?HistoryService $_historyService = null;
public function __construct(array $params = [])
{
parent::__construct($params);
$this->setPath('point');
$this->helper = new PointHelper();
} //
public function getPointService(): PointService
{
if ($this->_pointService === null) {
$this->_pointService = new PointService();
}
return $this->_pointService;
}
public function getOnetimeService(): OnetimeService
{
if ($this->_onetimeService === null) {
$this->_onetimeService = new OnetimeService();
}
return $this->_onetimeService;
}
public function getHistoryService(): HistoryService
{
if ($this->_historyService === null) {
$this->_historyService = new HistoryService();
}
return $this->_historyService;
}
//IdcClientPointList.jsp
//CLI 접속방법 : php index.php site/client/point/index
//WEB 접속방법 : http://localhost/site/client/point/index
public function index()
{
//전체 고객객정보
$this->clients = $this->getClientService()->getEntities();
//사용자코드가 있으면,
$client_code = $this->request->get('client_code');
if ($client_code) {
$this->getPointService()->getModel()->where('client_code', $client_code);
}
$this->client_code = $client_code;
$this->curPage = intval($this->request->get('curPage', 1));
$this->perPage = intval($this->request->get('perPage', APP_VIEW_LIST_PERPAGE));
[$this->total, $this->entities] = $this->getPointService()->getList($this->curPage, $this->perPage);
$this->pagination = new Pagination($this->total, (int)$this->curPage, (int)$this->perPage);
return $this->render(__FUNCTION__);
}
//IdcClientPointInsert.jsp
//CLI 접속방법 : php index.php site/client/point/insert_form
//WEB 접속방법 : http://localhost/site/client/point/insert_form
public function insert_form()
{
//전체 고객객정보
$this->clients = $this->getClientService()->getEntities();
//사용자코드가 있으면,
$client_code = $this->request->get('client_code');
if ($client_code) {
$this->getPointService()->getModel()->where('client_code', $client_code);
}
$this->client_code = $client_code;
return $this->render(__FUNCTION__);
}
//IdcPointBuyMK.jsp -> domain_point_buy.php
//CLI 접속방법 : php index.php site/client/point/insert_form
//WEB 접속방법 : http://localhost/site/client/point/insert_form
public function insert()
{
try {
//Client Code 형식
$client_code = $this->request->get('client_code');
if (!$client_code) {
throw new \Exception("고객을 선택하지 않으셨습니다.");
}
$this->getClientService()->getModel()->where('Client_Code', $client_code);
$client = $this->getClientService()->getEntity();
if (!$client) {
throw new \Exception("[$client_code]에 해당하는 고객정보가 존재하지 않습니다.");
}
//포인트 형식
$type = $this->request->get('type');
if (!$type) {
throw new \Exception("포인트 형식이 정의되지 않았습니다.");
}
//포인트 값
$amount = intval($this->request->get('amount'));
if (! $amount || $amount < 1) {
throw new \Exception("포인트 값이 정의되지 않았거나, 포인트값은 1 이상이어야 합니다.");
}
//포인트 작업 내용
$note = $this->request->get('note');
// //onetime_case 사용용도
// $onetime_case = $this->request->get('onetime_case', 'point');
// //onetime_request_date 사용일
// $onetime_request_date = $this->request->get('onetime_request_date') ?? date("Y-m-d");
$formDatas = [
'client_code' => $client_code,
'type' => $type,
'title' => date("Y-m-d") . ", [$amount] 포인트, " . DBMS_CLIENT_POINT_TYPE[$type],
'amount' => $amount,
'note' => $note
];
$this->getServiceService()->beginTransaction();
// //포인트 사용내역 onetime에 등록
// $this->getOnetimeService()->usePointByService($service, $client, $member, $onetime_case, $point, $note, $onetime_request_date);
// //포인트 사용내역 history에 등록
// $this->getHistoryService()->usePointByService($service, $client, $onetime_case, $point, $note, $onetime_request_date);;
//포인트 사용내역 point에 등록
$this->getPointService()->getModel()->insert($formDatas);
if ($type == 'withdrawal') { //사용자 포인트 출금
$this->getClientService()->withdrawalPoint($this->client, $amount);
} else { //사용자 포인트 입금
$this->getClientService()->depositPoint($this->client, $amount);
}
$this->getServiceService()->commit();
$message_key = 'success';
$message = "포인트 : [$amount]" . DBMS_CLIENT_POINT_TYPE[$type] . "이 완료되었습니다";
} catch (\PDOException $e) {
$this->getServiceService()->rollback();
$message_key = 'error';
$message = "실패:" . $e->getMessage();
} catch (\Exception $e) {
$message_key = 'error';
$message = "실패" . $e->getMessage();
}
return $this->redirect->to(DBMS_SITE_URL . "/IdcPointList.cup?client_code=$client_code")->with($message_key, ['message' => $message]);
}
} //Class

View File

@ -0,0 +1,13 @@
<?php
namespace lib\Controllers;
use lib\Core\Controller as Core;
abstract class CommonController extends Core
{
protected function __construct(array $params = [])
{
parent::__construct($params);
} //
} //Class

View File

@ -0,0 +1,26 @@
<?php
namespace lib\Controllers;
use lib\Controllers\CommonController;
use lib\Services\ServiceService;
abstract class DBMSController extends CommonController
{
private ?ServiceService $_service = null;
protected function __construct(array $params = [])
{
parent::__construct($params);
//View의 추가디렉토리
$this->setPath('dbms');
$this->setLayout('dbms_layout.php');
} //
final public function getServiceService(): ServiceService
{
if ($this->_service === null) {
$this->_service = new ServiceService();
}
return $this->_service;
}
} //Class

View File

@ -0,0 +1,217 @@
<?php
namespace lib\Controllers;
use lib\Services\MemberService;
use lib\Services\ClientService;
use lib\Services\VPCService;
use lib\Services\KCSService;
use lib\Services\HistoryService;
use lib\Helpers\ServiceHelper;
class DashboardController extends DBMSController
{
private ?MemberService $_memberService = null;
private ?ClientService $_clientService = null;
private ?VPCService $_vpcService = null;
private ?KCSService $_kcsService = null;
private ?HistoryService $_historyService = null;
public function __construct(array $params = [])
{
parent::__construct($params);
$this->setPath('dashboard');
$this->helper = new ServiceHelper();
} //
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;
}
//Dashboard , default_alert.php
//CLI 접속방법 : php index.php site/dashboard/topboard
//WEB 접속방법 : http://localhost/site/dashboard/topboard
public function topboard()
{
// 최근7일 신규서버수
//예외,service_line = "test","substitution"
$excepts = ["test", "substitution"];
$this->day = intval(DBMS_SITE_DASHBOARD_DAY);
$this->getServiceService()->getModel()->where("service_open_date > DATE_ADD(now(), INTERVAL -{$this->day} DAY)");
$this->getServiceService()->getModel()->where("service_status", 'o');
$this->getServiceService()->getModel()->whereNotIn("service_line", $excepts);
$this->newServices = $this->getServiceService()->getCount();
// 금일기준 미납서버수
//예외,service_line = "test","substitution",C012:게임윙,C116:WinIDC,C219:IDC-JP
$excepts = ["test", "substitution", 'C116', 'C012', 'C219'];
$this->getServiceService()->getModel()->where("service_payment_date > now()");
$this->getServiceService()->getModel()->where("service_status", 'o');
$this->getServiceService()->getModel()->whereNotIn("service_line", $excepts);
$this->unPayments = $this->getServiceService()->getCount();
return $this->render(__FUNCTION__);
}
//서비스카운팅 , total_counting.php
//CLI 접속방법 : php index.php site/dashboard/totalcount/sitekey/도메인
//WEB 접속방법 : http://localhost/site/dashboard/totalcount/sitekey/도메인
public function totalcount()
{
$sitekey = $this->request->get('sitekey');
if (!$sitekey) {
throw new \Exception("sitekey 값이 정의되지 않았습니다.");
}
$this->siteInfo = DBMS_SITEINFOS[$sitekey];
$this->totalcount = $this->getServiceService()->getTotalCountForDashboard($this->siteInfo);
$summary = array();
foreach ($this->siteInfo['totalcount_types'] as $type) {
$summary[$type] = array("Tokyo" => 0, "Chiba" => 0);
}
foreach ($this->totalcount as $company => $service) {
$summary[$company] = array("Tokyo" => 0, "Chiba" => 0);
foreach ($service as $name => $location) {
$summary[$company]['Tokyo'] += $location['Tokyo'];
$summary[$name]['Tokyo'] += $location['Tokyo'];
$summary[$company]['Chiba'] += $location['Chiba'];
$summary[$name]['Chiba'] += $location['Chiba'];
}
}
$total = array("Tokyo" => 0, "Chiba" => 0);
foreach ($this->siteInfo['totalcount_types'] as $type) {
$total['Tokyo'] += $summary[$type]['Tokyo'];
$total['Chiba'] += $summary[$type]['Chiba'];
}
$this->summary = $summary;
$this->total = $total;
return $this->render(__FUNCTION__);
}
//신규서버현황 new_server_list.php
//CLI 접속방법 : php index.php site/dashboard/latest_service/limit/5
//WEB 접속방법 : http://localhost/site/dashboard/latest_service/limit/5
public function latest_service()
{
//신규서버정보
$this->limit = intval($this->request->get('limit', 5));
$this->getServiceService()->getModel()->orderBy($this->getServiceService()->getModel()->getPKField(), 'DESC');
$this->getServiceService()->getModel()->limit($this->limit);
$this->entities = $this->getServiceService()->getEntities();
//전체 관리자정보(등록자)
$this->members = $this->getMemberService()->getEntities();
$clients = [];
$vpcs = [];
$kcss = [];
$cnt = 1;
foreach ($this->entities as $entity) {
$serviceCode = $entity->getServiceCode();
//해당 고객정보
$this->getClientService()->getModel()->where('client_code', $entity->getClientCode());
$client = $this->getClientService()->getEntity();
if (!$client) {
throw new \Exception("{$entity->getClientCode()}에 해당하는 고객정보가 존재하지 않습니다.");
}
$clients[$serviceCode] = $client;
//VPC정보갯수
$this->getVPCService()->getModel()->where('service_code', $serviceCode);
$vpcs[$serviceCode] = $this->getVPCService()->getCount();
//KCS정보갯수
$this->getKCSService()->getModel()->where('service_code', $serviceCode);
$kcss[$serviceCode] = $this->getKCSService()->getCount();
$cnt++;
}
// dd($this->entitys);
$this->clients = $clients;
$this->vpcs = $vpcs;
$this->kcss = $kcss;
return $this->render(__FUNCTION__);
}
//CLI 접속방법 : php index.php site/dashboard/latest_history/limit/5
//WEB 접속방법 : http://localhost/site/dashboard/latest_history/limit/5
public function latest_history()
{
//신규History정보
$this->limit = intval($this->request->get('limit', 5));
$this->getHistoryService()->getModel()->orderBy($this->getHistoryService()->getModel()->getPKField(), 'DESC');
$this->getHistoryService()->getModel()->limit($this->limit);
$this->entities = $this->getHistoryService()->getEntities();
//전체 서비스정보
$this->services = $this->getServiceService()->getEntities();
//services 고객정보
$this->clients = $this->getClientService()->getEntities();
return $this->render(__FUNCTION__);
}
//service_list_cs_count.php
//CLI 접속방법 : php index.php site/dashboard/cscount/service_code/서비스코드
//WEB 접속방법 : http://localhost/site/dashboard/cscount/service_code/서비스코드
public function cscount()
{
//서비스정보
$service_code = $this->request->get('service_code');
// echo "service_code:" . $service_code;
if (!$service_code) {
throw new \Exception("service_code 값이 정의되지 않았습니다.");
}
$this->getServiceService()->getModel()->where($this->getServiceService()->getModel()::PKField, $service_code);
$service = $this->getServiceService()->getEntity();
if (!$service) {
throw new \Exception("[$service_code]에 해당하는 서비스정보가 존재하지 않습니다.");
}
$this->service = $service;
//VPC정보갯수
$this->getVPCService()->getModel()->where('service_code', $service->getServiceCode());
$this->vpc = $this->getVPCService()->getCount();
//KCS정보갯수
$this->getKCSService()->getModel()->where('service_code', $service->getServiceCode());
$this->kcs = $this->getKCSService()->getCount();
return $this->render(__FUNCTION__);
}
//service_list_cs_count.php
//CLI 접속방법 : php index.php site/dashboard/cscount/service_code/서비스코드
//WEB 접속방법 : http://localhost/site/dashboard/cscount/service_code/서비스코드
public function coupon()
{
//서비스정보
$service_code = $this->request->get('service_code');
// echo "service_code:" . $service_code;
if (!$service_code) {
throw new \Exception("service_code 값이 정의되지 않았습니다.");
}
$this->getServiceService()->getModel()->where($this->getServiceService()->getModel()::PKField, $service_code);
$service = $this->getServiceService()->getEntity();
if (!$service) {
throw new \Exception("[$service_code]에 해당하는 서비스정보가 존재하지 않습니다.");
}
return $this->render(__FUNCTION__);
}
} //Class

View File

@ -0,0 +1,42 @@
<?php
namespace lib\Controllers;
use lib\Services\DefenceService;
use lib\Utils\Pagination;
class DefenceController extends DBMSController
{
private ?DefenceService $_clientService = null;
public function __construct(array $params = [])
{
parent::__construct($params);
$this->setPath('defence');
} //
public function getDefenceService(): DefenceService
{
if ($this->_clientService === null) {
$this->_clientService = new DefenceService();
}
return $this->_clientService;
}
//방어 defense_index.php
//CLI 접속방법 : php index.php site/defence/index/zone/존/parent/부모키/child/자식키
//WEB 접속방법 : http://localhost/site/defence/index/zone/존/parent/부모키/child/자식키
public function index()
{
$zone = $this->request->get('zone');
if (!$zone) {
throw new \Exception("zone 값이 정의되지 않았습니다.");
}
$this->zone = urldecode($zone);
$this->getDefenceService()->getModel()->where(['zone' => $this->zone]);
$this->getDefenceService()->getModel()->orderBy(['zone' => 'asc', 'parents' => 'asc', 'child' => 'asc']);
$this->curPage = intval($this->request->get('curPage', 1));
$this->perPage = intval($this->request->get('perPage', APP_VIEW_LIST_PERPAGE));
[$this->total, $this->entities] = $this->getDefenceService()->getList($this->curPage, $this->perPage);
$this->pagination = new Pagination($this->total, (int)$this->curPage, (int)$this->perPage);
return $this->render(__FUNCTION__);
}
} //Class

View File

@ -0,0 +1,60 @@
<?php
namespace lib\Controllers;
use lib\Entities\GearlistEntity;
use lib\Services\GearlistService;
use lib\Services\ServerService;
class GearlistController extends DBMSController
{
private ?GearlistService $_gearlistServicerService = null;
private ?ServerService $_serverService = null;
public function __construct(array $params = [])
{
parent::__construct($params);
$this->setPath('gearlist');
} //
public function getGearlistService(): GearlistService
{
if ($this->_gearlistServicerService === null) {
$this->_gearlistServicerService = new GearlistService();
}
return $this->_gearlistServicerService;
}
public function getServerService(): ServerService
{
if ($this->_serverService === null) {
$this->_serverService = new ServerService();
}
return $this->_serverService;
}
//가용장비 현황 server_use.php
//CLI 접속방법 : php index.php site/server/use
//WEB 접속방법 : http://localhost site/server/use
private function setMode(GearlistEntity $entity): GearlistEntity
{
$lineup_explode = explode('.', $entity->getSpec());
$spec = $lineup_explode[0];
$cpu = $entity->getCPUName();
$entity->all = $this->getServerService()->getCountByMode("all", $cpu, $spec);
$entity->use = $this->getServerService()->getCountByMode("use", $cpu, $spec);
$entity->empty = $this->getServerService()->getCountByMode("empty", $cpu, $spec);
$entity->format = $this->getServerService()->getCountByMode("format", $cpu, $spec);
return $entity;
}
public function index()
{
$gearlistEntities = $this->getGearlistService()->getEntitiesForLineUp();
//DB에 넣지않는 이유가 뭘까? DB에 넣으면 관리가 힘들어서?
$gearlistEntities[] = new GearlistEntity(['process' => "INTEL i5(구세대)", 'spec' => "i5-2.xx", "cpuname" => "i5-2", 'price' => "23"]);
$gearlistEntities[] = new GearlistEntity(['process' => "INTEL i7(구세대)", 'spec' => "i7-2.xx", "cpuname" => "i7-2", 'price' => "45"]);
$gearlistEntities[] = new GearlistEntity(['process' => "INTEL i7(4세대)", 'spec' => "i7-4.xx", "cpuname" => "i7-4", 'price' => "45"]);
$entities = [];
foreach ($gearlistEntities as $idx => $gearlistEntity) {
$entities[] = $this->setMode($gearlistEntity);
}
$this->entities = $entities;
return $this->render(__FUNCTION__);
}
} //Class

View File

@ -0,0 +1,14 @@
<?php
namespace lib\Controllers;
use lib\Http\Response;
class HomeController extends CommonController
{
public function __construct(array $params = [])
{
parent::__construct($params);
} //
public function index(): void {}
}

View File

@ -0,0 +1,32 @@
<?php
namespace lib\Controllers;
use lib\Services\ClientService;
use lib\Services\ServerService;
use lib\Utils\Pagination;
class ServerController extends DBMSController
{
private ?ServerService $_serverService = null;
private ?ClientService $_clientService = null;
public function __construct(array $params = [])
{
parent::__construct($params);
$this->setPath('server');
} //
public function getServerService(): ServerService
{
if ($this->_serverService === null) {
$this->_serverService = new ServerService();
}
return $this->_serverService;
}
public function getClientService(): ClientService
{
if ($this->_clientService === null) {
$this->_clientService = new ClientService();
}
return $this->_clientService;
}
} //Class

View File

@ -0,0 +1,86 @@
<?php
namespace lib\Controllers;
use lib\Services\AddDbService;
use lib\Services\ClientService;
use lib\Utils\Pagination;
class ServiceController extends DBMSController
{
private ?ClientService $_clientService = null;
private ?AddDbService $_addDbService = null;
public function __construct(array $params = [])
{
parent::__construct($params);
$this->setPath('service');
} //
public function getClientService(): ClientService
{
if ($this->_clientService === null) {
$this->_clientService = new ClientService();
}
return $this->_clientService;
}
public function getAddDbService(): AddDbService
{
if ($this->_addDbService === null) {
$this->_addDbService = new AddDbService();
}
return $this->_addDbService;
}
//IP검색 :
//CLI 접속방법 : php index.php site/service/ipsearch
//WEB 접속방법 : http://localhost/site/service/ipsearch
public function ipsearch()
{
$ip = $this->request->get('ip');
//전체 고객정보
$this->clients = $this->getClientService()->getEntities();
//IP형식이 ipv4이면 해당 IP만 , 아니면 like , 없으면 all 값가져오기
if ($ip && $this->helper->isIPAddress($ip)) {
$this->getServiceService()->getModel()->where('service_ip', $ip);
} elseif ($ip) {
$this->getServiceService()->getModel()->like('service_ip', $ip);
}
$this->curPage = intval($this->request->get('curPage', 1));
$this->perPage = intval($this->request->get('perPage', APP_VIEW_LIST_PERPAGE));
[$this->total, $this->entities] = $this->getServiceService()->getList($this->curPage, $this->perPage);
$this->pagination = new Pagination($this->total, (int)$this->curPage, (int)$this->perPage);
return $this->render(__FUNCTION__);
}
//부가서비스 : 닷 디펜더,딥 파인더 ,M307-1,M394-2등, deepfinder_list.php,dotdefender_list.php
//CLI 접속방법 : php index.php site/service//extra/adddb_code/코드번호
//WEB 접속방법 : http://localhost/site/service/extra/adddb_code/코드번호
public function extra()
{
$adddb_code = $this->request->get('adddb_code');
if (!$adddb_code) {
throw new \Exception("adddb_code 값이 정의되지 않았습니다.");
}
$this->adddb_code = urldecode($adddb_code);
//해당 부가서비스의 services_code 목록 가져오기
//segment의 값이 한글인경우 urldecode가 필요
$this->getAddDbService()->getModel()->where('addDB_code', $this->adddb_code);
$addDbEntities = $this->getAddDbService()->getEntities();
$service_codes = [];
foreach ($addDbEntities as $entity) {
$service_codes[] = $entity->getServiceCode();
}
if (!count($service_codes)) {
throw new \Exception("[{$this->adddb_code}] 값에 해당하는 부가서비스정보가 존재하지 않습니다.");
}
//전체 사용자정보
$this->clients = $this->getClientService()->getEntities();
//부가서비스용 서비스목록 가져오기
$this->curPage = intval($this->request->get('curPage', 1));
$this->perPage = intval($this->request->get('perPage', APP_VIEW_LIST_PERPAGE));
$this->getServiceService()->getModel()->whereIn('service_code', $service_codes);
[$this->total, $this->entities] = $this->getServiceService()->getList($this->curPage, $this->perPage);
$this->pagination = new Pagination($this->total, (int)$this->curPage, (int)$this->perPage);
return $this->render(__FUNCTION__);
}
} //Class

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

@ -0,0 +1,38 @@
<?php
namespace lib\Core;
use lib\Core\Router;
use lib\Core\Http\Response;
abstract class App
{
protected function __construct()
{
// 초기화 작업
}
public function run()
{
$router = new Router();
require_once APP_PATH . "Configs" . DIRECTORY_SEPARATOR . "Route.php";
// CLI 요청인지 웹 요청인지에 따라 URI 파싱
$uri = php_sapi_name() === 'cli' ? $this->parseCliUri() : $_SERVER['REQUEST_URI'];
$method = php_sapi_name() === 'cli' ? 'GET' : $_SERVER['REQUEST_METHOD'];
$response = $router->dispatch($uri, $method);
if ($response instanceof Response) {
$response->send();
} else {
echo $response; // 단순 string 반환일 경우 (fallback)
}
}
/**
* CLI 요청에서 URI를 파싱하는 메서드
* @return string
*/
private function parseCliUri(): string
{
global $argv;
return $argv[1] ?? '';
}
}

View File

@ -0,0 +1,75 @@
<?php
namespace lib\Core;
use lib\Core\Logger;
use lib\Core\Http\Redirect;
use lib\Core\Http\Request;
use lib\Core\Http\Session;
use lib\Core\Http\Url;
use lib\Core\Http\Response;
abstract class Controller
{
protected ?View $_view = null;
protected ?Url $url = null;
protected ?Request $request = null;
protected ?Session $session = null;
protected ?Redirect $redirect = null;
protected ?Logger $logger = null;
protected function __construct(array $params = [])
{
if (APP_DEBUG) {
error_reporting(E_ALL);
ini_set('display_errors', '1');
} else {
error_reporting(0);
ini_set('display_errors', '0');
}
$this->url = new Url();
$this->request = new Request($params);
$this->session = new Session();
$this->redirect = new Redirect($this->session);
$this->logger = new Logger();
$this->_view = new View();
} //
final public function __get($name): mixed
{
return $this->_view->$name;
}
final public function __set($name, $value): void
{
$this->_view->$name = $value;
}
final public function __call($name, $arguments)
{
if (method_exists($this, $name)) {
return call_user_func_array([$this, $name], $arguments);
}
throw new \BadMethodCallException("Method {$name} does not exist.");
} //
final public function setLayout(string $file): void
{
$this->_view->setLayout($file);
}
final public function setPath(string $path): void
{
$this->_view->setPath($path);
}
public function render(string $file): Response
{
// if (empty($file)) {
// throw new \InvalidArgumentException("File name cannot be empty.");
// }
// $this->_view->setFile($file);
// $this->_view->setLayout($this->layout);
// $this->_view->setPath($this->path);
// $this->_view->setParams($this->params);
// $this->_view->setUrl($this->url);
// $this->_view->setRequest($this->request);
// $this->_view->setSession($this->session);
// $this->_view->setRedirect($this->redirect);
// $this->_view->setLogger($this->logger);
return new Response($this->_view->render($file), 200, ['Content-Type' => 'text/html']);
}
} //Class

View File

@ -0,0 +1,23 @@
<?php
namespace lib\Core\Database;
use lib\Database\Core\QueryBuilder;
use PDO;
class DB
{
private static ?PDO $pdo = null;
public static function init(): void {}
public static function getPDO(): PDO
{
if (self::$pdo === null) {
$dsn = sprintf("%s:host=%s;dbname=%s;charset=%s", DATABASE_DRIVER, DATABASE_HOST, DATABASE_DB, DATABASE_CHARSET);
self::$pdo = new \PDO($dsn, DATABASE_ID, DATABASE_PASSWORD);
self::$pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
}
return self::$pdo;
}
}

View File

@ -0,0 +1,393 @@
<?php
namespace lib\Core\Database;
use PDO;
use PDOStatement;
class QueryBuilder
{
private bool $_debug = false;
private bool $_continue = false;
protected PDO $pdo;
protected string $latestQuery = "";
protected string $table = '';
protected array $select = ['*'];
protected array $where = [];
protected array $bindings = [];
protected array $order = [];
protected array $joins = [];
protected ?int $limit = null;
protected ?int $offset = null;
protected function __construct(PDO $pdo)
{
$this->pdo = $pdo;
}
final public function setDebug(bool $debug): void
{
$this->_debug = $debug;
}
final public function setContinue(bool $continue): void
{
$this->_continue = $continue;
}
final public function getLastQuery(): string
{
return $this->latestQuery;
}
final public function table(string $table): static
{
$this->table = $table;
return $this;
}
protected function buildSelectSql(?string $select = null): string
{
$select = $select ?? implode(', ', $this->select);
$sql = "SELECT {$select} FROM {$this->table}";
// ⬇️ Join 처리 추가
if (!empty($this->joins)) {
$sql .= ' ' . implode(' ', $this->joins);
}
if (!empty($this->where)) {
$sql .= " WHERE " . $this->buildWhereSql();
}
if (!empty($this->order)) {
$sql .= " ORDER BY " . implode(', ', $this->order);
}
if ($this->limit) {
$sql .= " LIMIT {$this->limit}";
}
if ($this->offset) {
$sql .= " OFFSET {$this->offset}";
}
return $sql;
}
protected function buildWhereSql(): string
{
$sql = '';
foreach ($this->where as $index => $clause) {
if (is_array($clause)) {
$boolean = $index === 0 ? '' : $clause['boolean'] . ' ';
$sql .= $boolean . $clause['condition'] . ' ';
} else {
// 문자열 형태일 경우 (like에서 사용됨)
$boolean = $index === 0 ? '' : 'AND ';
$sql .= $boolean . $clause . ' ';
}
}
return trim($sql);
}
//Select부분분
final public function select(array|string $columns): static
{
$this->select = is_array($columns) ? $columns : explode(',', $columns);
return $this;
}
//Where절부분
final public function where(array|string $column, mixed $value = null, ?string $operator = null, string $boolean = "AND"): static
{
if (is_array($column)) {
foreach ($column as $col => $val) {
$this->where($col, $val); // 재귀 호출
}
return $this;
}
// where("col = NOW()") 형태의 raw 처리
if ($value === null && $operator === null) {
$this->where[] = ['condition' => $column, 'boolean' => $boolean];
return $this;
}
// where("col", "val") → operator 생략 시 = 처리
if ($operator === null) {
$operator = "=";
}
$placeholder = ':w_' . count($this->bindings);
$this->where[] = ['condition' => "$column $operator $placeholder", 'boolean' => $boolean];
$this->bindings[$placeholder] = $value;
return $this;
}
final public function orWhere(array|string $column, mixed $value = null, ?string $operator = null, string $boolean = "OR"): static
{
return $this->where($column, $value, $operator, $boolean);
}
final public function whereIn(string $column, array $values, string $boolean = 'AND', $conditon = "IN"): static
{
if (empty($values)) {
throw new \InvalidArgumentException(__FUNCTION__ . ": values 배열이 비어있을 수 없습니다.");
}
$placeholders = [];
foreach ($values as $index => $value) {
$placeholder = ":in_" . count($this->bindings);
$placeholders[] = $placeholder;
$this->bindings[$placeholder] = $value;
}
$condition = "$column $conditon (" . implode(', ', $placeholders) . ")";
$this->where[] = ['condition' => $condition, 'boolean' => $boolean];
return $this;
}
final public function whereNotIn(string $column, array $values, $boolean = "AND", $conditon = "NOT IN"): static
{
if (empty($values)) {
throw new \InvalidArgumentException(__FUNCTION__ . ": values 배열이 비어있을 수 없습니다.");
}
return $this->whereIn($column, $values, $boolean, $conditon);
}
final public function orWhereIn(string $column, array $values, $boolean = "OR", $conditon = "IN"): static
{
if (empty($values)) {
throw new \InvalidArgumentException(__FUNCTION__ . ": values 배열이 비어있을 수 없습니다.");
}
return $this->whereIn($column, $values, $boolean, $conditon);
}
//Join
final public function join(string $table, string $on, string $type = 'INNER'): static
{
$this->joins[] = strtoupper($type) . " JOIN $table ON $on";
return $this;
}
//Like
//사용예:
// $model->like(['name' => '%홍%', 'email' => '%@naver.com%']);
// $model->likeIn(['title', 'description'], '%공지%');
// $model->orLikeIn(['name', 'nickname'], '%철수%');
public function like(array|string $column, ?string $value = null, string $operator = 'LIKE', string $boolean = "AND"): static
{
if (is_array($column)) {
$conditions = [];
foreach ($column as $col => $val) {
$placeholder = ':l_' . count($this->bindings);
$conditions[] = "$col $operator $placeholder";
$this->bindings[$placeholder] = $val;
}
$this->where[] = '(' . implode(" $boolean ", $conditions) . ')';
} else {
$placeholder = ':l_' . count($this->bindings);
$condition = "$column $operator $placeholder";
if (empty($this->where)) {
$this->where[] = $condition;
} else {
$last = array_pop($this->where);
$this->where[] = "($last $boolean $condition)";
}
$this->bindings[$placeholder] = $value;
}
return $this;
}
public function orLike(array|string $column, ?string $value = null, string $operator = 'LIKE', string $boolean = "OR"): static
{
return $this->like($column, $value, $operator, $boolean);
}
public function likeIn(array $columns, string $value, string $operator = "LIKE", string $boolean = "AND"): static
{
$orConditions = [];
foreach ($columns as $col) {
$placeholder = ':li_' . count($this->bindings);
$orConditions[] = "$col $operator $placeholder";
$this->bindings[$placeholder] = $value;
}
$this->where[] = '(' . implode(" $boolean ", $orConditions) . ')';
return $this;
}
public function orLikeIn(array $columns, string $value, string $operator = "LIKE", string $boolean = "OR"): static
{
return $this->likeIn($columns, $value, $operator, $boolean);
}
public function notLikeIn(array $columns, string $value, string $operator = "NOT LIKE", string $boolean = "AND"): static
{
return $this->likeIn($columns, $value, $operator, $boolean);
}
//Order
final public function orderBy(mixed $column, string $direction = 'ASC'): static
{
if (is_array($column)) {
// 배열 형식의 여러 컬럼 정렬을 처리
foreach ($column as $col => $dir) {
// 배열 키가 컬럼 이름이고 값이 방향임
$this->order[] = "$col $dir";
}
} else {
// 단일 컬럼에 대한 정렬
$this->order[] = "$column $direction";
}
return $this;
}
//Limit부분
final public function limit(int $limit): static
{
$this->limit = $limit;
return $this;
}
final public function offset(int $offset): static
{
$this->offset = $offset;
return $this;
}
//Customer SQL 실행부분
final public function raw(string $sql, array $bindings = []): array
{
$stmt = $this->pdo->prepare($sql);
foreach ($bindings as $key => $value) {
$stmt->bindValue(is_int($key) ? $key + 1 : $key, $value);
}
$stmt->execute();
return $stmt->fetchAll(PDO::FETCH_ASSOC);
}
//Result부분
//binding까지 완료한 SQL문을 return함
final public function toRawSql(?string $select = null): string
{
$raw = $this->buildSelectSql($select);
foreach ($this->bindings as $key => $value) {
$escaped = is_numeric($value) ? $value : $this->pdo->quote($value);
// 명명된 바인딩
if (str_starts_with($key, ':')) {
$raw = str_replace($key, $escaped, $raw);
} else {
// 물음표 바인딩인 경우 (whereIn 등)
$raw = preg_replace('/\?/', $escaped, $raw, 1);
}
}
return $raw;
}
private function execute(?string $select = null): PDOStatement
{
if ($this->_debug) {
echo php_sapi_name() === 'cli'
? "\nSQL DEBUG: " . $this->toRawSql($select) . "\n"
: "<pre>SQL DEBUG: " . $this->toRawSql($select) . "</pre>";
}
$this->latestQuery = $this->toRawSql();
$stmt = $this->pdo->prepare($this->buildSelectSql($select));
foreach ($this->bindings as $key => $value) {
$stmt->bindValue($key, $value);
}
$stmt->execute();
return $stmt;
}
final public function get(?string $select = null): array
{
$stmt = $this->execute($select);
if (!$this->_continue) {
$this->where = [];
$this->bindings = [];
}
$this->setContinue(false);
return $stmt->fetchAll(PDO::FETCH_ASSOC);
}
final public function first(): ?array
{
$this->limit = 1;
$results = $this->get();
return $results[0] ?? null;
}
final public function count(string $select = "COUNT(*) as cnt"): int
{
$results = $this->get($select);
return (int)($results[0]['cnt'] ?? 0);
}
//CUD부분
final public function insert(array $data): bool|int
{
$columns = [];
$placeholders = [];
$this->bindings = [];
foreach ($data as $col => $val) {
$safePlaceholder = ':i_' . count($this->bindings);
if ($val === null) {
// null 값인 경우 SQL 조각으로 처리
$placeholders[] = $col;
} else {
$columns[] = $col;
$placeholders[] = $safePlaceholder;
$this->bindings[$safePlaceholder] = $val;
}
}
$columnsSql = $columns ? '(' . implode(', ', $columns) . ')' : '';
$placeholdersSql = '(' . implode(', ', $placeholders) . ')';
$sql = "INSERT INTO {$this->table} {$columnsSql} VALUES {$placeholdersSql}";
$stmt = $this->pdo->prepare($sql);
foreach ($this->bindings as $key => $value) {
$stmt->bindValue($key, $value);
}
$result = $stmt->execute();
return $result && $stmt->rowCount() > 0 ? (int)$this->pdo->lastInsertId() : false;
}
final public function update(array $data): bool
{
if (empty($this->where)) {
throw new \Exception(__FUNCTION__ . " 구문은 WHERE절 없이 사용할수 없습니다.");
}
$setParts = [];
foreach ($data as $col => $val) {
if ($val === null) {
// 값이 null이면 $col을 SQL로 직접 사용
$setParts[] = $col;
} else {
$placeholder = ':u_' . preg_replace('/\W+/', '_', $col); // 안전한 placeholder 이름
$setParts[] = "$col = $placeholder";
$this->bindings[$placeholder] = $val;
}
}
$sql = "UPDATE {$this->table} SET " . implode(', ', $setParts)
. " WHERE " . $this->buildWhereSql(); // <<< 수정된 부분
$stmt = $this->pdo->prepare($sql);
foreach ($this->bindings as $k => $v) {
$stmt->bindValue($k, $v);
}
return $stmt->execute();
}
final public function delete(): bool
{
if (empty($this->where)) {
throw new \Exception("DELETE 문에는 WHERE 절이 반드시 필요합니다.");
}
$sql = "DELETE FROM {$this->table} WHERE " . $this->buildWhereSql();
$stmt = $this->pdo->prepare($sql);
foreach ($this->bindings as $key => $value) {
$stmt->bindValue($key, $value);
}
return $stmt->execute();
}
//transaction관련련
final public function beginTransaction(): void
{
$this->pdo->beginTransaction();
}
final public function commit(): void
{
$this->pdo->commit();
}
final public function rollBack(): void
{
if ($this->pdo->inTransaction()) {
$this->pdo->rollBack();
}
}
}

View File

@ -0,0 +1,24 @@
<?php
namespace lib\Core;
abstract class Entity
{
private $_values = [];
protected function __construct($datas)
{
$this->_values = $datas;
} //
final public function __get($name)
{
return $this->_values[$name];
}
final public function __set($name, $value)
{
$this->_values[$name] = $value;
}
final public function toArray(): array
{
return $this->_values;
}
} //Class

View File

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

View File

@ -0,0 +1,19 @@
<?php
namespace lib\Core\Http;
class BearerToken extends Http
{
public function __construct()
{
parent::__construct();
}
public function token(): ?string
{
$header = $this->getHeader('Authorization');
if ($header && str_starts_with($header, 'Bearer ')) {
return substr($header, 7);
}
return null;
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace lib\Core\Http;
class Cookie extends Http
{
public function __construct()
{
parent::__construct();
}
public function get(string $key, $default = null): mixed
{
return $_COOKIE[$key] ?? $default;
}
public function set(string $key, $value, int $expire = APP_SESSION_COOKIE_EXPIRE, string $path = APP_SESSION_COOKIE_PATH): void
{
setcookie($key, $value, time() + $expire, $path);
}
public function remove(string $key): void
{
setcookie($key, '', time() - APP_SESSION_COOKIE_EXPIRE, APP_SESSION_COOKIE_PATH);
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace lib\Core\Http;
class Http
{
protected array $headers = [];
protected function __construct() {}
public function getHeaders(): array
{
return $this->headers;
}
public function getHeader(string $key): ?string
{
return $this->headers[$key] ?? null;
}
}

View File

@ -0,0 +1,52 @@
<?php
namespace lib\Core\Http;
class Redirect
{
protected Session $session;
public function __construct(Session $session)
{
$this->session = $session;
}
// 리다이렉트할 때 캐시를 방지하는 헤더 추가
private function noCacheHeaders(): void
{
header("Cache-Control: no-cache, no-store, must-revalidate");
header("Pragma: no-cache");
header("Expires: 0");
}
// 이전 페이지로 리다이렉트 (캐시 방지)
public function back(): self
{
$this->noCacheHeaders(); // 캐시 방지
$backUrl = $_SERVER['HTTP_REFERER'] ?? '/';
header("Location: {$backUrl}");
return $this;
}
// 특정 URL로 리다이렉트 (캐시 방지)
public function to(string $url): self
{
$this->noCacheHeaders(); // 캐시 방지
header("Location: {$url}");
return $this;;
}
// 세션에 값 추가 후 리다이렉트
public function withInput(): self
{
$this->session->flashInput($_POST);
return $this;
}
// 세션에 에러 메시지 저장 후 리다이렉트
public function with(string $key, mixed $value): self
{
$this->session->flash($key, $value);
return $this;
}
}

View File

@ -0,0 +1,67 @@
<?php
namespace lib\Core\Http;
class Request extends Http
{
private array $_datas = [];
public function __construct(array $params = [])
{
parent::__construct();
$this->_datas = array_merge($_GET, $_POST, $params);
}
public function all(): array
{
return $this->_datas;
}
public function get(?string $key = null, $default = null): mixed
{
if ($key === null) {
return $this->all();
}
return $this->_datas[$key] ?? $default;
}
public function only(array $keys): array
{
return array_intersect_key($this->_datas, array_flip($keys));
}
public function has(string $key): bool
{
return array_key_exists($key, $this->_datas);
}
/**
* Validator 연동
*/
//사용예:
// $request = new Request();
// $validation = $request->validate([
// 'username' => 'required|alpha_numeric|min[4]',
// 'email' => 'required|email',
// 'password' => 'required|min[6]'
// ]);
// if ($validation !== true) {
// // 에러 처리
// print_r($validation);
// } else {
// // 통과
// echo "유효성 검사 통과!";
// }
public function validate(array $rules, array $messages = []): bool|array
{
$validator = new Validator();
$validator->setData($this->all())->setRules($rules)->setMessages($messages);
if (!$validator->run()) {
return $validator->errors();
}
return true;
}
}

View File

@ -0,0 +1,85 @@
<?php
namespace lib\Core\Http;
//사용법
//1. 일반 HTML 반환
//return new Response('<h1>Hello World</h1>');
//2. JSON API 응답
//return (new Response())->json(['status' => 'success','message' => 'OK']);
//3. redirect
//return (new Response())->redirect('/login');
//4. 파일 다운로드
//return (new Response())->download('/path/to/manual.pdf', '사용자_매뉴얼.pdf');
class Response
{
private string $content = '';
private int $statusCode = 200;
private array $headers = [];
public function __construct(string $content = '', int $statusCode = 200, array $headers = [])
{
$this->content = $content;
$this->statusCode = $statusCode;
$this->headers = $headers;
}
public function setContent(string $content): self
{
$this->content = $content;
return $this;
}
public function setStatusCode(int $code): self
{
$this->statusCode = $code;
return $this;
}
public function header(string $key, string $value): self
{
$this->headers[$key] = $value;
return $this;
}
public function json(array $data): self
{
$this->header('Content-Type', 'application/json');
$this->content = json_encode($data, JSON_UNESCAPED_UNICODE);
return $this;
}
public function redirect(string $url): self
{
$this->statusCode = 302;
$this->header('Location', $url);
return $this;
}
public function download(string $filePath, ?string $downloadName = null): self
{
if (!file_exists($filePath)) {
return $this->setStatusCode(404)->setContent("File not found.");
}
$downloadName = $downloadName ?? basename($filePath);
$this->header('Content-Description', 'File Transfer')
->header('Content-Type', mime_content_type($filePath))
->header('Content-Disposition', 'attachment; filename="' . $downloadName . '"')
->header('Content-Length', (string)filesize($filePath))
->header('Pragma', 'public')
->header('Cache-Control', 'must-revalidate');
$this->content = file_get_contents($filePath);
return $this;
}
public function send(): void
{
http_response_code($this->statusCode);
foreach ($this->headers as $key => $value) {
header("$key: $value");
}
echo $this->content;
}
}

View File

@ -0,0 +1,72 @@
<?php
namespace lib\Core\Http;
class Session extends Http
{
public function __construct()
{
parent::__construct();
$this->init();
}
// 세션 시작
public function init(): void
{
if (session_status() === PHP_SESSION_NONE) {
if (!is_dir(APP_SESSION_PATH)) {
mkdir(APP_SESSION_PATH, APP_SESSION_PERMISSION, true);
}
session_save_path(APP_SESSION_PATH);
session_start();
}
}
// 세션에 값 저장
public function set(string $key, $value): void
{
$_SESSION[$key] = $value;
}
// 세션에서 값 가져오기
public function get(string $key): mixed
{
return $_SESSION[$key] ?? null;
}
// 세션에서 값 삭제
public function remove(string $key): void
{
unset($_SESSION[$key]);
}
// 세션에 에러 메시지 설정
public function flash(string $key, $message): void
{
$_SESSION['flash'][$key] = $message;
}
// 세션에 입력값 설정 (입력값 유지)
public function flashInput(array $input): void
{
$_SESSION['flash']['input'] = $input;
}
// 세션에 flash 메시지가 있는지 확인
public function hasFlash(string $key): bool
{
return isset($_SESSION['flash'][$key]);
}
// flash 메시지 가져오기
public function getFlash(string $key): mixed
{
return $_SESSION['flash'][$key] ?? null;
}
// flash 메시지 삭제
public function clearFlash(): void
{
unset($_SESSION['flash']);
}
}

View File

@ -0,0 +1,103 @@
<?php
namespace lib\Core\Http;
class Url extends Http
{
protected string $baseUrl;
protected string $uri;
public function __construct()
{
parent::__construct();
$this->baseUrl = $this->detectBaseUrl();
$this->uri = $this->detectUri();
}
// 현재 전체 URL 반환
public function current(): string
{
return $this->baseUrl . '/' . ltrim($this->uri, '/');
}
// base URL만 반환
public function base(): string
{
return $this->baseUrl;
}
// 세그먼트 배열 반환
public function segments(): array
{
return explode('/', trim($this->uri, '/'));
}
// N번째 세그먼트 반환 (1부터 시작)
public function segment(int $n): ?string
{
$segments = $this->segments();
return $segments[$n - 1] ?? null;
}
// 특정 경로에 대한 URL 생성
public function to(string $path): string
{
return rtrim($this->baseUrl, '/') . '/' . ltrim($path, '/');
}
// URI 추출 (도메인 제외)
protected function detectUri(): string
{
$uri = $_SERVER['REQUEST_URI'] ?? '/';
$scriptName = dirname($_SERVER['SCRIPT_NAME'] ?? '');
$uri = str_replace($scriptName, '', $uri);
$uri = strtok($uri, '?'); // 쿼리 스트링 제거
return $uri;
}
// base URL 추출
protected function detectBaseUrl(): string
{
$scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
$host = $_SERVER['HTTP_HOST'] ?? 'localhost';
$scriptDir = rtrim(dirname($_SERVER['SCRIPT_NAME'] ?? ''), '/');
return $scheme . '://' . $host . $scriptDir;
}
public static function baseUrl(): string
{
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? "https://" : "http://";
$host = $_SERVER['HTTP_HOST'] ?? 'localhost';
$script = str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);
return rtrim($protocol . $host . $script, '/');
}
public static function currentUrl(): string
{
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? "https://" : "http://";
$host = $_SERVER['HTTP_HOST'] ?? 'localhost';
$uri = $_SERVER['REQUEST_URI'] ?? '';
return $protocol . $host . $uri;
}
public static function previousUrl(): ?string
{
return $_SERVER['HTTP_REFERER'] ?? null;
}
public static function urlIs(string $pattern): bool
{
$uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
$pattern = str_replace('*', '.*', preg_quote($pattern, '/'));
return preg_match("/^{$pattern}$/", $uri) === 1;
}
public static function getSegment(int $index): ?string
{
$uri = trim(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH), '/');
$segments = explode('/', $uri);
return $segments[$index - 1] ?? null;
}
}

View File

@ -0,0 +1,153 @@
<?php
namespace lib\Core\Http;
//사용법
// $validator = new \lib\Http\Validator();
// $validator->setData([
// 'username' => 'admin123',
// 'email' => 'admin@example.com',
// 'password' => '1234'
// ])->setRules([
// 'username' => 'required|alpha_numeric|min[4]|max[20]',
// 'email' => 'required|email',
// 'password' => 'required|min[6]'
// ]);
// if (!$validator->run()) {
// print_r($validator->errors());
// }
class Validator extends Http
{
protected array $data = [];
protected array $rules = [];
protected array $errors = [];
protected array $customMessages = [];
protected array $availableRules = [
'required',
'min',
'max',
'email',
'numeric',
'alpha',
'alpha_numeric'
];
public function __construct()
{
parent::__construct();
}
public function setData(array $data): self
{
$this->data = $data;
return $this;
}
public function setRules(array $rules): self
{
$this->rules = $rules;
return $this;
}
public function setMessages(array $messages): self
{
$this->customMessages = $messages;
return $this;
}
public function run(): bool
{
$this->errors = [];
foreach ($this->rules as $field => $ruleStr) {
$rules = explode('|', $ruleStr);
$value = $this->data[$field] ?? null;
foreach ($rules as $rule) {
$param = null;
if (strpos($rule, '[') !== false) {
preg_match('/(\w+)\[(.*?)\]/', $rule, $matches);
$rule = $matches[1];
$param = $matches[2];
}
$method = "validate_$rule";
if (method_exists($this, $method)) {
$result = $this->$method($value, $param);
if (!$result) {
$this->addError($field, $rule, $param);
}
}
}
}
return empty($this->errors);
}
public function errors(): array
{
return $this->errors;
}
protected function addError(string $field, string $rule, $param = null): void
{
$message = $this->customMessages["$field.$rule"] ?? $this->defaultMessage($field, $rule, $param);
$this->errors[$field][] = $message;
}
protected function defaultMessage(string $field, string $rule, $param): string
{
return match ($rule) {
'required' => "$field is required.",
'min' => "$field must be at least $param characters.",
'max' => "$field must be at most $param characters.",
'email' => "$field must be a valid email address.",
'numeric' => "$field must be a number.",
'alpha' => "$field must contain only letters.",
'alpha_numeric' => "$field must contain only letters and numbers.",
default => "$field is invalid.",
};
}
// --- 기본 유효성 검사 메서드 ---
protected function validate_required($value): bool
{
return !empty($value) || $value === '0';
}
protected function validate_min($value, $param): bool
{
return strlen($value) >= (int)$param;
}
protected function validate_max($value, $param): bool
{
return strlen($value) <= (int)$param;
}
protected function validate_email($value): bool
{
return filter_var($value, FILTER_VALIDATE_EMAIL) !== false;
}
protected function validate_numeric($value): bool
{
return is_numeric($value);
}
protected function validate_alpha($value): bool
{
return ctype_alpha($value);
}
protected function validate_alpha_numeric($value): bool
{
return ctype_alnum($value);
}
// 사용자 정의 규칙도 등록할 수 있도록 향후 확장 가능
}

View File

@ -0,0 +1,47 @@
<?php
namespace lib\Core;
class Logger
{
protected string $logPath = APP_LOG_PATH . DIRECTORY_SEPARATOR;
public function __construct(string $logDir = APP_LOG_PATH)
{
$this->logPath = rtrim($logDir, DIRECTORY_SEPARATOR);
if (!is_dir($this->logPath)) {
mkdir($this->logPath, APP_LOG_PERMISSION, true);
}
}
public function log(string $message, string $level = APP_LOG_LEVELS['info']): void
{
$filename = date('Y-m-d') . '.log';
$filepath = "{$this->logPath}/{$filename}";
$time = date('Y-m-d H:i:s');
$formatted = "[{$time}] [{$level}] {$message}\n";
file_put_contents($filepath, $formatted, FILE_APPEND);
}
public function info(string $message): void
{
$this->log($message, APP_LOG_LEVELS['info']);
}
public function error(string $message): void
{
$this->log($message, APP_LOG_LEVELS['info']);
}
public function warning(string $message): void
{
$this->log($message, APP_LOG_LEVELS['warning']);
}
public function debug(string $message): void
{
if (APP_LOG_LEVELS['debug']) {
$this->log($message, APP_LOG_LEVELS['debug']);
}
}
}

View File

@ -0,0 +1,19 @@
<?php
namespace lib\Core\Middlewares;
use lib\Core\Middlewares\MiddlewareInterface;
use lib\Core\Http\Response;
class AuthMiddleware implements MiddlewareInterface
{
public function handle(array $params, callable $next)
{
// 간단한 인증 체크 예시: token 값이 'secret'이 아니면 거부
if (!isset($params['token']) || $params['token'] !== 'secret') {
Response::json(['error' => 'Unauthorized'], 401);
return;
}
return $next($params);
}
}

View File

@ -0,0 +1,8 @@
<?php
namespace lib\Core\Middlewares;
interface MiddlewareInterface
{
public function handle(array $params, callable $next);
}

View File

@ -0,0 +1,21 @@
<?php
namespace lib\Core;
use lib\Core\Database\DB;
use lib\Core\Database\QueryBuilder;
abstract class Model extends QueryBuilder
{
public function __construct()
{
DB::init(); // ✅ 여기서 초기화
parent::__construct(DB::getPDO()); // QueryBuilder에 전달
parent::table($this->getTable());
parent::setDebug($_ENV['DATABASE_QUERY_DEBUG'] ?? $_SERVER['DATABASE_QUERY_DEBUG'] ?? false);
}
abstract public function getTable(): string;
abstract public function getPKField(): string;
abstract public function getTitleField(): string;
}

132
extdbms/lib/Core/Router.php Normal file
View File

@ -0,0 +1,132 @@
<?php
namespace lib\Core;
use lib\Core\Http\Response;
class Router
{
private array $routes = [];
private string $currentGroupPrefix = '';
private array $currentGroupMiddlewares = [];
/**
* 라우트 등록 (동적 파라미터 지원)
*/
public function add(string $method, string $path, callable $callback, array $middlewares = []): void
{
// 그룹 접두사와 병합
$fullPath = trim($this->currentGroupPrefix . '/' . trim($path, '/'), '/');
$route = [
'method' => strtoupper($method),
'path' => $fullPath,
'callback' => $callback,
'middlewares' => array_merge($this->currentGroupMiddlewares, $middlewares)
];
// 동적 파라미터({param})가 있으면 정규식 패턴 생성
if (strpos($fullPath, '{') !== false) {
$pattern = preg_replace_callback('/\{(\w+)\}/', function ($matches) {
return '(?P<' . $matches[1] . '>[^/]+)';
}, $fullPath);
$route['pattern'] = '/^' . str_replace('/', '\/', $pattern) . '(\/.*)?$/';
} else {
// SEO key/value 형태를 위해 접두사 이후의 추가 파라미터를 허용
$route['pattern'] = '/^' . str_replace('/', '\/', $fullPath) . '(\/(?P<extra>.*))?$/';
}
$this->routes[] = $route;
}
/**
* 라우트 그룹: 공통 접두사와 공통 미들웨어를 적용
*/
public function group(string $prefix, callable $callback, array $middlewares = []): void
{
$previousGroupPrefix = $this->currentGroupPrefix;
$previousGroupMiddlewares = $this->currentGroupMiddlewares;
$this->currentGroupPrefix = trim($previousGroupPrefix . '/' . trim($prefix, '/'), '/');
$this->currentGroupMiddlewares = array_merge($previousGroupMiddlewares, $middlewares);
$callback($this);
$this->currentGroupPrefix = $previousGroupPrefix;
$this->currentGroupMiddlewares = $previousGroupMiddlewares;
}
/**
* 라우트 매칭 실행
*/
public function dispatch(string $uri, string $method = 'GET'): mixed
{
$uri = trim(parse_url($uri, PHP_URL_PATH), '/');
// 정적 파일 처리: public 폴더 내에 파일이 있으면 직접 서빙
$staticFile = DOCUMENTROOT_PATH . $uri;
if (file_exists($staticFile) && is_file($staticFile)) {
return $this->serveStaticFile($staticFile);
}
foreach ($this->routes as $route) {
if ($route['method'] !== strtoupper($method)) { //GET, POST 등 HTTP 메소드 체크
continue;
}
if (preg_match($route['pattern'], $uri, $matches)) {
$params = [];
// 패턴에 named 그룹이 있다면 추출
foreach ($matches as $key => $value) {
if (is_string($key)) {
$params[$key] = $value;
}
}
//추가 SEO key/value 파라미터로 파싱
if (isset($params['extra']) && $params['extra'] !== '') {
$extra = trim($params['extra'], '/');
$extraSegments = explode('/', $extra);
// 짝수개여야 key/value 쌍으로 변환 가능
if (count($extraSegments) % 2 === 0) {
for ($i = 0; $i < count($extraSegments); $i += 2) {
$key = $extraSegments[$i];
$value = $extraSegments[$i + 1];
$params[$key] = $value;
}
}
unset($params['extra']);
} else {
// 패턴에 extra 그룹이 없으면, 기본 GET 파라미터와 병합
$params = array_merge($_GET, $params);
}
return $this->handle($route, $params);
}
}
// 404 응답 객체 반환
return (new Response('해당 Route 경로를 찾을수 없습니다.' . $uri, 404));
}
/**
* 미들웨어 체인을 거쳐 최종 콜백 실행
*/
private function handle(array $route, array $params): mixed
{
$handler = $route['callback'];
$middlewares = $route['middlewares'];
$pipeline = array_reduce(
array_reverse($middlewares),
fn($next, $middleware) => fn($params) => (new $middleware)->handle($params, $next),
$handler
);
return $pipeline($params);
}
/**
* 정적 파일 서빙 (이미지, CSS, JS )
*/
private function serveStaticFile(string $file): Response
{
return (new Response())
->header('Content-Type', mime_content_type($file))
->setContent(file_get_contents($file));
}
}

View File

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

View File

@ -0,0 +1,117 @@
<?php
namespace lib\Core\Utils;
class Pagination
{
public int $currentPage;
public int $perPage;
public int $totalItems;
public int $totalPages;
public int $groupSize = 10;
public int $start;
public int $end;
public function __construct(int $totalItems, int $currentPage = 1, int $perPage = 10)
{
$this->totalItems = $totalItems;
$this->perPage = $perPage;
$this->currentPage = max(1, $currentPage);
$this->totalPages = (int)ceil($totalItems / $perPage);
$this->start = ($this->currentPage - 1) * $perPage;
$this->end = min($this->start + $perPage, $totalItems);
$this->groupSize = intval(APP_VIEW_LIST_PAGINATION_GROUPSIZE);
}
public function hasPrevious(): bool
{
return $this->currentPage > 1;
}
public function hasNext(): bool
{
return $this->currentPage < $this->totalPages;
}
public function previousPage(): int
{
return max(1, $this->currentPage - 1);
}
public function nextPage(): int
{
return min($this->totalPages, $this->currentPage + 1);
}
public function getOffset(): int
{
return $this->start;
}
public function getLimit(): int
{
return $this->perPage;
}
public function toArray(): array
{
return [
'current_page' => $this->currentPage,
'per_page' => $this->perPage,
'total_items' => $this->totalItems,
'total_pages' => $this->totalPages,
'has_previous' => $this->hasPrevious(),
'has_next' => $this->hasNext(),
'previous_page' => $this->previousPage(),
'next_page' => $this->nextPage(),
'offset' => $this->getOffset(),
'limit' => $this->getLimit(),
];
}
public function render(string $baseUrl = '', array $query = []): string
{
if ($this->totalPages <= 1) {
return '';
}
$html = '<nav><ul class="pagination">';
$currentGroup = (int)floor(($this->currentPage - 1) / $this->groupSize);
$startPage = $currentGroup * $this->groupSize + 1;
$endPage = min($startPage + $this->groupSize - 1, $this->totalPages);
// << 그룹 이전
if ($startPage > 1) {
$prevGroupPage = max(1, $startPage - 1);
$html .= $this->pageLink($prevGroupPage, '&laquo;', $baseUrl, $query);
} else {
$html .= '<li class="page-item disabled"><span class="page-link">&laquo;</span></li>';
}
// 페이지 번호들
for ($i = $startPage; $i <= $endPage; $i++) {
if ($i === $this->currentPage) {
$html .= '<li class="page-item active"><span class="page-link">' . $i . '</span></li>';
} else {
$html .= $this->pageLink($i, (string)$i, $baseUrl, $query);
}
}
// >> 그룹 다음
if ($endPage < $this->totalPages) {
$nextGroupPage = $endPage + 1;
$html .= $this->pageLink($nextGroupPage, '&raquo;', $baseUrl, $query);
} else {
$html .= '<li class="page-item disabled"><span class="page-link">&raquo;</span></li>';
}
$html .= '</ul></nav>';
return $html;
}
private function pageLink(int $page, string $label, string $baseUrl, array $query): string
{
$query['curPage'] = $page;
$url = $baseUrl . '?' . http_build_query($query);
return '<li class="page-item"><a class="page-link" href="' . htmlspecialchars($url) . '">' . $label . '</a></li>';
}
}

54
extdbms/lib/Core/View.php Normal file
View File

@ -0,0 +1,54 @@
<?php
namespace lib\Core;
use eftec\bladeone\BladeOne;
class View
{
private array $_paths = [];
private array $_values = [];
private string $_layout = 'default_layout.php';
private ?BladeOne $_blade = null;
public function __construct()
{
if (!is_dir(APP_VIEW_PATH)) {
mkdir(APP_VIEW_PATH, APP_VIEW_PATH_PERMISSION, true);
}
if (!is_dir(APP_VIEW_CACHE_PATH)) {
mkdir(APP_VIEW_CACHE_PATH, APP_VIEW_CACHE_PATH_PERMISSION, true);
}
// BladeOne 객체 초기화
$this->_blade = new BladeOne(APP_VIEW_PATH, APP_VIEW_CACHE_PATH, BladeOne::MODE_DEBUG);
$this->_blade->setFileExtension('.php');
}
public function __set(string $name, mixed $value): void
{
$this->_values[$name] = $value;
}
public function __get(string $name): mixed
{
return $this->_values[$name] ?? null;
}
public function setLayout(string $layout): void
{
$this->_layout = $layout;
}
public function setPath(string $path): void
{
$this->_paths[] = $path;
}
public function render($file): string
{
// Blade 템플릿 렌더링
$file = implode('.', $this->_paths) . '.' . $file;
if (APP_VIEW_DEBUG) {
echo "<pre>VIwe DEBUG:" . __METHOD__ . "에서 [" . $file . "]를 렌더링합니다.</pre>";
}
return $this->_blade->run($file, $this->_values);
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace lib\Entities;
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);
} //
public function getServiceCode(): string
{
return $this->service_code;
}
} //Class

View File

@ -0,0 +1,37 @@
<?php
namespace lib\Entities;
use lib\Entities\CommonEntity as Entity;
use lib\Models\ClientModel as Model;
class ClientEntity extends Entity
{
const PKField = Model::PKField;
const TitleField = Model::TitleField;
const PairField = Model::PairField;
public function __construct($datas)
{
parent::__construct($datas);
} //
public function getClientCode(): string
{
return $this->Client_Code;
}
public function getPhone(string $field = "", string $delimeter = ","): string
{
return $field ? $this->$field : "{$this->Client_Phone1} {$delimeter} {$this->Client_Phone2}";
}
public function getEmail(string $field = "", string $delimeter = ","): string
{
return $field ? $this->$field : "{$this->Client_EMail1} {$delimeter} {$this->Client_EMail2}";
}
public function getNote(): string
{
return $this->Client_Note;
}
public function getPoint(): string
{
return $this->Client_Point;
}
} //Class

View File

@ -0,0 +1,33 @@
<?php
namespace lib\Entities;
use lib\Core\Entity as Core;
class CommonEntity extends Core
{
public function __construct($datas)
{
parent::__construct($datas);
} //
public function getPK(): string
{
$field = constant("static::PKField");
return $this->$field;
}
public function getTitle(): string
{
$field = constant("static::TitleField");
return $this->$field;
}
public function getPairKey(): string
{
$field = constant("static::PairField");
return $this->$field;
}
public function getCreatedAt(): string
{
return $this->created_at;
} //
//공통부분
} //Class

View File

@ -0,0 +1,34 @@
<?php
namespace lib\Entities;
use lib\Entities\CommonEntity as Entity;
use lib\Models\DefenceModel as Model;
class DefenceEntity extends Entity
{
const PKField = Model::PKField;
const TitleField = Model::TitleField;
const PairField = Model::PairField;
public function __construct($datas)
{
parent::__construct($datas);
} //
public function getZone(): string
{
return $this->getTitle();
} //
public function getParent(): string
{
return $this->parents;
} //
public function getChild(): string
{
return $this->child;
} //
public function getRealAddress(): string
{
return $this->real_address;
} //
} //Class

View File

@ -0,0 +1,33 @@
<?php
namespace lib\Entities;
use lib\Entities\CommonEntity as Entity;
use lib\Models\GearlistModel as Model;
class GearlistEntity extends Entity
{
const PKField = Model::PKField;
const TitleField = Model::TitleField;
const PairField = Model::PairField;
public function __construct($datas)
{
parent::__construct($datas);
} //
public function getProcess(): string
{
return $this->process;
} //
public function getSpec(): string
{
return $this->spec;
} //
public function getCPUName(): string
{
return $this->cpuname;
} //
public function getPrice(): string
{
return $this->price;
} //
} //Class

View File

@ -0,0 +1,25 @@
<?php
namespace lib\Entities;
use lib\Entities\CommonEntity as Entity;
use lib\Models\HistoryModel as Model;
class HistoryEntity extends Entity
{
const PKField = Model::PKField;
const TitleField = Model::TitleField;
const PairField = Model::PairField;
public function __construct($datas)
{
parent::__construct($datas);
} //
public function getServiceCode(): string
{
return $this->service_code;
}
public function getClientName(): string
{
return $this->client_name;
}
} //Class

View File

@ -0,0 +1,17 @@
<?php
namespace lib\Entities;
use lib\Entities\CommonEntity as Entity;
use lib\Models\KCSModel as Model;
class KCSEntity extends Entity
{
const PKField = Model::PKField;
const TitleField = Model::TitleField;
const PairField = Model::PairField;
public function __construct($datas)
{
parent::__construct($datas);
} //
} //Class

View File

@ -0,0 +1,33 @@
<?php
namespace lib\Entities;
use lib\Entities\CommonEntity as Entity;
use lib\Models\MemberModel as Model;
class MemberEntity extends Entity
{
const PKField = Model::PKField;
const TitleField = Model::TitleField;
const PairField = Model::PairField;
public function __construct($datas)
{
parent::__construct($datas);
} //
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

@ -0,0 +1,50 @@
<?php
namespace lib\Entities;
use lib\Entities\CommonEntity as Entity;
use lib\Models\OnetimeModel as Model;
class OnetimeEntity extends Entity
{
const PKField = Model::PKField;
const TitleField = Model::TitleField;
const PairField = Model::PairField;
public function __construct($datas)
{
parent::__construct($datas);
} //
public function getServiceCode(): string
{
return $this->service_code;
}
public function getMemberCode(): string
{
return $this->onetime_manager;
}
public function getClientCode(): string
{
return $this->client_code;
}
public function getAmount(): string
{
return $this->onetime_amount;
}
public function getNonPayment(): string
{
return $this->onetime_nonpayment;
}
public function getRequestDate(): string
{
return $this->onetime_request_date;
}
public function getPaymentDate(): string
{
return $this->onetime_payment_date;
}
public function getNote(): string
{
return $this->onetime_note;
}
} //Class

View File

@ -0,0 +1,34 @@
<?php
namespace lib\Entities;
use lib\Entities\CommonEntity as Entity;
use lib\Models\PointModel as Model;
class PointEntity extends Entity
{
const PKField = Model::PKField;
const TitleField = Model::TitleField;
const PairField = Model::PairField;
public function __construct($datas)
{
parent::__construct($datas);
} //
public function getClientCode(): string
{
return $this->client_code;
} //
public function getType(): string
{
return $this->type;
} //
public function getAmount(): string
{
return $this->amount;
} //
public function getNote(): string
{
return $this->note;
} //
} //Class

View File

@ -0,0 +1,25 @@
<?php
namespace lib\Entities;
use lib\Entities\CommonEntity as Entity;
use lib\Models\ServerModel as Model;
class ServerEntity extends Entity
{
const PKField = Model::PKField;
const TitleField = Model::TitleField;
const PairField = Model::PairField;
public function __construct($datas)
{
parent::__construct($datas);
} //
public function getServerCode(): string
{
return $this->server_code;
}
public function getServiceCode(): string
{
return $this->service_code;
}
} //Class

View File

@ -0,0 +1,42 @@
<?php
namespace lib\Entities;
use lib\Entities\CommonEntity as Entity;
use lib\Models\ServiceModel as Model;
class ServiceEntity extends Entity
{
const PKField = Model::PKField;
const TitleField = Model::TitleField;
const PairField = Model::PairField;
public function __construct($datas)
{
parent::__construct($datas);
} //
public function getServiceCode(): string
{
return $this->service_code;
}
public function getServerCode(): string
{
return $this->server_code;
}
public function getMemberCode(): string
{
return $this->service_manager;
}
public function getClientCode(): string
{
return $this->client_code;
}
public function getCoupon(): string
{
return $this->coupon;
}
public function getUsedCoupon(): string
{
return $this->coupon_use;
}
} //Class

View File

@ -0,0 +1,17 @@
<?php
namespace lib\Entities;
use lib\Entities\CommonEntity as Entity;
use lib\Models\VPCModel as Model;
class VPCEntity extends Entity
{
const PKField = Model::PKField;
const TitleField = Model::TitleField;
const PairField = Model::PairField;
public function __construct($datas)
{
parent::__construct($datas);
} //
} //Class

View File

@ -0,0 +1,14 @@
<?php
namespace lib\Helpers\Client;
use lib\Helpers\CommonHelper;
use lib\Models\ClientModel;
abstract class ClientHelper extends CommonHelper
{
protected function __construct()
{
parent::__construct();
} //
} //Class

View File

@ -0,0 +1,11 @@
<?php
namespace lib\Helpers\Client;
class PointHelper extends ClientHelper
{
public function __construct()
{
parent::__construct();
} //
} //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 = null, $type = 'ipv4'): 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,14 @@
<?php
namespace lib\Helpers;
use lib\Helpers\CommonHelper;
use lib\Models\ServiceModel;
class ServiceHelper extends CommonHelper
{
public function __construct()
{
parent::__construct();
} //
} //Class

View File

@ -0,0 +1,17 @@
<?php
namespace lib\Models;
use lib\Models\CommonModel as Model;
class AddDbModel extends Model
{
const TABLE = "adddb";
const PKField = "addDB_num";
const TitleField = "addDB_case";
const PairField = "addDB_code";
public function __construct()
{
parent::__construct();
} //
} //Class

View File

@ -0,0 +1,17 @@
<?php
namespace lib\Models;
use lib\Models\CommonModel as Model;
class ClientModel extends Model
{
const TABLE = "clientdb";
const PKField = "Client_Num";
const TitleField = "Client_Name";
const PairField = "Client_Code";
public function __construct()
{
parent::__construct();
} //
} //Class

View File

@ -0,0 +1,31 @@
<?php
namespace lib\Models;
use lib\Core\Model as Core;
abstract class CommonModel extends Core
{
public function __construct()
{
parent::__construct();
} //
// 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");
}
final public function getPairField(): string
{
return constant("static::PairField");
}
} //Class

View File

@ -0,0 +1,17 @@
<?php
namespace lib\Models;
use lib\Models\CommonModel as Model;
class DefenceModel extends Model
{
const TABLE = "defensemk";
const PKField = "idx";
const TitleField = "zone";
const PairField = self::PKField;
public function __construct()
{
parent::__construct();
} //
} //Class

View File

@ -0,0 +1,17 @@
<?php
namespace lib\Models;
use lib\Models\CommonModel as Model;
class GearlistModel extends Model
{
const TABLE = "gearlist";
const PKField = "firarr";
const TitleField = "process";
const PairField = self::TitleField;
public function __construct()
{
parent::__construct();
} //
} //Class

View File

@ -0,0 +1,17 @@
<?php
namespace lib\Models;
use lib\Models\CommonModel as Model;
class HistoryModel extends Model
{
const TABLE = "historydb";
const PKField = "history_num";
const TitleField = "behavior";
const PairField = self::PKField;
public function __construct()
{
parent::__construct();
} //
} //Class

View File

@ -0,0 +1,17 @@
<?php
namespace lib\Models;
use lib\Models\CommonModel as Model;
class KCSModel extends Model
{
const TABLE = "kcsdb";
const PKField = "kcs_num";
const TitleField = "kcs_code";
const PairField = self::TitleField;
public function __construct()
{
parent::__construct();
} //
} //Class

View File

@ -0,0 +1,17 @@
<?php
namespace lib\Models;
use lib\Models\CommonModel as Model;
class MemberModel extends Model
{
const TABLE = "memberdb";
const PKField = "id";
const TitleField = "name";
const PairField = self::PKField;
public function __construct()
{
parent::__construct();
} //
} //Class

View File

@ -0,0 +1,17 @@
<?php
namespace lib\Models;
use lib\Models\CommonModel as Model;
class OnetimeModel extends Model
{
const TABLE = "onetimedb";
const PKField = "onetime_num";
const TitleField = "onetime_sub";
const PairField = self::TitleField;
public function __construct()
{
parent::__construct();
} //
} //Class

View File

@ -0,0 +1,17 @@
<?php
namespace lib\Models;
use lib\Models\CommonModel as Model;
class PointModel extends Model
{
const TABLE = "pointdb";
const PKField = "uid";
const TitleField = "title";
const PairField = self::TitleField;
public function __construct()
{
parent::__construct();
} //
} //Class

View File

@ -0,0 +1,17 @@
<?php
namespace lib\Models;
use lib\Models\CommonModel as Model;
class ServerModel extends Model
{
const TABLE = "serverdb";
const PKField = "server_num";
const TitleField = "server_code";
const PairField = self::TitleField;
public function __construct()
{
parent::__construct();
} //
} //Class

View File

@ -0,0 +1,17 @@
<?php
namespace lib\Models;
use lib\Models\CommonModel as Model;
class ServiceModel extends Model
{
const TABLE = "servicedb";
const PKField = "service_num";
const TitleField = "service_code";
const PairField = self::TitleField;
public function __construct()
{
parent::__construct();
} //
} //Class

View File

@ -0,0 +1,17 @@
<?php
namespace lib\Models;
use lib\Models\CommonModel as Model;
class VPCModel extends Model
{
const TABLE = "vpcdb";
const PKField = "vpc_num";
const TitleField = "vpc_code";
const PairField = self::TitleField;
public function __construct()
{
parent::__construct();
} //
} //Class

View File

@ -0,0 +1,30 @@
<?php
namespace lib\Services;
use lib\Entities\AddDbEntity as Entity;
use lib\Models\AddDbModel as Model;
class AddDbService extends CommonService
{
public function __construct()
{
parent::__construct();
}
final public function getClassName(): string
{
return "Adddb";
}
final public function getClassPath(): string
{
return $this->getClassName();
}
public function getModelClass(): string
{
return Model::class;
}
public function getEntityClass(): string
{
return Entity::class;
}
}

View File

@ -0,0 +1,54 @@
<?php
namespace lib\Services;
use lib\Entities\ClientEntity as Entity;
use lib\Models\ClientModel as Model;
class ClientService extends CommonService
{
public function __construct()
{
parent::__construct();
}
final public function getClassName(): string
{
return "Client";
}
final public function getClassPath(): string
{
return $this->getClassName();
}
public function getModelClass(): string
{
return Model::class;
}
public function getEntityClass(): string
{
return Entity::class;
}
//사용자 포인트 입금
public function depositPoint(Entity $client, int $point): bool
{
if ($point < 0) {
throw new \Exception("포인트금액이 잘못되었습니다. 포인트 : $point");
}
$this->getModel()->where("Client_Code", $client->getClientCode());
$this->getModel()->update(["Client_Point=(Client_Point+{$point})" => null]);
return true;
}
//사용자 포인트 출금
public function withdrawalPoint(Entity $client, int $point): bool
{
if ($point < 0) {
throw new \Exception("포인트금액이 잘못되었습니다. 포인트 : $point");
}
if ($client->getPoint() < $point) {
throw new \Exception("포인트금액이 잘못되었습니다. 남은 포인트: " . $client->getPoint() . ", 포인트 : $point");
}
$this->getModel()->where("Client_Code", $client->getClientCode());
$this->getModel()->update(["Client_Point=(Client_Point-{$point})" => null]);
return true;
}
}

View File

@ -0,0 +1,89 @@
<?php
namespace lib\Services;
use lib\Core\Service as Core;
abstract class CommonService extends Core
{
private $_model = null;
public function __construct()
{
parent::__construct();
} //
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()->first();
if (!$result) { //결과값이 없으면 null
return $result;
}
$entityClass = $this->getEntityClass();
return new $entityClass($result);
}
final public function getEntities(): array
{
$entitys = [];
foreach ($this->getModel()->get() as $result) {
$entityClass = $this->getEntityClass();
$entity = new $entityClass($result);
$pairField = $this->getModel()->getPairField();
$entitys[$entity->$pairField] = $entity;
}
return $entitys;
} //
final public function getCount(string $select = "COUNT(*) as cnt"): int
{
$count = $this->getModel()->count($select);
// echo "<BR>" . $this->getModel()->getLastQuery();
return $count;
}
final public function getList(int $curPage = 1, int $perPage = APP_VIEW_LIST_PERPAGE): array
{
//Query문 Rest여부 -> 같은조건에 Count 받고, 결과값을 받고 싶을때는 continue()
$this->getModel()->setContinue(true);
$total = $this->getCount();
//limit, offset 설정
$this->getModel()->limit($perPage);
$this->getModel()->offset(($curPage - 1) * $perPage);
$entities = $this->getEntities();
return [$total, $entities];
}
protected function insert(array $formData): mixed
{
$insertId = $this->getModel()->insert($formData);
if (!$insertId) {
throw new \Exception("Insert Error : " . $this->getModel()->getLastError());
}
$entityClass = $this->getEntityClass();
$entity = new $entityClass($formData);
$pkField = $this->getModel()::PKFIELD;
$entity->$pkField = $insertId;
return $entity;
} //
//transaction관련련
final public function beginTransaction(): void
{
$this->getModel()->beginTransaction();
}
final public function commit(): void
{
$this->getModel()->commit();
}
final public function rollBack(): void
{
$this->getModel()->rollBack();
}
} //Class

View File

@ -0,0 +1,30 @@
<?php
namespace lib\Services;
use lib\Entities\DefenceEntity as Entity;
use lib\Models\DefenceModel as Model;
class DefenceService extends CommonService
{
public function __construct()
{
parent::__construct();
}
final public function getClassName(): string
{
return "Defence";
}
final public function getClassPath(): string
{
return $this->getClassName();
}
public function getModelClass(): string
{
return Model::class;
}
public function getEntityClass(): string
{
return Entity::class;
}
}

View File

@ -0,0 +1,38 @@
<?php
namespace lib\Services;
use lib\Entities\GearlistEntity as Entity;
use lib\Models\GearlistModel as Model;
class GearlistService extends CommonService
{
public function __construct()
{
parent::__construct();
}
final public function getClassName(): string
{
return "Gearlist";
}
final public function getClassPath(): string
{
return $this->getClassName();
}
public function getModelClass(): string
{
return Model::class;
}
public function getEntityClass(): string
{
return Entity::class;
}
public function getEntitiesForLineUp(): array
{
$this->getModel()->whereNotIn("process", DBMS_GEARLIST_PROCESS_TYPES);
$this->getModel()->whereNotIn("cpuname", DBMS_GEARLIST_CPU_TYPES);
$this->getModel()->orderBy(["process" => "ASC", "price" => "ASC", "cpuname" => "asc"]);
return $this->getEntities();
}
}

View File

@ -0,0 +1,47 @@
<?php
namespace lib\Services;
use lib\Entities\ClientEntity;
use lib\Entities\HistoryEntity as Entity;
use lib\Entities\MemberEntity;
use lib\Entities\ServiceEntity;
use lib\Models\HistoryModel as Model;
class HistoryService extends CommonService
{
public function __construct()
{
parent::__construct();
}
final public function getClassName(): string
{
return "History";
}
final public function getClassPath(): string
{
return $this->getClassName();
}
public function getModelClass(): string
{
return Model::class;
}
public function getEntityClass(): string
{
return Entity::class;
}
//도메인쿠폰 사용
public function useCouponByService(ServiceEntity $service, ClientEntity $client, string $onetime_case, int $coupon, string $note, string $onetime_request_date): bool
{
$formDatas = [
"service_code" => $service->getServiceCode(),
"server_code" => $service->getServerCode(),
"behavior_case" => $onetime_case,
"behavior" => "도메인 쿠폰 구매 / {$coupon}",
"behavior_date" => $onetime_request_date,
"note" => trim($note),
"client_name" => $client->getTitle()
];
return $this->getModel()->insert($formDatas);
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace lib\Services;
use lib\Entities\KCSEntity as Entity;
use lib\Models\KCSModel as Model;
class KCSService extends CommonService
{
public function __construct()
{
parent::__construct();
}
final public function getClassName(): string
{
return "KCS";
}
final public function getClassPath(): string
{
return $this->getClassName();
}
public function getModelClass(): string
{
return Model::class;
}
public function getEntityClass(): string
{
return Entity::class;
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace lib\Services;
use lib\Entities\MemberEntity as Entity;
use lib\Models\MemberModel as Model;
class MemberService extends CommonService
{
public function __construct()
{
parent::__construct();
}
final public function getClassName(): string
{
return "Member";
}
final public function getClassPath(): string
{
return $this->getClassName();
}
public function getModelClass(): string
{
return Model::class;
}
public function getEntityClass(): string
{
return Entity::class;
}
}

View File

@ -0,0 +1,57 @@
<?php
namespace lib\Services;
use lib\Entities\ClientEntity;
use lib\Entities\MemberEntity;
use lib\Entities\OnetimeEntity as Entity;
use lib\Entities\ServiceEntity;
use lib\Http\Request;
use lib\Models\OnetimeModel as Model;
class OnetimeService extends CommonService
{
public function __construct()
{
parent::__construct();
}
final public function getClassName(): string
{
return "Onetime";
}
final public function getClassPath(): string
{
return $this->getClassName();
}
public function getModelClass(): string
{
return Model::class;
}
public function getEntityClass(): string
{
return Entity::class;
}
//도메인쿠폰 사용용
public function useCouponByService(ServiceEntity $service, ClientEntity $client, MemberEntity $member, string $onetime_case, int $coupon, string $note, string $onetime_request_date): bool
{
$formDatas = [
"client_code" => $service->getClientCode(),
"service_code" => $service->getServiceCode(),
"onetime_case" => $onetime_case,
"onetime_sub" => "도메인 쿠폰 구매 / {$coupon}",
"onetime_amount" => 0,
"onetime_payment" => 0,
"onetime_nonpayment" => 0,
"onetime_accountStatus" => 'complete',
"onetime_request_date" => $onetime_request_date,
"onetime_payment_date" => $onetime_request_date,
"onetime_note" => trim($note),
"onetime_handle_date" => $onetime_request_date,
"onetime_manager" => $member->getPK(),
"client_name" => $client->getTitle(),
"server_code" => $service->getServerCode(),
];
return $this->getModel()->insert($formDatas);
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace lib\Services;
use lib\Entities\PointEntity as Entity;
use lib\Models\PointModel as Model;
class PointService extends CommonService
{
public function __construct()
{
parent::__construct();
}
final public function getClassName(): string
{
return "Point";
}
final public function getClassPath(): string
{
return $this->getClassName();
}
public function getModelClass(): string
{
return Model::class;
}
public function getEntityClass(): string
{
return Entity::class;
}
} //Class

View File

@ -0,0 +1,54 @@
<?php
namespace lib\Services;
use lib\Entities\ServerEntity as Entity;
use lib\Models\ServerModel as Model;
class ServerService extends CommonService
{
public function __construct()
{
parent::__construct();
}
final public function getClassName(): string
{
return "Server";
}
final public function getClassPath(): string
{
return $this->getClassName();
}
public function getModelClass(): string
{
return Model::class;
}
public function getEntityClass(): string
{
return Entity::class;
}
public function getCountByMode(string $mode, string $cpu, ?string $spec = null): int
{
switch ($mode) {
case 'all':
$this->getModel()->like(["server_cpuname" => "%$cpu%", "server_spec" => "%$spec%"]);
break;
case 'use':
$this->getModel()->where("server_use_status", "n");
$this->getModel()->like(["server_cpuname" => "%$cpu%", "server_spec" => "%$spec%"]);
break;
case 'empty':
$this->getModel()->where("server_use_status", "y");
$this->getModel()->like(["server_cpuname" => "%$cpu%", "server_spec" => "%$spec%"]);
break;
case 'format':
$this->getModel()->where("server_use_status", "y");
$this->getModel()->where("server_fomat_date !='NULL'");
$this->getModel()->like(["server_cpuname" => "%$cpu%"]);
break;
default:
throw new \InvalidArgumentException("Invalid mode: $mode");
}
return $this->getCount();
}
}

View File

@ -0,0 +1,104 @@
<?php
namespace lib\Services;
use lib\Entities\ClientEntity;
use lib\Entities\ServiceEntity as Entity;
use lib\Entities\ServiceEntity;
use lib\Models\AddDbModel;
use lib\Models\ClientModel;
use lib\Models\ServiceModel as Model;
class ServiceService extends CommonService
{
public function __construct()
{
parent::__construct();
}
final public function getClassName(): string
{
return "Service";
}
final public function getClassPath(): string
{
return $this->getClassName();
}
public function getModelClass(): string
{
return Model::class;
}
public function getEntityClass(): string
{
return Entity::class;
}
//미지급금 리스트
public function getEntitiesForNonPayment(int $curPage, int $perPage, array $exclude_clients): array
{
$table = $this->getModel()->getTable();
$clientTable = ClientModel::TABLE;
$addDbTable = AddDbModel::TABLE;
$this->getModel()->select("{$clientTable}.Client_Name,{$table}.service_code,service_line,server_code,service_ip,service_payment_date,service_amount,service_nonpayment,service_note,addDB_case,addDB_nonpayment,addDB_payment,addDB_accountStatus,addDB_ip,addDB_payment_date");
$this->getModel()->join($clientTable, "{$table}.client_code = {$clientTable}.Client_Code");
$this->getModel()->join($addDbTable, "{$table}.service_code = {$addDbTable}.service_code");
$this->getModel()->whereNotIn("{$addDbTable}.client_code", $exclude_clients);
$this->getModel()->whereNotIn("{$addDbTable}.addDB_accountStatus", ["complete"]);
$this->getModel()->orderBy("service_payment_date", "DESC");
//Query문 Rest여부 -> 같은조건에 Count 받고, 결과값을 받고 싶을때는 continue()
$this->getModel()->setContinue(true);
$total = $this->getCount();
//limit, offset 설정
$this->getModel()->limit($perPage);
$this->getModel()->offset(($curPage - 1) * $perPage);
return [$total, $this->getEntities()];
}
//지역(치바,도쿄등)에 따른 DASHBOARD용 서비스 카운트
private function getDistrictCountForDashboard(string $where, string $type, array $switchcodes): int
{
$switchcode_begin = $switchcodes['begin'];
$switchcode_end = $switchcodes['end'];
$this->getModel()->where($where);
$this->getModel()->where(["service_line" => $type, "service_status" => 'o']);
$this->getModel()->where("service_sw BETWEEN '{$switchcode_begin}' AND '$switchcode_end'");
$count = $this->getModel()->count();
// echo "<BR>" . $this->getModel()->getLastQuery();
return $count;
}
final public function getTotalCountForDashboard(array $siteinfo): array
{
$temps = array();
foreach ($siteinfo['totalcount_customers'] as $customer => $where) {
$temps[$customer] = [];
foreach ($siteinfo['totalcount_types'] as $type) {
foreach (DBMS_SERVICE_SWITCHCODE as $district => $switchcodes) {
$temps[$customer][$type][$district] = $this->getDistrictCountForDashboard($where, $type, $switchcodes);
}
} //foreach
// echo var_dump($temps);
} //foreach
return $temps;
}
//도메인쿠폰 사용용
public function useCouponByService(ServiceEntity $service, int $coupon): bool
{
if ($coupon < 0) {
throw new \Exception("쿠폰수량이 잘못되었습니다. 쿠폰수량 : $coupon");
}
$this->getModel()->where("service_code", $service->getServiceCode());
$this->getModel()->update(["coupon=(coupon-{$coupon})" => null, "coupon_use=(coupon_use+{$coupon})" => null]);
return true;
}
//도메인쿠폰 Reset
public function resetCouponByClient(ClientEntity $client, int $coupon): bool
{
if ($coupon < 0) {
throw new \Exception("쿠폰수량이 잘못되었습니다. 쿠폰수량 : $coupon");
}
$this->getModel()->where("client_code", $client->getClientCode());
$this->getModel()->where("server_code", $client->getTitle() . "_일회성");
$this->getModel()->update(["coupon" => $coupon, "coupon_use" => 0]);
return true;
} //setCoupon
}

View File

@ -0,0 +1,30 @@
<?php
namespace lib\Services;
use lib\Entities\VPCEntity as Entity;
use lib\Models\VPCModel as Model;
class VPCService extends CommonService
{
public function __construct()
{
parent::__construct();
}
final public function getClassName(): string
{
return "VPC";
}
final public function getClassPath(): string
{
return $this->getClassName();
}
public function getModelClass(): string
{
return Model::class;
}
public function getEntityClass(): string
{
return Entity::class;
}
}

View File

@ -0,0 +1,13 @@
<?php
namespace lib\Utils;
use lib\Core\Utils\Pagination as Core;
class Pagination extends Core
{
public function __construct(int $totalItems, int $currentPage = 1, int $perPage = 10)
{
parent::__construct($totalItems, $currentPage, $perPage);
}
}

View File

@ -0,0 +1,53 @@
@if ($client)
<h3>고객명 : <a href="/serviceDetail.sev?client_code={{$client->getClientCode()}}">{{$client->getTitle()}}</a> / 쿠폰발급대상 : {{count($entities)}} / 전체 남은 수량 : {{$total_coupon}} </h3>
@endif
<div class="table-responsive" id="table">
<input type="hidden" id="token">
<table class="table table-bordered table-hover table-striped" style="text-align:center;">
<thead>
<tr>
<th style="text-align:center;">No</th>
<th style="text-align:center;">서비스코드</th>
<th style="text-align:center;">장비명</th>
<th style="text-align:center;">서버IP</th>
<th style="text-align:center;">서비스개시일</th>
<th style="text-align:center;">회선종류</th>
<th style="text-align:center;">쿠폰 누적수</th>
<th style="text-align:center;">쿠폰 잔량수</th>
<th style="text-align:center;">쿠폰 사용수</th>
<th style="text-align:center;">작업업</th>
</tr>
</thead>
<tbody>
@php $i=0 @endphp
@foreach($entities as $entity)
<form method="post" action="{{DBMS_SITE_HOST}}/dbms/client/coupon/insert">
<input type="hidden" name="service_code" value="{{$entity->getServiceCode()}}">
<input type="hidden" name="member_code" value="{{$member ? $member->getPK() : ""}}">
<tr>
<td>{{$total-(($curPage-1)*$perPage+$i)}}</td>
<td><a href="/serviceDetailSolo.sev?client_code={{$entity->getClientCode()}}&service_code={{$entity->getServiceCode()}}">{{$entity->getServiceCode()}}</td>
<td>{{$entity->getServerCode()}}</td>
<td>{{$entity->service_ip}}</td>
<td>{{$entity->service_open_date}}</td>
<td>{{$entity->service_line}}</td>
<td>{{$entity->getCoupon() + $entity->getUsedCoupon()}}</td>
<td><input type="text" name="coupon" value="{{$entity->getCoupon()}}" maxlength="3" size="3"></td>
<td><input type="text" name="coupon_use" value="{{$entity->getUsedCoupon()}}" maxlength="3" size="3"></td>
<td>
@if ($entity->getCoupon() > 0)
<a href="/IdcCouponBuyMK.cup?service_code={{$entity->getServiceCode()}}&mkid={{$member ? $member->getPK() : ""}}">쿠폰사용</a>
@else
<a href="/IdcCouponBuyMK.cup?service_code={{$entity->getServiceCode()}}&mkid={{$member ? $member->getPK() : ""}}">사용완료</a>
@endif
&nbsp;&nbsp;&nbsp;
<input type="submit" value="수정">
</td>
</tr>
</form>
@php $i++ @endphp
@endforeach
</tbody>
</table>
</div>
<div style="text-align:center">{!!$pagination->render(DBMS_SITE_URL . "/IdcCouponUseMK.cup", ['client_code' => $client ? $client->getClientCode() : "", 'mkid' => $member ? $member->getPK() : "", 'curPage' => $curPage, 'perPage' => $perPage])!!}</div>

View File

@ -0,0 +1,57 @@
<div class="table-responsive">
<form method="post" action="{{DBMS_SITE_HOST}}/dbms/client/coupon/insert">
<input type="hidden" name="service_code" value="{{$service->getServiceCode()}}">
<input type="hidden" name="mkid" value="{{$member ? $member->getPK() : ""}}">
<table class="table table-bordered table-hover table-striped">
<thead></thead>
<tbody>
<tr>
<td>고객명</td>
<td colspan="5">{{$client->getTitle()}}</td>
</tr>
<tr>
<td>서비스코드</td>
<td colspan="5">{{$service->getServiceCode()}}</td>
</tr>
<tr>
<td>장비번호</td>
<td colspan="5">{{$service->getServerCode()}}</td>
</tr>
<tr>
<td>도메인 구매 수량</td>
<td colspan="5">
<select name="coupon" id="coupon">
@for ($i = 1; $i < $service->getCoupon(); $i++)
<option value="{{$i}}">{{$i}}</option>
@endfor
</select> (개별 서버에 할당된 남은 쿠폰 수량 : {{$service->getCoupon()}})
</td>
</tr>
<tr>
<td>서비스 금액</td>
<td colspan="3">도메인 쿠폰 사용</td>
</tr>
<tr>
<td>도메인 신청일</td>
<td>{{$today}}</td>
<td>쿠폰 사용일</td>
<td colspan="3">{{$today}}</td>
</tr>
<tr>
<td>도메인 리스트</td>
<td colspan="5"><textarea cols="100" rows="4" type="text" name="note" id="note"></textarea>
<br>(공백을 허용하지 않습니다. 예제처럼 붙여쓰기 하세요 / 예제 : test.com/123.com/idcjp.jp)
</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="6">
<input class="btn btn-outline btn-primary" type="submit" value="저장하기">
<input class="btn btn-outline btn-default" type="button" value="취소" onclick="location.href='/IdcCouponUseMK.cup?client_code={{$service->getClientCode()}}'">
</td>
</tr>
</tfoot>
</table>
</form>
</div>

View File

@ -0,0 +1,56 @@
<div class="col-lg-2 col-md-2 col-xs-4" style="padding:3px">
<table class="table table-bordered table-condensed info_table">
<thead>
<tr>
<th>도쿄</th>
<th class=" ">치바</th>
<th class=" ">VPN</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{$dashboard['Tokyo']}}</td>
<td>{{$dashboard['Chiba']}}</td>
<td>{{$dashboard['vpn']}}</td>
</tr>
</tbody>
</table>
</div>
<div class="col-lg-2 col-md-4 col-xs-5" style="padding:3px">
<table class="table table-bordered table-condensed info_table">
<thead>
<tr>
<th>일반</th>
<th class=" ">방어</th>
<th class=" ">전용</th>
<th class=" ">이벤트</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{$dashboard['normal']}}</td>
<td class=" ">{{$dashboard['defence']}}</td>
<td class=" ">{{$dashboard['solo']}}</td>
<td class=" ">{{$dashboard['event']}}</td>
</tr>
</tbody>
</table>
</div>
<div class="col-lg-2 col-md-3 col-xs-3" style="padding:3px">
<table class="table table-bordered table-condensed info_table">
<thead>
<tr>
<th>테스트</th>
<th>대체</th>
<th>쿠폰</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{$dashboard['test']}}</td>
<td class=" ">{{$dashboard['substitution']}}</td>
<td><a href="/IdcCouponUseMK.cup?client_code={{$client->getClientCode()}}" style=" cursor: pointer;">{{$dashboard['coupon']}}</a></td>
</tr>
</tbody>
</table>
</div>

View File

@ -0,0 +1,79 @@
<div class="content-responsive">
<p> 청구서를 받으셨던 서버인 경우에도 발행하는 시점까지 미납인 경우 발행됩니다. 입금을 하신 경우에는 연락 부탁드립니다.</p>
<p>입금 하실 계좌 번호 입니다.</p>
@foreach($siteInfo['banks'] as $bank)
<div style="margin-top:20px; margin-bottom:20px; color:red;">
은행명 : {{$bank['name']}}<br>
계좌번호 : {{$bank['id']}}<br>
예금주: {{$bank['owner']}}
</div>
@endforeach
<p>고객명과 입금자명이 상이한 경우 반드시 확인 연락이 필요합니다.<br />
입금 청구서에 기재되어 있는 고객명으로 입금해주시면 별도의 입금 확인 전화가 필요없습니다.</p>
<div style="display:none;">
<p> 할인안내<br />
- 서버비 입금시 3개월 이상 선납하는 고객분들께 드리는 할인혜택 (중도 해약하시더라도 환불은 되지 않습니다.)<br />
3개월 - 10%, 6개월 - 15%, 12개월 -20% 비율로 결제금액을 할인 드리고 있습니다. <br />
- 장기사용하시는 고객분들께 드리는 할인혜택<br />
1 이상 10%, 2 이상 15% 3 이상 20%, 4 이상 25%, 최대 5 이상 30% 비율로 결제금액을 할인해 드리고 있습니다.<br />
, 중도 해지 신규 가입시 할인혜택은 없습니다.<br />
</div>
<br />
기타 서비스 요금 안내<br />
- 도메인 구매 대행 서비스 : 도메인 1개당 3만원 (1회성 비용으로 구매를 <font color="#FF0000">요청하신 달에만 요금이 청구</font> 됩니다)<br />
- IP 추가 : 일반회선 10만원 / 보안회선 10만원(추가 하신 날로 부터 사용을 중지 하시는 달까지 <font color="#FF0000">매월 요금이 청구</font> 됩니다.)<br />
- IP 변경<br />
- 단순 IP 변경의 경우(오래 사용하여 변경, 정기적인 변경, 관리자 변경 )에는 무료로 변경 드리고 있습니다. <br />
- IP에 문제(<font color="#FF0000">KCSC로 연결, 접근(원격접속) 차단, 공격을 받아 다른 IP로 변경 </font>) 있어 변경 하실 경우에는 <font color="#FF0000">요금이 청구</font> 됩니다.<br />
* 청구비용 10만원 (1회성 비용으로 구매를 <font color="#FF0000">요청하신 달에만 요금이 청구</font> 됩니다) <br />
- 서비스는 선입금으로 제공 드리고 있습니다.<br />
- VPN 결제일의 자정까지 결제처리가 안될시 자동차단처리가 되게됩니다.<br />
이점 양해 부탁드리겠습니다.<br />
<font color="#FF0000"> 이용 해지시에는 사용하셨던 IP에 연결 되어 있는 도메인들은 연결 해제를 주시기 바랍니다.</font>
</p>
보장 트래픽 : 기본 트래픽 사용량은 IN 10Mbps / OUT 10Mbps 입니다<br />
보장 트래픽 이상을 사용할 경우 트래픽 과금이 발생할 있습니다<br />
<p> 알림(필히 숙지 하여 주시기 바랍니다.) <br />
<br />
1. {{$siteInfo['name']}} 등록 하신 고객명 / 전화번호 / 메일 주소는 차후 고객님 확인을 위해 사용 되니 고객님께서도 필히 알고 계셔야 합니다. <br />
또한 전화번호와 메일주소 또는 메신져는 {{$siteInfo['name']}}에서 고객님에게 연락을 취해야 경우 사용됩니다.변동사항이 있을 경우에는 <br />
반드시 {{$siteInfo['name']}} 연락을 하여 변경해 주시기 바랍니다.
</p>
<p> 변동사항을 {{$siteInfo['name']}}에게 알려 주시지 않거나, {{$siteInfo['name']}} 등록된 연락처로 연락을 해도 연결이 안되어 발생하는 피해에 대해서는<br />
저희 {{$siteInfo['name']}}에서 책임을 지지 않습니다. </p>
<p>2. 결제는 납부기한내에 주셔야 합니다.<br />
혹시라도 납부기한내에 결제를 하지 못하실 경우는 미리 연락을 주시면 납부기한 최대 3일간은 서버 접속이 유지됩니다.<br />
하지만 납부기한까지 연락을 안주시거나 연락을 하셨더라도 납부기한을 3 초과하시면 서버 접속이 차단되고 차단후에도 <br />
3일동안 연락이 없을 경우 자동 해지 처리 되고 데이터는 삭제처리 되오니 주의 하시기 바랍니다. </p>
<p>3. 환불정책<br />
월단위 계약(계산)이므로 중도 <font color="#FF0000">환불(일할계산) 안됩니다.</font><br />
, 셋팅에 문제가 있거나 기타 문제가 있을 경우 서버를 인계 받으시고 <font color="#FF0000">3 안으로는 환불 요청을 하실 있습니다.</font>
</p>
<p>4. 서버 운영중 해킹으로 발생한 피해는 저희 {{$siteInfo['name']}}에서 책임을 지지 않습니다.<br />
서버운영에 있어서 보안에 각별히 주의 부탁드리겠습니다.<br />
&lt;해킹 대비 보안조치사항&gt; <br />
- 주기적인 window 보안 업데이트<br />
- linux ,mysql , php, jsp 보안권고<br />
- 서버 원격 접속 패스워드 mssql 패스워드 변경<br />
* 영문,숫자,특수문자 8자리 이상 조합하여 사용 권고<br />
* 매월 주기적으로 패스워드 변경<br />
* 패스워드 노출 즉각 변경<br />
- 서버내 방화벽에서 특정IP만 서버에 접속할 있도록 방화벽 설정<br />
- 원격접속 포트 기본포트에서 변경 설정 (기본 포트 window : 3389 / linux : 22 )<br />
<!--
- 폴더eye 설치<br />
* 센터 자체 개발프로그램 : foldereye.{{$siteInfo['name']}} 에서 다운로드<br />
* 서버내 파일 복사,삭제, 변경시 알람메일 발송<br />
* 알람 발생시 센터로 신속히 연락<br />
-->
<!-- - anti-virus 설치<br /> -->
* 무료 설치 : Microsoft Security Essential 설치<br />
<!-- * 유료 설치 : AVG Business Server Edition 설치<br /> -->
- 웹서비스 보안을 위한 웹방화벽 설치 대행서비스(유료)
</p>
<p> # 원격포트 변경 및 원격접속 제한 설정은 {{$siteInfo['name']}}홈페이지에 등록되어 있습니다.<br />
자세한 사항은 센터로 문의주시기 바랍니다.</p>
<p>5. 서버 운영중 장비부품 문제(:하드디스크의 고장 ) 발생한 피해는 저희 {{$siteInfo['name']}}에서 책임을 지지 않습니다.<br />
(요청하시면 백업을 위해 무료로 추가 하드를 제공해 드리고 있지만, 추가가 불가능한 경우도 있습니다.<br />
번거로우시더라도 주기적인 데이터백업을 부탁드리겠습니다.) </p>
</div>

View File

@ -0,0 +1,45 @@
<form method="get">
<input type="radio" name="mode" value="all" {{$mode == "all" || $mode == "" ? "checked" : ""}}>전체
<input type="radio" name="mode" value="today" {{$mode == "today" ? "checked" : ""}}>당일
<input type="radio" name="mode" value="1day" {{$mode == "1day" ? "checked" : ""}}>1일전
<input type="radio" name="mode" value="2day" {{$mode == "2day" ? "checked" : ""}}>2일전
<input type="radio" name="mode" value="3day" {{$mode == "3day" ? "checked" : ""}}>3일전
<input type="submit" value="확인">
</form>
{{$message}} 미납리스트 <a class="btn btn-outline btn-default" href="IdcDepositNonPaymentListExcel.dep">엑셀</a>
<div class="table-responsive" id="table">
<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:60px;">종류</th>
<th style="text-align:center;width:130px;">장비명</th>
<th style="text-align:center;width:120px;">IP</th>
<th style="text-align:center;width:100px;">결제일</th>
<th style="text-align:center;width:100px;">서비스 가격</th>
<th style="text-align:center;width:100px;">과금상태</th>
<th style="text-align:center;width:100px;">미납과금</th>
<th style="text-align:center;width:200px;">비고</th>
</tr>
</thead>
<tbody>
@foreach ($entities as $entity)
<tr>
<td style="text-align:center;"><a href="/IdcDepositNonPaymentList.dep?searchContent={{$entity->Client_Name}}">{{$entity->Client_Name}}</a></td>
<td style="text-align:center;">{{$entity->addDB_case}}</td>
<td style="text-align:center;">{{$entity->server_code}}</td>
<td style="text-align:center;">{{$entity->service_ip}}</td>
<!--<td>{{$entity->service_code}}</td>-->
<td style="text-align:center;">{{$entity->service_payment_date}}</td>
<td style="text-align:center;">{{$entity->service_amount}}</td>
<!--<td>{{$entity->addDB_payment}}</td>-->
<td style="text-align:center;">{{$entity->addDB_accountStatus}}</td>
<td style="text-align:center;">{{$entity->addDB_nonpayment}}</td>
<!--<td>{{$entity->addDB_accountStatus}}</td>-->
<td>{{$entity->service_note}}</td>
</td>
</tr>
@endforeach
</tbody>
</table>
<div style="text-align:center">{!!$pagination->render(DBMS_SITE_URL . "/IdcDepositNonPaymentListMK.dep", ['mode' => $mode, 'curPage' => $curPage, 'perPage' => $perPage])!!}</div>

View File

@ -0,0 +1,40 @@
@extends('layout')
@section('title', 'Point 관리리')
@section('content')
<div class="table-responsive" id="table">
<input type="hidden" id="token">
<table class="table table-bordered table-hover table-striped" style="text-align:center;">
<thead>
<tr>
<th style="text-align:center;">No</th>
<th style="text-align:center;">제목</th>
<th style="text-align:center;">고객명</th>
<th style="text-align:center;">현재금액</th>
<th style="text-align:center;">입금액</th>
<th style="text-align:center;">출금액</th>
<th style="text-align:center;">작업일</th>
<th style="text-align:center;">비고</th>
</tr>
</thead>
<tbody>
@php $i=0 @endphp
@foreach($entities as $entity)
<tr>
<td>{{$total-(($curPage-1)*$perPage+$i)}}</td>
<td>{{$entity->getTitle()}}</td>
<td>{{$clients[$entity->getClientCode()]->getTitle()}}</td>
<td>{{number_format($clients[$entity->getClientCode()]->getPoint())}}</td>
<td>{{number_format($entity->getType() == 'deposit' ? $entity->getAmount() : 0)}}</td>
<td>{{number_format($entity->getType() == 'withdrawal' ? $entity->getAmount() : 0)}}</td>
<td>{{date('Y-m-d',strtotime($entity->getCreatedAt()))}}</td>
<td>{{$entity->getNote()}}</td>
</tr>
@php $i++ @endphp
@endforeach
</tbody>
</table>
<div style="text-align:center;">{!!$pagination->render(DBMS_SITE_URL . "/IdcClientPointList.cli", ['client_code' => $client_code, 'curPage' => $curPage, 'perPage' => $perPage])!!}</div>
@php $insert_url = DBMS_SITE_URL . "/IdcClientPointInsert.cli?client_code=" . $client_code @endphp
<div style="text-align:center;"><button type="button" class="btn btn-primary" onclick="location.href='{{$insert_url}}'">포인트 추가</button></div>
</div>
@endsection

View File

@ -0,0 +1,45 @@
<div class="table-responsive">
<form method="post" action="<?= DBMS_SITE_HOST ?>/dbms/client/point/insert">
<table class="table table-bordered table-hover table-striped">
<thead></thead>
<tbody>
<tr>
<td>고객명</td>
<td>
<select name="client_code" id="client_code">
@foreach ($clients as $client)
<option value="{{$client->getClientCode()}}" {{$client_code == $client->getClientCode() ? "selected" : ""}}>{{$client->getTitle()}}</option>
@endforeach
</select>
</td>
</tr>
<tr>
<td>형식</td>
<td>
<input type="radio" name="type" id="type" value="deposit" checked><?= DBMS_CLIENT_POINT_TYPE['deposit'] ?>
<input type="radio" name="type" id="type" value="withdrawal"><?= DBMS_CLIENT_POINT_TYPE['withdrawal'] ?>
</td>
</tr>
<tr>
<td>금액</td>
<td colspan=" 5">
<input type="text" name="amount" id="amount" value="0" onkeyup="this.value=this.value.replace(/[^0-9]/g,'');">
<br> (포인트는 1 이상이어야 합니다.)
</td>
</tr>
<tr>
<td>비고</td>
<td><textarea cols="100" rows="4" type="text" name="note" id="note"></textarea></td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="6">
<input class="btn btn-outline btn-primary" type="submit" value="저장하기">
<input class="btn btn-outline btn-default" type="button" value="취소" onclick="history.back()">
</td>
</tr>
</tfoot>
</table>
</form>
</div>

View File

@ -0,0 +1,12 @@
@if ($client)
<form method="post">
<input type="hidden" name="client_code" value="{{$client->getClientCode()}}">
<table>
<tr>
<th width="18%">&nbsp;&nbsp;&nbsp;&nbsp;</th>
<td width="72%"><textarea rows="7" cols="120" name="msg">{{$client->getNote()}}</textarea></td>
<td width="10%"><input type="submit" value="저장" /></td>
</tr>
</table>
</form>
@endif

View File

@ -0,0 +1 @@
<a href="/IdcCouponUseMK.cup?client_code={{$service->getClientCode()}}" style="cursor: pointer;">{{$service->getCoupon()}}</a>

View File

@ -0,0 +1,2 @@
<a href="/vpcInfo.sev?client_code={{$client_code}}&csInfoFlag=true&service_code=@$service_code}}">{{$vpc}}</a>
<a href="/vpcInfo.sev?client_code={{$client_code}}&csInfoFlag=false&service_code=@$service_code}}">{{$kcs}}</a>

View File

@ -0,0 +1,23 @@
<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="{{$helper->getRandomString()}}"></div>
@foreach ($entities as $entity)
@php $service = $services[$entity->getServiceCode()] @endphp
<div>
<i class="fa fa-info-circle fa-fw"></i>
<a href="/serviceDetailSolo.sev?client_code={{$service->getClientCode()}}&service_code={{$entity->getServiceCode()}}" style="text-decoration: none;color:gray;font-size:10pt;line-height:1.6em;">
[{{$clients[$service->getClientCode()]->getTitle()}}]{{$entity->getServiceCode()}}/{{$entity->behavior}}
</a>
<span class="pull-right text-muted small"><em>{{$entity->note}}</em></span>
</div>
@endforeach

View File

@ -0,0 +1,36 @@
<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>
@foreach($entities as $entity)
<tr>
<td style="text-align:center;">
<a href="/serviceDetailSolo.sev?client_code={{$entity->getClientCode()}}&service_code={{$entity->getServiceCode()}}">{{$entity->getServiceCode()}}</a>
</td>
<td style="text-align:center;">{{$clients[$entity->getServiceCode()]->getTitle()}}</td>
<td style="text-align:center;">{{$entity->service_line}}</td>
<td style="text-align:center;">{{$entity->getServiceCode()}}</td>
<td style="text-align:center;">{{$entity->service_sw}}</td>
<td style="text-align:center;">{{$entity->service_ip}}</td>
<td style="text-align:center;">
<a href="/vpcInfo.sev?client_code={{$entity->getClientCode()}}&csInfoFlag=true&service_code={{$entity->getServiceCode()}}">{{$vpcs[$entity->getServiceCode()]}}</a>
/
<a href="/vpcInfo.sev?client_code={{$entity->getClientCode()}}&csInfoFlag=true&service_code={{$entity->getServiceCode()}}">{{$kcss[$entity->getServiceCode()]}}</a>
</td>
<td style="text-align:center;">{{!$members[$entity->getMemberCode()] ? "" : $members[$entity->getMemberCode()]->getTitle()}}</td>
<td>{{$helper->truncateString($entity->service_note, 20)}}</td>
</tr>
@endforeach
</tbody>
</table>

View File

@ -0,0 +1,92 @@
<div id='topboard'>
<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">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>
<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">{{$newServices}}</div>
<div>최근 {{$day}}일간 신규서비스스 대수</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>
<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">{{$unPayments}}</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>

Some files were not shown because too many files have changed in this diff Show More