dbms_primeidc_init...1

This commit is contained in:
최준흠 2025-04-18 17:09:31 +09:00
parent 325dab6b32
commit 539d5135c1
30 changed files with 302 additions and 418 deletions

View File

@ -67,7 +67,7 @@ define('DBMS_SERVICE_SWITCHCODE', [
'Chiba' => ['begin' => 'C00%', 'end' => 'C64%'], 'Chiba' => ['begin' => 'C00%', 'end' => 'C64%'],
'Tokyo' => ['begin' => 'C80%', 'end' => 'C99%'] 'Tokyo' => ['begin' => 'C80%', 'end' => 'C99%']
]); ]);
define('DBMS_SERVICE_LINE', [ define('DBMS_SERVICE_LINE_ALL', [
'normal' => '일반', 'normal' => '일반',
'defence' => '방어', 'defence' => '방어',
'solo' => '전용', 'solo' => '전용',

View File

@ -110,18 +110,18 @@ $router->group('dbms/dashboard', function (Router $router) {
$router->group('dbms/navigator', function (Router $router) { $router->group('dbms/navigator', function (Router $router) {
// 동적 파라미터 없이 기본 path에 추가 파라미터를 받아 key/value 형식으로 처리 // 동적 파라미터 없이 기본 path에 추가 파라미터를 받아 key/value 형식으로 처리
$router->add('GET', 'ipsearch', function ($params) { $router->add('GET', 'index', function ($params) {
$controller = new NavigatorCOntroller($params); $controller = new NavigatorCOntroller($params);
return $controller->ipsearch(); return $controller->index();
// Response::view($result); // Response::view($result);
}); });
}); });
$router->group('dbms/defence', function (Router $router) { $router->group('dbms/defence', function (Router $router) {
// 동적 파라미터 없이 기본 path에 추가 파라미터를 받아 key/value 형식으로 처리 // 동적 파라미터 없이 기본 path에 추가 파라미터를 받아 key/value 형식으로 처리
$router->add('GET', 'mk', function ($params) { $router->add('GET', 'index', function ($params) {
$controller = new DefenceCOntroller($params); $controller = new DefenceCOntroller($params);
return $controller->mk(); return $controller->index();
// Response::view($result); // Response::view($result);
}); });
}); });

View File

@ -28,13 +28,13 @@ class ClientController extends DBMSController
//WEB 접속방법 : http://localhost/site/client/totalcount/client_code/코드번호 //WEB 접속방법 : http://localhost/site/client/totalcount/client_code/코드번호
public function totalcount() public function totalcount()
{ {
//사용자정보
//사용자정보 //사용자정보
$client_code = $this->request->get('client_code'); $client_code = $this->request->get('client_code');
// echo "client_code:" . $client_code;
if ($client_code) { if ($client_code) {
$client = $this->getClientService()->getEntityByCode($client_code); $client = $this->getClientService()->getEntity();
if (!$client) { if (!$client) {
throw new \Exception("[$client_code]에 해당하는 사용자정보가 존재하지 않습니다."); throw new \Exception("[$client_code]에 해당하는 고객정보가 존재하지 않습니다.");
} }
$this->client = $client; $this->client = $client;
} }
@ -43,18 +43,22 @@ class ClientController extends DBMSController
foreach (DBMS_SERVICE_SWITCHCODE as $district => $switchcodes) { foreach (DBMS_SERVICE_SWITCHCODE as $district => $switchcodes) {
$switchcode_begin = $switchcodes['begin']; $switchcode_begin = $switchcodes['begin'];
$switchcode_end = $switchcodes['end']; $switchcode_end = $switchcodes['end'];
$dashboard[$district] = $this->getServiceService()->getDistrictCountByClient( $this->getServiceService()->getModel()->where("client_code", "{$client_code}");
$client_code, $this->getServiceService()->getModel()->where("service_sw BETWEEN '{$switchcode_begin}' AND '{$switchcode_end}'");
$switchcode_begin, $this->getServiceService()->getModel()->where("service_status", "o");
$switchcode_end $this->getServiceService()->getModel()->whereNotIn("service_line", ['solo', 'test', 'event', 'substitution']);
); $dashboard[$district] = $this->getServiceService()->getCount();
} //foreach } //foreach
//서비스라인별(일반,방어,전용,테스트,대체등) //서비스라인별(일반,방어,전용,테스트,대체,vpn,event등)
foreach (DBMS_SERVICE_LINE as $service_line => $label) { foreach (DBMS_SERVICE_LINE_ALL as $service_line => $label) {
$dashboard[$service_line] = $this->getServiceService()->getServiceLineCountByClient($client_code, $service_line); $this->getServiceService()->getModel()->where('client_code', $client_code);
$this->getServiceService()->getModel()->where('service_line', $service_line);
$dashboard[$service_line] = $this->getServiceService()->getCount("SUM(coupon) as cnt");
} //foreach } //foreach
//서비스상태별(정상,정지,해지등) //서비스상태별(일반,방어만)
$dashboard['coupon'] = intval($this->getServiceService()->getCouponTotalCountByClient($client_code)); $this->getServiceService()->getModel()->where("client_code", $client_code);
$this->getServiceService()->getModel()->whereNotIn("service_line", ['solo', 'test', 'event', 'substitution']);
$dashboard['coupon'] = $this->getServiceService()->getCount("SUM(coupon) as cnt");
$this->dashboard = $dashboard; $this->dashboard = $dashboard;
$this->client_code = $client_code; $this->client_code = $client_code;
return $this->render(__FUNCTION__); return $this->render(__FUNCTION__);

View File

@ -46,11 +46,10 @@ class CouponController extends ClientController
{ {
//사용자정보 //사용자정보
$client_code = $this->request->get('client_code'); $client_code = $this->request->get('client_code');
echo "client_code:" . is_null($client_code) ? "NULL" : $client_code;
if ($client_code) { if ($client_code) {
$client = $this->getClientService()->getEntityByCode($client_code); $client = $this->getClientService()->getEntity();
if (!$client) { if (!$client) {
throw new \Exception("[$client_code]에 해당하는 사용자정보가 존재하지 않습니다."); throw new \Exception("[$client_code]에 해당하는 고객정보가 존재하지 않습니다.");
} }
$this->client = $client; $this->client = $client;
} }
@ -58,16 +57,17 @@ class CouponController extends ClientController
$member_code = $this->request->get('mkid'); $member_code = $this->request->get('mkid');
// echo "member_code:" . $member_code; // echo "member_code:" . $member_code;
if ($member_code) { if ($member_code) {
$member = $this->getMemberService()->getEntityByCode($member_code); $member = $this->getMemberService()->getEntity();
if (!$member) { if (!$member) {
throw new \Exception("[$member_code]에 해당하는 관리자정보가 존재하지 않습니다."); throw new \Exception("[$member_code]에 해당하는 관리자정보가 존재하지 않습니다.");
} }
$this->member = $member; $this->member = $member;
} }
//쿠폰내역 //사용자별 쿠폰내역
$this->getServiceService()->getModel()->where('client_code', $client_code);
$this->curPage = intval($this->request->get('curPage', 1)); $this->curPage = intval($this->request->get('curPage', 1));
$this->perPage = intval($this->request->get('perPage', VIEW_LIST_PERPAGE)); $this->perPage = intval($this->request->get('perPage', VIEW_LIST_PERPAGE));
[$this->total, $this->services] = $this->getServiceService()->getEntitiesByClient($this->curPage, $this->perPage, $client_code); [$this->total, $this->entities] = $this->getServiceService()->getList($this->curPage, $this->perPage);
$this->pagination = new Pagination($this->total, (int)$this->curPage, (int)$this->perPage); $this->pagination = new Pagination($this->total, (int)$this->curPage, (int)$this->perPage);
$total_coupon = 0; $total_coupon = 0;
foreach ($this->services as $service) { foreach ($this->services as $service) {
@ -86,27 +86,29 @@ class CouponController extends ClientController
if (!$service_code) { if (!$service_code) {
throw new \Exception("service_code 값이 정의되지 않았습니다."); throw new \Exception("service_code 값이 정의되지 않았습니다.");
} }
$service = $this->getServiceService()->getEntityByCode($service_code); $this->getServiceService()->getModel()->where('service_code', $service_code);
$service = $this->getServiceService()->getEntity();
if (!$service) { if (!$service) {
throw new \Exception("[$service_code]에 해당하는 서비스정보가 존재하지 않습니다."); throw new \Exception("[$service_code]에 해당하는 서비스정보가 존재하지 않습니다.");
} }
$this->service = $service;
//사용자정보 //사용자정보
$client = $this->getClientService()->getEntityByCode($service->getClientCode()); $this->getClientService()->getModel()->where('Client_Code', $service->getClientCode());
$client = $this->getClientService()->getEntity();
if (!$client) { if (!$client) {
throw new \Exception("[{$service->getClientCode()}]에 해당하는 사용자정보가 존재하지 않습니다."); throw new \Exception("[{$service->getClientCode()}]에 해당하는 고객정보가 존재하지 않습니다.");
} }
$this->client = $client;
//관리자정보(등록자) //관리자정보(등록자)
$member_code = $this->request->get('mkid'); $member_code = $this->request->get('mkid');
// echo "member_code:" . $member_code; if (!$member_code) {
if ($member_code) { throw new \Exception("mkid 값이 정의되지 않았습니다.");
$member = $this->getMemberService()->getEntityByCode($member_code);
if (!$member) {
throw new \Exception("[$member_code]에 해당하는 관리자정보가 존재하지 않습니다.");
}
$this->member = $member;
} }
$this->getMemberService()->getModel()->where('member_code', $member_code);
$member = $this->getMemberService()->getEntity();
if (!$member) {
throw new \Exception("[$member_code]에 해당하는 관리자정보가 존재하지 않습니다.");
}
$this->service = $service;
$this->client = $client;
$this->member = $member; $this->member = $member;
$this->today = date("Y-m-d"); $this->today = date("Y-m-d");
return $this->render(__FUNCTION__); return $this->render(__FUNCTION__);
@ -121,21 +123,24 @@ class CouponController extends ClientController
if (!$service_code) { if (!$service_code) {
throw new \Exception("service_code 값이 정의되지 않았습니다."); throw new \Exception("service_code 값이 정의되지 않았습니다.");
} }
$service = $this->getServiceService()->getEntityByCode($service_code); $this->getServiceService()->getModel()->where('service_code', $service_code);
$service = $this->getServiceService()->getEntity();
if (!$service) { if (!$service) {
throw new \Exception("[$service_code]에 해당하는 서비스정보가 존재하지 않습니다."); throw new \Exception("[$service_code]에 해당하는 서비스정보가 존재하지 않습니다.");
} }
//사용자정보 //사용자정보
$client = $this->getClientService()->getEntityByCode($service->getClientCode()); $this->getClientService()->getModel()->where('Client_Code', $service->getClientCode());
$client = $this->getClientService()->getEntity();
if (!$client) { if (!$client) {
throw new \Exception("[{$service->getClientCode()}]에 해당하는 사용자정보가 존재하지 않습니다."); throw new \Exception("[{$service->getClientCode()}]에 해당하는 고객정보가 존재하지 않습니다.");
} }
//관리자정보(등록자) //관리자정보(등록자)
$member_code = $this->request->get('mkid'); $member_code = $this->request->get('mkid');
if (!$member_code) { if (!$member_code) {
throw new \Exception("mkid 값이 정의되지 않았습니다."); throw new \Exception("mkid 값이 정의되지 않았습니다.");
} }
$member = $this->getMemberService()->getEntityByCode($member_code); $this->getMemberService()->getModel()->where('member_code', $member_code);
$member = $this->getMemberService()->getEntity();
if (!$member) { if (!$member) {
throw new \Exception("[$member_code]에 해당하는 관리자정보가 존재하지 않습니다."); throw new \Exception("[$member_code]에 해당하는 관리자정보가 존재하지 않습니다.");
} }
@ -156,11 +161,11 @@ class CouponController extends ClientController
try { try {
$this->getServiceService()->beginTransaction(); $this->getServiceService()->beginTransaction();
//서비스쿠폰 갯수 수정 //서비스쿠폰 갯수 수정
$this->getServiceService()->useCouponForDomain($service, $coupon); $this->getServiceService()->useCouponByService($service, $coupon);
//쿠폰 사용내역 onetime에 등록 //쿠폰 사용내역 onetime에 등록
$this->getOnetimeService()->useCouponForDomain($service, $client, $member, $onetime_case, $coupon, $note, $onetime_request_date); $this->getOnetimeService()->useCouponByService($service, $client, $member, $onetime_case, $coupon, $note, $onetime_request_date);
//쿠폰 사용내역 history에 등록 //쿠폰 사용내역 history에 등록
$this->getHistoryService()->useCouponForDomain($service, $client, $onetime_case, $coupon, $note, $onetime_request_date);; $this->getHistoryService()->useCouponByService($service, $client, $onetime_case, $coupon, $note, $onetime_request_date);;
$this->getServiceService()->commit(); $this->getServiceService()->commit();
return $this->redirect->to(DBMS_SITE_URL . "/IdcCouponUseMK.cup?client_code=" . $service->getClientCode()); return $this->redirect->to(DBMS_SITE_URL . "/IdcCouponUseMK.cup?client_code=" . $service->getClientCode());
} catch (\Exception $e) { } catch (\Exception $e) {

View File

@ -17,27 +17,28 @@ class MemoController extends ClientController
//WEB 접속방법 : http://localhost/site/client/memo/update_form/client_code/코드번호 //WEB 접속방법 : http://localhost/site/client/memo/update_form/client_code/코드번호
public function update_form() public function update_form()
{ {
//사용자정보
$client_code = $this->request->get('client_code'); $client_code = $this->request->get('client_code');
if (!$client_code) { if ($client_code) {
throw new \Exception("client_code 값이 정의되지 않았습니다."); $client = $this->getClientService()->getEntity();
if (!$client) {
throw new \Exception("[$client_code]에 해당하는 고객정보보가 존재하지 않습니다.");
}
$this->client = $client;
} }
$entity = $this->getClientService()->getEntityByCode($client_code);
if (!$entity) {
throw new \Exception("[$client_code]에 해당하는 사용자정보가 존재하지 않습니다.");
}
$this->entity = $entity;
return $this->render(__FUNCTION__); return $this->render(__FUNCTION__);
} }
public function update() public function update()
{ {
//사용자정보
$client_code = $this->request->get('client_code'); $client_code = $this->request->get('client_code');
if (!$client_code) { if ($client_code) {
throw new \Exception("client_code 값이 정의되지 않았습니다."); $client = $this->getClientService()->getEntity();
} if (!$client) {
$entity = $this->getClientService()->getEntityByCode($client_code); throw new \Exception("[$client_code]에 해당하는 고객정보보가 존재하지 않습니다.");
if (!$entity) { }
throw new \Exception("[$client_code]에 해당하는 사용자정보가 존재하지 않습니다."); $this->client = $client;
} }
return $this->render(__FUNCTION__); return $this->render(__FUNCTION__);
} }

View File

@ -28,14 +28,13 @@ class PaymentController extends ClientController
} }
//사용자정보가져오기 //사용자정보가져오기
$client_code = $this->request->get('client_code'); $client_code = $this->request->get('client_code');
if (!$client_code) { if ($client_code) {
throw new \Exception("client_code 값이 정의되지 않았습니다."); $client = $this->getClientService()->getEntity();
if (!$client) {
throw new \Exception("[$client_code]에 해당하는 고객정보가 존재하지 않습니다.");
}
$this->client = $client;
} }
$client = $this->getClientService()->getEntityByCode($client_code);
if (!$client) {
throw new \Exception("[{$client_code}]에 해당하는 사이트정보가 없습니다.");
}
$this->client = $client;
return $this->render(__FUNCTION__); return $this->render(__FUNCTION__);
} }
//미납리스트트, NonPaymentList.php //미납리스트트, NonPaymentList.php
@ -51,18 +50,22 @@ class PaymentController extends ClientController
switch ($mode) { switch ($mode) {
case 'today': case 'today':
$this->message = "[{$today} 기준 당일 "; $this->message = "[{$today} 기준 당일 ";
$this->getServiceService()->getModel()->where("service_payment_date = CURDATE()");
break; break;
case '1day': case '1day':
$nonpaymentDay = 1; $nonpaymentDay = 1;
$this->message = "[{$today}] 기준 {$nonpaymentDay}일전"; $this->message = "[{$today}] 기준 {$nonpaymentDay}일전";
$this->getServiceService()->getModel()->where("service_payment_date = Date_Add(CURDATE(),INTERVAL {$nonpaymentDay} DAY)");
break; break;
case '2day': case '2day':
$nonpaymentDay = 2; $nonpaymentDay = 2;
$this->message = "[{$today}] 기준 {$nonpaymentDay}일전"; $this->message = "[{$today}] 기준 {$nonpaymentDay}일전";
$this->getServiceService()->getModel()->where("service_payment_date = Date_Add(CURDATE(),INTERVAL {$nonpaymentDay} DAY)");
break; break;
case '3day': case '3day':
$nonpaymentDay = 3; $nonpaymentDay = 3;
$this->message = "[{$today}] 기준 {$nonpaymentDay}일전"; $this->message = "[{$today}] 기준 {$nonpaymentDay}일전";
$this->getServiceService()->getModel()->where("service_payment_date = Date_Add(CURDATE(),INTERVAL {$nonpaymentDay} DAY)");
break; break;
case 'all': case 'all':
default: default:
@ -72,7 +75,7 @@ class PaymentController extends ClientController
$this->mode = $mode; $this->mode = $mode;
$this->curPage = intval($this->request->get('curPage', 1)); $this->curPage = intval($this->request->get('curPage', 1));
$this->perPage = intval($this->request->get('perPage', VIEW_LIST_PERPAGE)); $this->perPage = intval($this->request->get('perPage', VIEW_LIST_PERPAGE));
[$this->total, $this->entities] = $this->getServiceService()->getEntitiesForNonPayment($this->curPage, $this->perPage, $mode, $exclude_clients); [$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); $this->pagination = new Pagination($this->total, (int)$this->curPage, (int)$this->perPage);
return $this->render(path: __FUNCTION__); return $this->render(path: __FUNCTION__);
} }

View File

@ -2,21 +2,26 @@
namespace lib\Controllers\DBMS\Client; namespace lib\Controllers\DBMS\Client;
use lib\Services\HistoryService;
use lib\Services\MemberService; use lib\Services\MemberService;
use lib\Services\OnetimeService; use lib\Services\PointService;
use lib\Utils\Pagination; use lib\Utils\Pagination;
class PointController extends ClientController class PointController extends ClientController
{ {
private ?OnetimeService $_onetimeService = null; private ?PointService $_pointService = null;
private ?HistoryService $_historyService = null;
private ?MemberService $_memberService = null; private ?MemberService $_memberService = null;
public function __construct(array $params = []) public function __construct(array $params = [])
{ {
parent::__construct($params); parent::__construct($params);
$this->getView()->setPath('point'); $this->getView()->setPath('point');
} // } //
public function getPointService(): PointService
{
if ($this->_pointService === null) {
$this->_pointService = new PointService();
}
return $this->_pointService;
}
public function getMemberService(): MemberService public function getMemberService(): MemberService
{ {
if ($this->_memberService === null) { if ($this->_memberService === null) {
@ -24,81 +29,55 @@ class PointController extends ClientController
} }
return $this->_memberService; return $this->_memberService;
} }
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 -> IdcPointListMK.jsp 신규추가가 //IdcPointListMK.jsp -> domain_coupon.php
//CLI 접속방법 : php index.php site/client/point/index //CLI 접속방법 : php index.php site/client/counpon/index
//WEB 접속방법 : http://localhost/site/client/point/index //WEB 접속방법 : http://localhost/site/client/coupon/index
public function index() public function index()
{ {
//사용자정보
$client_code = $this->request->get('client_code');
echo "client_code:" . is_null($client_code) ? "NULL" : $client_code;
if ($client_code) {
$client = $this->getClientService()->getEntityByCode($client_code);
if (!$client) {
throw new \Exception("[$client_code]에 해당하는 사용자정보가 존재하지 않습니다.");
}
$this->client = $client;
}
//관리자정보(등록자)
$member_code = $this->request->get('mkid');
// echo "member_code:" . $member_code;
if ($member_code) {
$member = $this->getMemberService()->getEntityByCode($member_code);
if (!$member) {
throw new \Exception("[$member_code]에 해당하는 관리자정보가 존재하지 않습니다.");
}
$this->member = $member;
}
//쿠폰내역 //쿠폰내역
$this->curPage = intval($params['curPage'] ?? $this->request->get('curPage') ?? 1); $this->curPage = intval($this->request->get('curPage', 1));
$this->perPage = intval($params['perPage'] ?? $this->request->get('perPage') ?? VIEW_LIST_PERPAGE); $this->perPage = intval($this->request->get('perPage', VIEW_LIST_PERPAGE));
[$this->total, $this->services] = $this->getServiceService()->getEntitiesForCoupon($this->curPage, $this->perPage); [$this->total, $this->services] = $this->getPointService()->getEntitiesByClient($this->curPage, $this->perPage, $client_code);
$this->pagination = new Pagination($this->total, (int)$this->curPage, (int)$this->perPage); $this->pagination = new Pagination($this->total, (int)$this->curPage, (int)$this->perPage);
$total_coupon = 0; $total_coupon = 0;
foreach ($this->services as $service) { foreach ($this->services as $service) {
$total_coupon += $service->getCoupon(); $total_coupon += $service->getPoint();
} }
$this->total_coupon = $total_coupon; $this->total_coupon = $total_coupon;
return $this->render(__FUNCTION__); return $this->render(__FUNCTION__);
} }
//IdcCouponUseMK.jsp -> domain_coupon_use.php //IdcPointBuyMK.jsp -> domain_coupon_buy.php
//CLI 접속방법 : php index.php site/client/counpon/client/client_code/코드
//WEB 접속방법 : http://localhost/site/client/coupon/client/client_code/코드
public function client()
{
//사용자정보
$client_code = $this->request->get('client_code');
if (!$client_code) {
throw new \Exception("client_code 값이 정의되지 않았습니다.");
}
$client = $this->getClientService()->getEntityByCode($client_code);
if (!$client) {
throw new \Exception("[$client_code]에 해당하는 사용자정보가 존재하지 않습니다.");
}
$this->client = $client;
//전체 관리자정보(등록자)
$member_code = $this->request->get('mkid');
if (!$member_code) {
throw new \Exception("member_code 값이 정의되지 않았습니다.");
}
$member = $this->getMemberService()->getEntityByCode($member_code);
if (!$member) {
throw new \Exception("[$member_code]에 해당하는 관리자정보가 존재하지 않습니다.");
}
$this->member = $member;
//쿠폰내역
$this->curPage = intval($this->request->get('curPage', 1));
$this->perPage = intval($this->request->get('perPage', VIEW_LIST_PERPAGE));
[$this->total, $this->services] = $this->getServiceService()->getEntitiesForCoupon($this->curPage, $this->perPage, $client_code);
$this->pagination = new Pagination($this->total, (int)$this->curPage, (int)$this->perPage);
return $this->render(__FUNCTION__);
}
//IdcCouponBuyMK.jsp -> domain_coupon_buy.php
//CLI 접속방법 : php index.php site/client/counpon/insert_form //CLI 접속방법 : php index.php site/client/counpon/insert_form
//WEB 접속방법 : http://localhost/site/client/coupon/insert_form //WEB 접속방법 : http://localhost/site/client/coupon/insert_form
public function insert_form() public function insert_form()
{ {
$service_code = $this->request->get('service_code'); $service_code = $this->request->get('service_code');
if (!$service_code) { if (!$service_code) {
throw new \Exception("client_code 값이 정의되지 않았습니다."); throw new \Exception("service_code 값이 정의되지 않았습니다.");
} }
$service = $this->getServiceService()->getEntityByCode($service_code); $service = $this->getPointService()->getEntityByCode($service_code);
if (!$service) { if (!$service) {
throw new \Exception("[$service_code]에 해당하는 서비스정보가 존재하지 않습니다."); throw new \Exception("[$service_code]에 해당하는 서비스정보가 존재하지 않습니다.");
} }
@ -109,21 +88,22 @@ class PointController extends ClientController
throw new \Exception("[{$service->getClientCode()}]에 해당하는 사용자정보가 존재하지 않습니다."); throw new \Exception("[{$service->getClientCode()}]에 해당하는 사용자정보가 존재하지 않습니다.");
} }
$this->client = $client; $this->client = $client;
//전체 관리자정보(등록자) //관리자정보(등록자)
$member_code = $this->request->get('mkid'); $member_code = $this->request->get('mkid');
if (!$member_code) { // echo "member_code:" . $member_code;
throw new \Exception("member_code 값이 정의되지 않았습니다."); if ($member_code) {
} $member = $this->getMemberService()->getEntityByCode($member_code);
$member = $this->getMemberService()->getEntityByCode($member_code); if (!$member) {
if (!$member) { throw new \Exception("[$member_code]에 해당하는 관리자정보가 존재하지 않습니다.");
throw new \Exception("[$member_code]에 해당하는 관리자정보가 존재하지 않습니다."); }
$this->member = $member;
} }
$this->member = $member; $this->member = $member;
$this->today = date("Y-m-d"); $this->today = date("Y-m-d");
return $this->render(__FUNCTION__); return $this->render(__FUNCTION__);
} }
//IdcCouponBuyMK.jsp -> domain_coupon_buy.php //IdcPointBuyMK.jsp -> domain_coupon_buy.php
//CLI 접속방법 : php index.php site/client/counpon/insert_form //CLI 접속방법 : php index.php site/client/counpon/insert_form
//WEB 접속방법 : http://localhost/site/client/coupon/insert_form //WEB 접속방법 : http://localhost/site/client/coupon/insert_form
public function insert() public function insert()
@ -132,21 +112,19 @@ class PointController extends ClientController
if (!$service_code) { if (!$service_code) {
throw new \Exception("service_code 값이 정의되지 않았습니다."); throw new \Exception("service_code 값이 정의되지 않았습니다.");
} }
$service = $this->getServiceService()->getEntityByCode($service_code); $service = $this->getPointService()->getEntityByCode($service_code);
if (!$service) { if (!$service) {
throw new \Exception("[$service_code]에 해당하는 서비스정보가 존재하지 않습니다."); throw new \Exception("[$service_code]에 해당하는 서비스정보가 존재하지 않습니다.");
} }
$this->service = $service;
//사용자정보 //사용자정보
$client = $this->getClientService()->getEntityByCode($service->getClientCode()); $client = $this->getClientService()->getEntityByCode($service->getClientCode());
if (!$client) { if (!$client) {
throw new \Exception("[{$service->getClientCode()}]에 해당하는 사용자정보가 존재하지 않습니다."); throw new \Exception("[{$service->getClientCode()}]에 해당하는 사용자정보가 존재하지 않습니다.");
} }
$this->client = $client; //관리자정보(등록자)
//전체 관리자정보(등록자)
$member_code = $this->request->get('mkid'); $member_code = $this->request->get('mkid');
if (!$member_code) { if (!$member_code) {
throw new \Exception("member_code 값이 정의되지 않았습니다."); throw new \Exception("mkid 값이 정의되지 않았습니다.");
} }
$member = $this->getMemberService()->getEntityByCode($member_code); $member = $this->getMemberService()->getEntityByCode($member_code);
if (!$member) { if (!$member) {
@ -163,21 +141,21 @@ class PointController extends ClientController
throw new \Exception("도메인 리스트 값이 정의되지 않았습니다."); throw new \Exception("도메인 리스트 값이 정의되지 않았습니다.");
} }
//onetime_case 사용용도 //onetime_case 사용용도
$onetime_case = $this->request->get('onetime_case') ?? 'point'; $onetime_case = $this->request->get('onetime_case', 'domain');
//onetime_request_date 사용일 //onetime_request_date 사용일
$onetime_request_date = $this->request->get('onetime_request_date') ?? date("Y-m-d"); $onetime_request_date = $this->request->get('onetime_request_date') ?? date("Y-m-d");
try { try {
$this->getServiceService()->beginTransaction(); $this->getPointService()->beginTransaction();
//서비스쿠폰 갯수 수정 //서비스쿠폰 갯수 수정
$this->getServiceService()->useCouponForDomain($service, $coupon); $this->getPointService()->usePointForDomain($service, $coupon);
//쿠폰 사용내역 onetime에 등록 //쿠폰 사용내역 onetime에 등록
$this->getOnetimeService()->useCouponForDomain($service, $client, $member, $onetime_case, $coupon, $note, $onetime_request_date); $this->getOnetimeService()->usePointForDomain($service, $client, $member, $onetime_case, $coupon, $note, $onetime_request_date);
//쿠폰 사용내역 history에 등록 //쿠폰 사용내역 history에 등록
$this->getHistoryService()->useCouponForDomain($service, $client, $onetime_case, $coupon, $note, $onetime_request_date);; $this->getHistoryService()->usePointForDomain($service, $client, $onetime_case, $coupon, $note, $onetime_request_date);;
$this->getServiceService()->commit(); $this->getPointService()->commit();
return $this->redirect->to(DBMS_SITE_URL . "/IdcCouponUseMK.cup?client_code=" . $service->getClientCode()); return $this->redirect->to(DBMS_SITE_URL . "/IdcPointUseMK.cup?client_code=" . $service->getClientCode());
} catch (\Exception $e) { } catch (\Exception $e) {
$this->getServiceService()->rollback(); $this->getPointService()->rollback();
return $this->redirect->back()->withInput()->with('error', ['message' => '쿠폰 사용에 실패하였습니다.:' . $e->getMessage()]); return $this->redirect->back()->withInput()->with('error', ['message' => '쿠폰 사용에 실패하였습니다.:' . $e->getMessage()]);
} }
} }

View File

@ -69,11 +69,17 @@ class DashboardController extends DBMSController
//예외,service_line = "test","substitution" //예외,service_line = "test","substitution"
$excepts = ["test", "substitution"]; $excepts = ["test", "substitution"];
$this->day = intval(DBMS_SITE_DASHBOARD_DAY); $this->day = intval(DBMS_SITE_DASHBOARD_DAY);
$this->newServers = $this->getServiceService()->getLatestCount($this->day, $excepts); $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 //예외,service_line = "test","substitution",C012:게임윙,C116:WinIDC,C219:IDC-JP
$excepts = ["test", "substitution", 'C116', 'C012', 'C219']; $excepts = ["test", "substitution", 'C116', 'C012', 'C219'];
$this->unPayments = $this->getServiceService()->getUnPaymentCount($excepts); $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__); return $this->render(__FUNCTION__);
} }
@ -117,8 +123,10 @@ class DashboardController extends DBMSController
{ {
//신규서버정보 //신규서버정보
$this->limit = intval($this->request->get('limit', 5)); $this->limit = intval($this->request->get('limit', 5));
$this->entities = $this->getServiceService()->getLatest($this->limit); $this->getServiceService()->getModel()->orderBy($this->getServiceService()->getModel()->getPKField(), 'DESC');
// echo $this->getServiceervice()->getModel()->getLastQuery(); $this->getServiceService()->getModel()->limit($this->limit);
$this->entities = $this->getServiceService()->getEntities();
//전체 관리자정보(등록자) //전체 관리자정보(등록자)
$this->members = $this->getMemberService()->getEntities(); $this->members = $this->getMemberService()->getEntities();
$clients = []; $clients = [];
@ -128,15 +136,18 @@ class DashboardController extends DBMSController
foreach ($this->entities as $entity) { foreach ($this->entities as $entity) {
$serviceCode = $entity->getServiceCode(); $serviceCode = $entity->getServiceCode();
//해당 고객정보 //해당 고객정보
$client = $this->getClientService()->getEntityByCode($entity->getClientCode()); $this->getClientService()->getModel()->where('client_code', $entity->getClientCode());
$client = $this->getClientService()->getEntity();
if (!$client) { if (!$client) {
throw new \Exception("{$entity->getClientCode()}에 해당하는 고객정보가 존재하지 않습니다."); throw new \Exception("{$entity->getClientCode()}에 해당하는 고객정보가 존재하지 않습니다.");
} }
$clients[$serviceCode] = $client; $clients[$serviceCode] = $client;
//VPC정보갯수 //VPC정보갯수
$vpcs[$serviceCode] = $this->getVPCService()->getCountByServiceCode($serviceCode); $this->getVPCService()->getModel()->where('service_code', $serviceCode);
$vpcs[$serviceCode] = $this->getVPCService()->getCount();
//KCS정보갯수 //KCS정보갯수
$kcss[$serviceCode] = $this->getKCSService()->getCountByServiceCode($serviceCode); $this->getKCSService()->getModel()->where('service_code', $serviceCode);
$kcss[$serviceCode] = $this->getKCSService()->getCount();
$cnt++; $cnt++;
} }
// dd($this->entitys); // dd($this->entitys);
@ -149,9 +160,11 @@ class DashboardController extends DBMSController
//WEB 접속방법 : http://localhost/site/dashboard/latest_history/limit/5 //WEB 접속방법 : http://localhost/site/dashboard/latest_history/limit/5
public function latest_history(): string public function latest_history(): string
{ {
//신규서버정보 //신규History정보
$this->limit = intval($this->request->get('limit', 5)); $this->limit = intval($this->request->get('limit', 5));
$this->entitys = $this->getHistoryService()->getLatest($this->limit); $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(); $this->services = $this->getServiceService()->getEntities();
//services 고객정보 //services 고객정보
@ -167,15 +180,18 @@ class DashboardController extends DBMSController
if (!$service_code) { if (!$service_code) {
throw new \Exception("service_code 값이 정의되지 않았습니다."); throw new \Exception("service_code 값이 정의되지 않았습니다.");
} }
$service = $this->getServiceService()->getEntityByCode($service_code); $this->getServiceService()->getModel()->where('service_code', $service_code);
$service = $this->getServiceService()->getEntity();
if (!$service) { if (!$service) {
throw new \Exception("[$service_code]에 해당하는 서비스정보가 존재하지 않습니다."); throw new \Exception("[$service_code]에 해당하는 서비스정보가 존재하지 않습니다.");
} }
$this->service = $service; $this->service = $service;
//VPC정보갯수 //VPC정보갯수
$this->vpc = $this->getVPCService()->getCountByServiceCode($service->getServiceCode()); $this->getVPCService()->getModel()->where('service_code', $service->getServiceCode());
$this->vpc = $this->getVPCService()->getCount();
//KCS정보갯수 //KCS정보갯수
$this->kcs = $this->getKCSService()->getCountByServiceCode($service->getServiceCode()); $this->getKCSService()->getModel()->where('service_code', $service->getServiceCode());
$this->kcs = $this->getKCSService()->getCount();
return $this->render(__FUNCTION__); return $this->render(__FUNCTION__);
} }
//service_list_cs_count.php //service_list_cs_count.php
@ -187,11 +203,11 @@ class DashboardController extends DBMSController
if (!$service_code) { if (!$service_code) {
throw new \Exception("service_code 값이 정의되지 않았습니다."); throw new \Exception("service_code 값이 정의되지 않았습니다.");
} }
$service = $this->getServiceService()->getEntityByCode($service_code); $this->getServiceService()->getModel()->where('service_code', $service_code);
if (!$service) { $this->entity = $this->getServiceService()->getEntity();
if (!$this->entity) {
throw new \Exception("[$service_code]에 해당하는 서비스정보가 존재하지 않습니다."); throw new \Exception("[$service_code]에 해당하는 서비스정보가 존재하지 않습니다.");
} }
$this->entity = $service;
return $this->render(__FUNCTION__); return $this->render(__FUNCTION__);
} }
} //Class } //Class

View File

@ -3,6 +3,7 @@
namespace lib\Controllers\DBMS; namespace lib\Controllers\DBMS;
use lib\Services\DefenceService; use lib\Services\DefenceService;
use lib\Utils\Pagination;
class DefenceController extends DBMSController class DefenceController extends DBMSController
{ {
@ -21,17 +22,21 @@ class DefenceController extends DBMSController
} }
//방어 defense_index.php //방어 defense_index.php
//CLI 접속방법 : php index.php site/defence/mk/zone/존/parent/부모키/child/자식키 //CLI 접속방법 : php index.php site/defence/index/zone/존/parent/부모키/child/자식키
//WEB 접속방법 : http://localhostsite/defence/mk/zone/존/parent/부모키/child/자식키 //WEB 접속방법 : http://localhost/site/defence/index/zone/존/parent/부모키/child/자식키
public function mk(): string public function index(): string
{ {
$zone = $this->request->get('zone'); $zone = $this->request->get('zone');
if (!$zone) { if (!$zone) {
throw new \Exception("zone 값이 정의되지 않았습니다."); throw new \Exception("zone 값이 정의되지 않았습니다.");
} }
$zone = urldecode($zone); $this->zone = urldecode($zone);
$this->entities = $this->getDefenceService()->getMKList($zone); $this->getDefenceService()->getModel()->where(['zone' => $this->zone]);
$this->zone = $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', 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__); return $this->render(__FUNCTION__);
} }
} //Class } //Class

View File

@ -25,18 +25,22 @@ class NavigatorController extends DBMSController
} }
//부가서비스 : 닷디펜더,딥파인더 등, deepfinder_list.php,dotdefender_list.php //부가서비스 : 닷디펜더,딥파인더 등, deepfinder_list.php,dotdefender_list.php
//CLI 접속방법 : php index.php site/navigator/ipsearch //CLI 접속방법 : php index.php site/navigator/index
//WEB 접속방법 : http://localhost/site/navigator/ipsearch //WEB 접속방법 : http://localhost/site/navigator/index
public function ipsearch(): string public function index(): string
{ {
$ip = $this->request->get('ip'); $ip = $this->request->get('ip');
//전체 고객정보 //전체 고객정보
$this->clients = $this->getClientService()->getEntities(); $this->clients = $this->getClientService()->getEntities();
//IP형식이 ipv4인지 확인 후 값가져오기 //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->curPage = intval($this->request->get('curPage', 1));
$this->perPage = intval($this->request->get('perPage', VIEW_LIST_PERPAGE)); $this->perPage = intval($this->request->get('perPage', VIEW_LIST_PERPAGE));
[$this->total, $this->entities] = $this->getServiceService()->getEntitiesForIpSearch($this->curPage, $this->perPage, $ip, $this->helper->isIPAddress($ip)); [$this->total, $this->entities] = $this->getServiceService()->getList($this->curPage, $this->perPage);
$this->ip = $ip;
$this->pagination = new Pagination($this->total, (int)$this->curPage, (int)$this->perPage); $this->pagination = new Pagination($this->total, (int)$this->curPage, (int)$this->perPage);
return $this->render(__FUNCTION__); return $this->render(__FUNCTION__);
} }

View File

@ -34,24 +34,19 @@ class ServerController extends DBMSController
//WEB 접속방법 : http://localhost/site/client/coupon/index //WEB 접속방법 : http://localhost/site/client/coupon/index
public function index() public function index()
{ {
//사용자정보 //서비스스코드가 있는
$client_code = $this->request->get('client_code'); $service_code = $this->request->get('service_code');
// echo "client_code:" . $client_code; if ($service_code) {
if ($client_code) { $this->getServerService()->getModel()->where('service_code', $service_code);
$client = $this->getClientService()->getEntityByCode($client_code);
if (!$client) {
throw new \Exception("[$client_code]에 해당하는 사용자정보가 존재하지 않습니다.");
}
$this->client = $client;
} }
//쿠폰내역 //쿠폰내역
$this->curPage = intval($this->request->get('curPage', 1)); $this->curPage = intval($this->request->get('curPage', 1));
$this->perPage = intval($this->request->get('perPage', VIEW_LIST_PERPAGE)); $this->perPage = intval($this->request->get('perPage', VIEW_LIST_PERPAGE));
[$this->total, $this->services] = $this->getServerService()->getEntitiesByClient($this->curPage, $this->perPage, $client_code); [$this->total, $this->entities] = $this->getServerService()->getList($this->curPage, $this->perPage);
$this->pagination = new Pagination($this->total, (int)$this->curPage, (int)$this->perPage); $this->pagination = new Pagination($this->total, (int)$this->curPage, (int)$this->perPage);
$total_coupon = 0; $total_coupon = 0;
foreach ($this->services as $service) { foreach ($this->entities as $entity) {
$total_coupon += $service->getCoupon(); $total_coupon += $entity->getCoupon();
} }
$this->total_coupon = $total_coupon; $this->total_coupon = $total_coupon;
return $this->render(__FUNCTION__); return $this->render(__FUNCTION__);

View File

@ -44,7 +44,8 @@ class ServiceController extends DBMSController
$this->adddb_code = urldecode($adddb_code); $this->adddb_code = urldecode($adddb_code);
//해당 부가서비스의 services_code 목록 가져오기 //해당 부가서비스의 services_code 목록 가져오기
//segment의 값이 한글인경우 urldecode가 필요 //segment의 값이 한글인경우 urldecode가 필요
$addDbEntities = $this->getAddDbService()->getEntitiesByCode($this->adddb_code); $this->getAddDbService()->getModel()->where('addDB_code', $this->adddb_code);
$addDbEntities = $this->getAddDbService()->getEntities();
$service_codes = []; $service_codes = [];
foreach ($addDbEntities as $entity) { foreach ($addDbEntities as $entity) {
$service_codes[] = $entity->getServiceCode(); $service_codes[] = $entity->getServiceCode();
@ -57,7 +58,8 @@ class ServiceController extends DBMSController
//부가서비스용 서비스목록 가져오기 //부가서비스용 서비스목록 가져오기
$this->curPage = intval($this->request->get('curPage', 1)); $this->curPage = intval($this->request->get('curPage', 1));
$this->perPage = intval($this->request->get('perPage', VIEW_LIST_PERPAGE)); $this->perPage = intval($this->request->get('perPage', VIEW_LIST_PERPAGE));
[$this->total, $this->entities] = $this->getServiceService()->getEntitiesForExtra($this->curPage, $this->perPage, $service_codes); $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); $this->pagination = new Pagination($this->total, (int)$this->curPage, (int)$this->perPage);
return $this->render(__FUNCTION__); return $this->render(__FUNCTION__);
} }

View File

@ -0,0 +1,17 @@
<?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);
} //
} //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

@ -27,14 +27,4 @@ class AddDbService extends CommonService
{ {
return Entity::class; return Entity::class;
} }
public function getEntityByCode(string $key): Entity|null|false
{
$this->getModel()->where('addDB_code', $key);
return $this->getEntity();
}
public function getEntitiesByCode(string $key): array
{
$this->getModel()->where('addDB_code', $key);
return $this->getEntities();
}
} }

View File

@ -27,9 +27,4 @@ class ClientService extends CommonService
{ {
return Entity::class; return Entity::class;
} }
public function getEntityByCode(string $key): Entity|null|false
{
$this->getModel()->where('Client_Code', $key);
return $this->getEntity();
}
} }

View File

@ -13,7 +13,7 @@ abstract class CommonService extends Core
} // } //
abstract public function getModelClass(): string; abstract public function getModelClass(): string;
abstract public function getEntityClass(): string; abstract public function getEntityClass(): string;
final protected function getModel(): mixed final public function getModel(): mixed
{ {
if ($this->_model === null) { if ($this->_model === null) {
$modelClass = $this->getModelClass(); $modelClass = $this->getModelClass();
@ -48,6 +48,17 @@ abstract class CommonService extends Core
// echo "<BR>" . $this->getModel()->getLastQuery(); // echo "<BR>" . $this->getModel()->getLastQuery();
return $count; return $count;
} }
final public function getList(int $curPage = 1, int $perPage = 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];
}
public function insert(array $formData): int public function insert(array $formData): int
{ {

View File

@ -27,13 +27,4 @@ class DefenceService extends CommonService
{ {
return Entity::class; return Entity::class;
} }
public function getMKList(mixed $zone = null): array
{
if ($zone) {
$this->getModel()->where(['zone' => $zone]);
}
$this->getModel()->orderBy(['zone' => 'asc', 'parents' => 'asc', 'child' => 'asc']);
return $this->getEntities();
}
} }

View File

@ -30,14 +30,8 @@ class HistoryService extends CommonService
{ {
return Entity::class; return Entity::class;
} }
public function getLatest(int $limit = 5): array //도메인쿠폰 사용
{ public function useCouponByService(ServiceEntity $service, ClientEntity $client, string $onetime_case, int $coupon, string $note, string $onetime_request_date): bool
$this->getModel()->orderBy($this->getModel()->getPKField(), 'DESC');
$this->getModel()->limit($limit);
return $this->getEntities();
}
//도메인쿠폰 사용용
public function useCouponForDomain(ServiceEntity $service, ClientEntity $client, string $onetime_case, int $coupon, string $note, string $onetime_request_date): bool
{ {
$formDatas = [ $formDatas = [
"service_code" => $service->getServiceCode(), "service_code" => $service->getServiceCode(),

View File

@ -27,9 +27,4 @@ class KCSService extends CommonService
{ {
return Entity::class; return Entity::class;
} }
public function getCountByServiceCode(string $service_code): int
{
$this->getModel()->where("service_code", $service_code);
return $this->getCount();
}
} }

View File

@ -27,9 +27,4 @@ class MemberService extends CommonService
{ {
return Entity::class; return Entity::class;
} }
public function getEntityByCode(string $key): Entity|null|false
{
$this->getModel()->where(Model::PKField, $key);
return $this->getEntity();
}
} }

View File

@ -31,35 +31,24 @@ class OnetimeService extends CommonService
{ {
return Entity::class; return Entity::class;
} }
public function getCountByServiceCode(string $service_code): int
{
$this->getModel()->where("service_code", $service_code);
return $this->getCount();
}
public function getCountByClientCode(string $client_code): int // //Coupon 리스트
{ // public function getEntitiesForDomainCoupon_Test(int $curPage, int $perPage): array
$this->getModel()->where("client_code", $client_code); // {
return $this->getCount(); // $this->getModel()->like(["onetime_case" => "%domain%"]);
} // $this->getModel()->orderBy("onetime_request_date", "DESC");
// //Query문 Rest여부 -> 같은조건에 Count 받고, 결과값을 받고 싶을때는 continue()
//Coupon 리스트 // $this->getModel()->setContinue(true);
public function getEntitiesForDomainCoupon(int $curPage, int $perPage): array // $total = $this->getCount();
{ // //limit, offset 설정
$this->getModel()->like(["onetime_case" => "%domain%"]); // $this->getModel()->limit($perPage);
$this->getModel()->orderBy("onetime_request_date", "DESC"); // $this->getModel()->offset(($curPage - 1) * $perPage);
//Query문 Rest여부 -> 같은조건에 Count 받고, 결과값을 받고 싶을때는 continue() // $entities = $this->getEntities();
$this->getModel()->setContinue(true); // return [$total, $this->getEntities()];
$total = $this->getCount(); // }
//limit, offset 설정
$this->getModel()->limit($perPage);
$this->getModel()->offset(($curPage - 1) * $perPage);
$entities = $this->getEntities();
return [$total, $this->getEntities()];
}
//도메인쿠폰 사용용 //도메인쿠폰 사용용
public function useCouponForDomain(ServiceEntity $service, ClientEntity $client, MemberEntity $member, string $onetime_case, int $coupon, string $note, string $onetime_request_date): bool public function useCouponByService(ServiceEntity $service, ClientEntity $client, MemberEntity $member, string $onetime_case, int $coupon, string $note, string $onetime_request_date): bool
{ {
$formDatas = [ $formDatas = [
"client_code" => $service->getClientCode(), "client_code" => $service->getClientCode(),

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

View File

@ -27,12 +27,6 @@ class ServerService extends CommonService
{ {
return Entity::class; return Entity::class;
} }
public function getCountByServiceCode(string $service_code): int
{
$this->getModel()->where("service_code", $service_code);
return $this->getCount();
}
public function getCountByMode(string $mode, string $cpu, ?string $spec = null): int public function getCountByMode(string $mode, string $cpu, ?string $spec = null): int
{ {
switch ($mode) { switch ($mode) {
@ -57,19 +51,4 @@ class ServerService extends CommonService
} }
return $this->getCount(); return $this->getCount();
} }
//사용자별 서비스리스트트
public function getEntitiesByClient(int $curPage, int $perPage, ?string $client_code = null): array
{
if ($client_code) {
$this->getModel()->where("client_code", $client_code);
}
//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()];
}
} }

View File

@ -31,48 +31,10 @@ class ServiceService extends CommonService
{ {
return Entity::class; return Entity::class;
} }
public function getEntityByCode(string $key): Entity|null|false
{
$this->getModel()->where('service_code', $key);
return $this->getEntity();
}
//사용자별 서비스리스트트
public function getEntitiesByClient(int $curPage, int $perPage, ?string $client_code = null): array
{
if ($client_code) {
$this->getModel()->where("client_code", $client_code);
}
$this->getModel()->whereNotIn("service_line", ['vpn', 'test', 'solo', 'substitution', 'event']);
//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()];
}
//미지급금 리스트 //미지급금 리스트
public function getEntitiesForNonPayment(int $curPage, int $perPage, string $mode, array $exclude_clients): array public function getEntitiesForNonPayment(int $curPage, int $perPage, array $exclude_clients): array
{ {
switch ($mode) {
case 'today':
$this->getModel()->where("service_payment_date = CURDATE()");
break;
case '1day':
$nonpaymentDay = 1;
$this->getModel()->where("service_payment_date = Date_Add(CURDATE(),INTERVAL {$nonpaymentDay} DAY)");
break;
case '2day':
$nonpaymentDay = 2;
$this->getModel()->where("service_payment_date = Date_Add(CURDATE(),INTERVAL {$nonpaymentDay} DAY)");
break;
case '3day':
$nonpaymentDay = 3;
$this->getModel()->where("service_payment_date = Date_Add(CURDATE(),INTERVAL {$nonpaymentDay} DAY)");
break;
}
$table = $this->getModel()->getTable(); $table = $this->getModel()->getTable();
$clientTable = ClientModel::TABLE; $clientTable = ClientModel::TABLE;
$addDbTable = AddDbModel::TABLE; $addDbTable = AddDbModel::TABLE;
@ -91,63 +53,6 @@ class ServiceService extends CommonService
return [$total, $this->getEntities()]; return [$total, $this->getEntities()];
} }
//미지급금 리스트
public function getEntitiesForIpSearch(int $curPage, int $perPage, ?string $ip = null, $isIPV4 = true): array
{
if ($ip && $isIPV4) {
$this->getModel()->where('service_ip', $ip);
} elseif ($ip) {
$this->getModel()->like('service_ip', $ip);
}
//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()];
}
//부가서비스스
public function getEntitiesForExtra(int $curPage, int $perPage, array $service_codes): array
{
$this->getModel()->whereIn('service_code', $service_codes);
//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()];
}
//최근 $day일간 신규서비스 카운트
public function getLatestCount(int $day, array $excepts): int|string
{
$this->getModel()->where("service_open_date > DATE_ADD(now(), INTERVAL -{$day} DAY)");
$this->getModel()->where("service_status", 'o');
$this->getModel()->whereNotIn("service_line", $excepts);
$count = $this->getModel()->count();
// echo __FUNCTION__ . ":" . $this->getModel()->getLastQuery();
return $count;
}
//미지급서비스 카운트
public function getUnPaymentCount(array $excepts): int|string
{
$this->getModel()->where("service_payment_date > now()");
$this->getModel()->where("service_status", 'o');
$this->getModel()->whereNotIn("service_line", $excepts);
$count = $this->getModel()->count();
// echo __FUNCTION__ . ":" . $this->getModel()->getLastQuery();
return $count;
}
//최근신규서비스정보 리스트 limit갯수만큼큼
public function getLatest(int $limit): array
{
$this->getModel()->orderBy($this->getModel()->getPKField(), 'DESC');
$this->getModel()->limit($limit);
return $this->getEntities();
}
//지역(치바,도쿄등)에 따른 DASHBOARD용 서비스 카운트 //지역(치바,도쿄등)에 따른 DASHBOARD용 서비스 카운트
private function getDistrictCountForDashboard(string $where, string $type, array $switchcodes): int private function getDistrictCountForDashboard(string $where, string $type, array $switchcodes): int
{ {
@ -174,41 +79,9 @@ class ServiceService extends CommonService
} //foreach } //foreach
return $temps; return $temps;
} }
//지역(치바,도쿄등)에 따른 사용자별용 서비스스카운트
public function getDistrictCountByClient(string $client_code, string $switchcode_begin, string $switchcode_end): int
{
$this->getModel()->where("client_code", "{$client_code}");
$this->getModel()->where("service_sw BETWEEN '{$switchcode_begin}' AND '{$switchcode_end}'");
$this->getModel()->where("service_status", "o");
$this->getModel()->whereNotIn("service_line", ['solo', 'test', 'event', 'substitution']);
return $this->getCount();
// $sql = "SELECT (SELECT COUNT(*) FROM servicedb WHERE service_line = 'normal' AND service_status = 'o' AND service_sw BETWEEN '{$switchcode_begin}' AND '{$switchcode_end}' AND Client_Code = '{$client_code}') AS normal,
// (SELECT COUNT(*) FROM servicedb WHERE service_line = 'defence' AND service_status = 'o' AND service_sw BETWEEN '{$switchcode_begin}' AND '{$switchcode_end}' AND Client_Code = '{$client_code}') AS defence,
// (SELECT COUNT(*) FROM servicedb WHERE service_line = 'solo' AND service_status = 'o' AND Client_Code = '{$client_code}') AS solo,
// (SELECT COUNT(*) FROM servicedb WHERE service_line = 'test' AND service_status = 'o' AND service_sw BETWEEN '{$switchcode_begin}' AND '{$switchcode_end}' AND Client_Code = '{$client_code}') AS test,
// (SELECT COUNT(*) FROM servicedb WHERE service_line = 'event' AND service_status = 'o' AND service_sw BETWEEN '{$switchcode_begin}' AND '{$switchcode_end}' AND Client_Code = '{$client_code}') AS event,
// (SELECT COUNT(*) FROM servicedb WHERE service_line = 'substitution' AND service_status = 'o' AND service_sw BETWEEN '{$switchcode_begin}' AND '{$switchcode_end}' AND Client_Code = '{$client_code}') AS substitution";
// $stmt = $this->getModel()->execute($sql);
// // echo "<BR>" . $this->getModel()->getLastQuery();
// return $stmt->fetch(PDO::FETCH_ASSOC);
}
//ServieLine(일반,방어,전용,테스트,대체등)에 따른 사용자별용 서비스 카운트
public function getServiceLineCountByClient(string $client_code, string $service_line): int
{
$this->getModel()->where("client_code", "{$client_code}");
$this->getModel()->where("service_line", "{$service_line}");
$this->getModel()->where("service_status", 'o');
return $this->getCount();
}
//사용자별용 서비스 쿠폰 카운트
public function getCouponTotalCountByClient(string $client_code): int
{
$this->getModel()->where("client_code", "{$client_code}");
$this->getModel()->whereNotIn("service_line", ['vpn', 'test', 'solo', 'substitution', 'event']);
return $this->getCount("SUM(coupon) as cnt");
}
//도메인쿠폰 사용용 //도메인쿠폰 사용용
public function useCouponForDomain(ServiceEntity $service, int $coupon): bool public function useCouponByService(ServiceEntity $service, int $coupon): bool
{ {
if ($coupon < 0) { if ($coupon < 0) {
throw new \Exception("쿠폰수량이 잘못되었습니다. 쿠폰수량 : $coupon"); throw new \Exception("쿠폰수량이 잘못되었습니다. 쿠폰수량 : $coupon");
@ -216,7 +89,7 @@ class ServiceService extends CommonService
$this->getModel()->where("service_code", $service->getServiceCode()); $this->getModel()->where("service_code", $service->getServiceCode());
$this->getModel()->update(["coupon=(coupon-{$coupon})" => null, "coupon_use=(coupon_use+{$coupon})" => null]); $this->getModel()->update(["coupon=(coupon-{$coupon})" => null, "coupon_use=(coupon_use+{$coupon})" => null]);
return true; return true;
} //setCoupon } //도메인쿠폰 Reset
public function resetCouponByClient(ClientEntity $client, int $coupon): bool public function resetCouponByClient(ClientEntity $client, int $coupon): bool
{ {
if ($coupon < 0) { if ($coupon < 0) {

View File

@ -27,9 +27,4 @@ class VPCService extends CommonService
{ {
return Entity::class; return Entity::class;
} }
public function getCountByServiceCode(string $service_code): int
{
$this->getModel()->where("service_code", $service_code);
return $this->getCount();
}
} }

View File

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

View File

@ -11,7 +11,7 @@
} }
</style> </style>
<div><strong>패스워드용 난수 : </strong><input type=text style="width:290px;" value="<?= $this->helper->getRandomString() ?>"></div> <div><strong>패스워드용 난수 : </strong><input type=text style="width:290px;" value="<?= $this->helper->getRandomString() ?>"></div>
<?php foreach ($this->entitys as $entity): ?> <?php foreach ($this->entities as $entity): ?>
<?php $service = $this->services[$entity->getServiceCode()]; ?> <?php $service = $this->services[$entity->getServiceCode()]; ?>
<div> <div>
<i class="fa fa-info-circle fa-fw"></i> <i class="fa fa-info-circle fa-fw"></i>

View File

@ -107,9 +107,9 @@
<td><?= $entity->getClientCode() ?></td> <td><?= $entity->getClientCode() ?></td>
<td><?= $this->clients[$entity->getClientCode()]->getTitle() ?></td> <td><?= $this->clients[$entity->getClientCode()]->getTitle() ?></td>
<td><?= $entity->getServerCode() ?></td> <td><?= $entity->getServerCode() ?></td>
<td><?= $entity->entity_ip ?></td> <td><?= $entity->service_ip ?></td>
<td><?= $entity->entity_os ?></td> <td><?= $entity->service_os ?></td>
<td><?= $entity->entity_sw ?></td> <td><?= $entity->service_sw ?></td>
<td><?= $this->clients[$entity->getClientCode()]->getPhone() ?></td> <td><?= $this->clients[$entity->getClientCode()]->getPhone() ?></td>
<td><?= $this->clients[$entity->getClientCode()]->getEmail() ?></td> <td><?= $this->clients[$entity->getClientCode()]->getEmail() ?></td>
</tr> </tr>