dbms_primeidc_init...1

This commit is contained in:
최준흠 2025-04-18 20:02:17 +09:00
parent 539d5135c1
commit 1a5f258950
19 changed files with 244 additions and 357 deletions

View File

@ -6,6 +6,7 @@ use lib\Controllers\DBMS\Client\ClientController;
use lib\Controllers\DBMS\Client\CouponController; use lib\Controllers\DBMS\Client\CouponController;
use lib\Controllers\DBMS\Client\MemoController; use lib\Controllers\DBMS\Client\MemoController;
use lib\Controllers\DBMS\Client\PaymentController; use lib\Controllers\DBMS\Client\PaymentController;
use lib\Controllers\DBMS\Client\PointController;
use lib\Controllers\DBMS\DashboardController; use lib\Controllers\DBMS\DashboardController;
use lib\Controllers\DBMS\DefenceController; use lib\Controllers\DBMS\DefenceController;
use lib\Controllers\DBMS\GearlistController; use lib\Controllers\DBMS\GearlistController;
@ -51,6 +52,24 @@ $router->group('dbms/client', function (Router $router) {
// Response::view($result); // 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->group('payment', function (Router $router) {
$router->add('GET', 'index', function ($params) { $router->add('GET', 'index', function ($params) {

View File

@ -2,14 +2,14 @@
namespace lib\Controllers\DBMS\Client; namespace lib\Controllers\DBMS\Client;
use lib\Services\ClientService;
use lib\Controllers\DBMS\DBMSController; use lib\Controllers\DBMS\DBMSController;
use lib\Services\ClientService;
use lib\Services\MemberService;
class ClientController extends DBMSController class ClientController extends DBMSController
{ {
private ?ClientService $_clientService = null; private ?ClientService $_clientService = null;
private ?MemberService $_memberService = null;
public function __construct(array $params = []) public function __construct(array $params = [])
{ {
parent::__construct($params); parent::__construct($params);
@ -22,16 +22,66 @@ class ClientController extends DBMSController
} }
return $this->_clientService; return $this->_clientService;
} }
final public function getMemberService(): MemberService
{
if ($this->_memberService === null) {
$this->_memberService = new MemberService();
}
return $this->_memberService;
}
protected function setDefaultRequestData(): array
{
$this->client = null;
$this->member = null;
$this->service = null;
//사용자정보
$client_code = $this->request->get('client_code');
// echo "Client_Code:" . $client_code;
// exit;
if ($client_code) {
$this->getClientService()->getModel()->where('Client_Code', $client_code);
$client = $this->getClientService()->getEntity();
if (!$client) {
throw new \Exception("[$client_code]에 해당하는 고객정보가 존재하지 않습니다.");
}
$this->client = $client;
}
//관리자정보(등록자)
$member_code = $this->request->get('mkid');
// echo "member_code:" . $member_code;
if ($member_code) {
$this->getMemberService()->getModel()->where($this->getMemberService()->getModel()::PKField, $member_code);
$member = $this->getMemberService()->getEntity();
if (!$member) {
throw new \Exception("[$member_code]에 해당하는 관리자정보가 존재하지 않습니다.");
}
$this->member = $member;
}
//서비스정보
$service_code = $this->request->get('service_code');
// echo "service_code:" . $service_code;
if ($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;
}
return [$client_code, $member_code, $service_code];
}
//서비스카운팅 , total_counting_customer.php //서비스카운팅 , total_counting_customer.php
//CLI 접속방법 : php index.php site/client/totalcount/client_code/코드번호 //CLI 접속방법 : php index.php site/client/totalcount/client_code/코드번호
//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) {
$this->getClientService()->getModel()->where('Client_Code', $client_code);
$client = $this->getClientService()->getEntity(); $client = $this->getClientService()->getEntity();
if (!$client) { if (!$client) {
throw new \Exception("[$client_code]에 해당하는 고객정보가 존재하지 않습니다."); throw new \Exception("[$client_code]에 해당하는 고객정보가 존재하지 않습니다.");

View File

@ -3,7 +3,6 @@
namespace lib\Controllers\DBMS\Client; namespace lib\Controllers\DBMS\Client;
use lib\Services\HistoryService; use lib\Services\HistoryService;
use lib\Services\MemberService;
use lib\Services\OnetimeService; use lib\Services\OnetimeService;
use lib\Utils\Pagination; use lib\Utils\Pagination;
@ -11,19 +10,11 @@ class CouponController extends ClientController
{ {
private ?OnetimeService $_onetimeService = null; private ?OnetimeService $_onetimeService = null;
private ?HistoryService $_historyService = null; private ?HistoryService $_historyService = null;
private ?MemberService $_memberService = null;
public function __construct(array $params = []) public function __construct(array $params = [])
{ {
parent::__construct($params); parent::__construct($params);
$this->getView()->setPath('coupon'); $this->getView()->setPath('coupon');
} // } //
public function getMemberService(): MemberService
{
if ($this->_memberService === null) {
$this->_memberService = new MemberService();
}
return $this->_memberService;
}
public function getOnetimeService(): OnetimeService public function getOnetimeService(): OnetimeService
{ {
if ($this->_onetimeService === null) { if ($this->_onetimeService === null) {
@ -44,34 +35,19 @@ class CouponController extends ClientController
//WEB 접속방법 : http://localhost/site/client/coupon/index //WEB 접속방법 : http://localhost/site/client/coupon/index
public function index() public function index()
{ {
//사용자정보 //기본적으로 필요한 client_code, mkid, service_code를 설정합니다.
$client_code = $this->request->get('client_code'); list($client_code, $member_code, $service_code) = $this->setDefaultRequestData();
if ($client_code) {
$client = $this->getClientService()->getEntity();
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()->getEntity();
if (!$member) {
throw new \Exception("[$member_code]에 해당하는 관리자정보가 존재하지 않습니다.");
}
$this->member = $member;
}
//사용자별 쿠폰내역 //사용자별 쿠폰내역
$this->getServiceService()->getModel()->where('client_code', $client_code); if ($client_code) {
$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->entities] = $this->getServiceService()->getList($this->curPage, $this->perPage); [$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->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__);
@ -82,34 +58,8 @@ class CouponController extends ClientController
//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'); //기본적으로 필요한 client_code, mkid, service_code를 설정합니다.
if (!$service_code) { list($client_code, $member_code, $service_code) = $this->setDefaultRequestData();
throw new \Exception("service_code 값이 정의되지 않았습니다.");
}
$this->getServiceService()->getModel()->where('service_code', $service_code);
$service = $this->getServiceService()->getEntity();
if (!$service) {
throw new \Exception("[$service_code]에 해당하는 서비스정보가 존재하지 않습니다.");
}
//사용자정보
$this->getClientService()->getModel()->where('Client_Code', $service->getClientCode());
$client = $this->getClientService()->getEntity();
if (!$client) {
throw new \Exception("[{$service->getClientCode()}]에 해당하는 고객정보가 존재하지 않습니다.");
}
//관리자정보(등록자)
$member_code = $this->request->get('mkid');
if (!$member_code) {
throw new \Exception("mkid 값이 정의되지 않았습니다.");
}
$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->today = date("Y-m-d"); $this->today = date("Y-m-d");
return $this->render(__FUNCTION__); return $this->render(__FUNCTION__);
} }
@ -119,31 +69,8 @@ class CouponController extends ClientController
//WEB 접속방법 : http://localhost/site/client/coupon/insert_form //WEB 접속방법 : http://localhost/site/client/coupon/insert_form
public function insert() public function insert()
{ {
$service_code = $this->request->get('service_code'); //기본적으로 필요한 client_code, mkid, service_code를 설정합니다.
if (!$service_code) { list($client_code, $member_code, $service_code) = $this->setDefaultRequestData();
throw new \Exception("service_code 값이 정의되지 않았습니다.");
}
$this->getServiceService()->getModel()->where('service_code', $service_code);
$service = $this->getServiceService()->getEntity();
if (!$service) {
throw new \Exception("[$service_code]에 해당하는 서비스정보가 존재하지 않습니다.");
}
//사용자정보
$this->getClientService()->getModel()->where('Client_Code', $service->getClientCode());
$client = $this->getClientService()->getEntity();
if (!$client) {
throw new \Exception("[{$service->getClientCode()}]에 해당하는 고객정보가 존재하지 않습니다.");
}
//관리자정보(등록자)
$member_code = $this->request->get('mkid');
if (!$member_code) {
throw new \Exception("mkid 값이 정의되지 않았습니다.");
}
$this->getMemberService()->getModel()->where('member_code', $member_code);
$member = $this->getMemberService()->getEntity();
if (!$member) {
throw new \Exception("[$member_code]에 해당하는 관리자정보가 존재하지 않습니다.");
}
//onetime_sub 도메인 구매 수량 //onetime_sub 도메인 구매 수량
$coupon = $this->request->get('coupon'); $coupon = $this->request->get('coupon');
if (! $coupon || $coupon < 1) { if (! $coupon || $coupon < 1) {
@ -161,13 +88,13 @@ class CouponController extends ClientController
try { try {
$this->getServiceService()->beginTransaction(); $this->getServiceService()->beginTransaction();
//서비스쿠폰 갯수 수정 //서비스쿠폰 갯수 수정
$this->getServiceService()->useCouponByService($service, $coupon); $this->getServiceService()->useCouponByService($this->service, $coupon);
//쿠폰 사용내역 onetime에 등록 //쿠폰 사용내역 onetime에 등록
$this->getOnetimeService()->useCouponByService($service, $client, $member, $onetime_case, $coupon, $note, $onetime_request_date); $this->getOnetimeService()->useCouponByService($this->service, $this->client, $this->member, $onetime_case, $coupon, $note, $onetime_request_date);
//쿠폰 사용내역 history에 등록 //쿠폰 사용내역 history에 등록
$this->getHistoryService()->useCouponByService($service, $client, $onetime_case, $coupon, $note, $onetime_request_date);; $this->getHistoryService()->useCouponByService($this->service, $this->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=" . $this->service->getClientCode());
} catch (\Exception $e) { } catch (\Exception $e) {
$this->getServiceService()->rollback(); $this->getServiceService()->rollback();
return $this->redirect->back()->withInput()->with('error', ['message' => '쿠폰 사용에 실패하였습니다.:' . $e->getMessage()]); return $this->redirect->back()->withInput()->with('error', ['message' => '쿠폰 사용에 실패하였습니다.:' . $e->getMessage()]);

View File

@ -17,29 +17,15 @@ 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, mkid, service_code를 설정합니다.
$client_code = $this->request->get('client_code'); list($client_code, $member_code, $service_code) = $this->setDefaultRequestData();
if ($client_code) {
$client = $this->getClientService()->getEntity();
if (!$client) {
throw new \Exception("[$client_code]에 해당하는 고객정보보가 존재하지 않습니다.");
}
$this->client = $client;
}
return $this->render(__FUNCTION__); return $this->render(__FUNCTION__);
} }
public function update() public function update()
{ {
//사용자정보 //기본적으로 필요한 client_code, mkid, service_code를 설정합니다.
$client_code = $this->request->get('client_code'); list($client_code, $member_code, $service_code) = $this->setDefaultRequestData();
if ($client_code) {
$client = $this->getClientService()->getEntity();
if (!$client) {
throw new \Exception("[$client_code]에 해당하는 고객정보보가 존재하지 않습니다.");
}
$this->client = $client;
}
return $this->render(__FUNCTION__); return $this->render(__FUNCTION__);
} }
} //Class } //Class

View File

@ -17,24 +17,8 @@ class PaymentController extends ClientController
//WEB 접속방법 : http://localhostsite/client/payment/billpaper //WEB 접속방법 : http://localhostsite/client/payment/billpaper
public function billpaper(): string public function billpaper(): string
{ {
//사이트 정보 가져오기 //기본적으로 필요한 client_code, mkid, service_code를 설정합니다.
$sitekey = $this->request->get('sitekey'); list($client_code, $member_code, $service_code) = $this->setDefaultRequestData();
if (!$sitekey) {
throw new \Exception("sitekey 값이 정의되지 않았습니다.");
}
$this->siteInfo = DBMS_SITEINFOS[$sitekey];
if (!array_key_exists($sitekey, DBMS_SITEINFOS)) {
throw new \Exception("[{$sitekey}]에 해당하는 사이트정보가 없습니다.");
}
//사용자정보가져오기
$client_code = $this->request->get('client_code');
if ($client_code) {
$client = $this->getClientService()->getEntity();
if (!$client) {
throw new \Exception("[$client_code]에 해당하는 고객정보가 존재하지 않습니다.");
}
$this->client = $client;
}
return $this->render(__FUNCTION__); return $this->render(__FUNCTION__);
} }
//미납리스트트, NonPaymentList.php //미납리스트트, NonPaymentList.php

View File

@ -2,14 +2,16 @@
namespace lib\Controllers\DBMS\Client; namespace lib\Controllers\DBMS\Client;
use lib\Services\MemberService; use lib\Services\HistoryService;
use lib\Services\OnetimeService;
use lib\Services\PointService; use lib\Services\PointService;
use lib\Utils\Pagination; use lib\Utils\Pagination;
class PointController extends ClientController class PointController extends ClientController
{ {
private ?PointService $_pointService = null; private ?PointService $_pointService = null;
private ?MemberService $_memberService = null; private ?OnetimeService $_onetimeService = null;
private ?HistoryService $_historyService = null;
public function __construct(array $params = []) public function __construct(array $params = [])
{ {
parent::__construct($params); parent::__construct($params);
@ -22,141 +24,103 @@ class PointController extends ClientController
} }
return $this->_pointService; return $this->_pointService;
} }
public function getMemberService(): MemberService public function getOnetimeService(): OnetimeService
{ {
if ($this->_memberService === null) { if ($this->_onetimeService === null) {
$this->_memberService = new MemberService(); $this->_onetimeService = new OnetimeService();
} }
return $this->_memberService; return $this->_onetimeService;
}
public function getHistoryService(): HistoryService
{
if ($this->_historyService === null) {
$this->_historyService = new HistoryService();
}
return $this->_historyService;
} }
//IdcPointListMK.jsp -> domain_coupon.php //IdcPointListMK.jsp -> domain_point.php
//CLI 접속방법 : php index.php site/client/counpon/index //CLI 접속방법 : php index.php site/client/point/index
//WEB 접속방법 : http://localhost/site/client/coupon/index //WEB 접속방법 : http://localhost/site/client/point/index
public function index() public function index()
{ {
//사용자정보 //전체 고객객정보
$this->clients = $this->getClientService()->getEntities();
//전체 관리자정보(등록자)
$this->members = $this->getMemberService()->getEntities();
//사용자별 포인트내역
$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); $this->getPointService()->getModel()->where('client_code', $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($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->getPointService()->getEntitiesByClient($this->curPage, $this->perPage, $client_code); [$this->total, $this->entities] = $this->getPointService()->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;
foreach ($this->services as $service) {
$total_coupon += $service->getPoint();
}
$this->total_coupon = $total_coupon;
return $this->render(__FUNCTION__); return $this->render(__FUNCTION__);
} }
//IdcPointBuyMK.jsp -> domain_coupon_buy.php //IdcPointBuyMK.jsp -> domain_point_buy.php
//CLI 접속방법 : php index.php site/client/counpon/insert_form //CLI 접속방법 : php index.php site/client/point/insert_form
//WEB 접속방법 : http://localhost/site/client/coupon/insert_form //WEB 접속방법 : http://localhost/site/client/point/insert_form
public function insert_form() public function insert_form()
{ {
$service_code = $this->request->get('service_code'); //기본적으로 필요한 client_code, mkid, service_code를 설정합니다.
if (!$service_code) { list($client_code, $member_code, $service_code) = $this->setDefaultRequestData();
throw new \Exception("service_code 값이 정의되지 않았습니다.");
}
$service = $this->getPointService()->getEntityByCode($service_code);
if (!$service) {
throw new \Exception("[$service_code]에 해당하는 서비스정보가 존재하지 않습니다.");
}
$this->service = $service;
//사용자정보
$client = $this->getClientService()->getEntityByCode($service->getClientCode());
if (!$client) {
throw new \Exception("[{$service->getClientCode()}]에 해당하는 사용자정보가 존재하지 않습니다.");
}
$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->member = $member;
$this->today = date("Y-m-d"); $this->today = date("Y-m-d");
return $this->render(__FUNCTION__); return $this->render(__FUNCTION__);
} }
//IdcPointBuyMK.jsp -> domain_coupon_buy.php //IdcPointBuyMK.jsp -> domain_point_buy.php
//CLI 접속방법 : php index.php site/client/counpon/insert_form //CLI 접속방법 : php index.php site/client/point/insert_form
//WEB 접속방법 : http://localhost/site/client/coupon/insert_form //WEB 접속방법 : http://localhost/site/client/point/insert_form
public function insert() public function insert()
{ {
$service_code = $this->request->get('service_code'); //기본적으로 필요한 client_code, mkid, service_code를 설정합니다.
if (!$service_code) { list($client_code, $member_code, $service_code) = $this->setDefaultRequestData();
throw new \Exception("service_code 값이 정의되지 않았습니다."); //포인트 형식
$type = $this->request->get('type');
if (!$type) {
throw new \Exception("포인트 형식이 정의되지 않았습니다.");
} }
$service = $this->getPointService()->getEntityByCode($service_code); //포인트 제목
if (!$service) { $title = $this->request->get('title');
throw new \Exception("[$service_code]에 해당하는 서비스정보가 존재하지 않습니다."); if (!$title) {
throw new \Exception("포인트 제목이 정의되지 않았습니다.");
} }
//사용자정보 //포인트 값
$client = $this->getClientService()->getEntityByCode($service->getClientCode()); $amount = intval($this->request->get('amount'));
if (!$client) { if (! $amount || $amount < 1) {
throw new \Exception("[{$service->getClientCode()}]에 해당하는 사용자정보가 존재하지 않습니다."); throw new \Exception("포인트 값이 정의되지 않았거나, 포인트값은 1 이상이어야 합니다.");
} }
//관리자정보(등록자) //포인트 작업 내용
$member_code = $this->request->get('mkid');
if (!$member_code) {
throw new \Exception("mkid 값이 정의되지 않았습니다.");
}
$member = $this->getMemberService()->getEntityByCode($member_code);
if (!$member) {
throw new \Exception("[$member_code]에 해당하는 관리자정보가 존재하지 않습니다.");
}
//onetime_sub 도메인 구매 수량
$coupon = $this->request->get('coupon');
if (! $coupon || $coupon < 1) {
throw new \Exception("도메인 구매 수량 값이 정의되지 않았거나, 도메인 구매 수량은 1개 이상이어야 합니다.");
}
//onetime_note 도메인 구매 수량
$note = $this->request->get('note'); $note = $this->request->get('note');
if (!$note) { // //onetime_case 사용용도
throw new \Exception("도메인 리스트 값이 정의되지 않았습니다."); // $onetime_case = $this->request->get('onetime_case', 'point');
} // //onetime_request_date 사용일
//onetime_case 사용용도 // $onetime_request_date = $this->request->get('onetime_request_date') ?? date("Y-m-d");
$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 { try {
$this->getPointService()->beginTransaction(); $formDatas = [
//서비스쿠폰 갯수 수정 'client_code' => $client_code,
$this->getPointService()->usePointForDomain($service, $coupon); 'member_code' => $member_code,
//쿠폰 사용내역 onetime에 등록 'type' => $type,
$this->getOnetimeService()->usePointForDomain($service, $client, $member, $onetime_case, $coupon, $note, $onetime_request_date); 'title' => $title,
//쿠폰 사용내역 history에 등록 'amount' => $amount,
$this->getHistoryService()->usePointForDomain($service, $client, $onetime_case, $coupon, $note, $onetime_request_date);; 'note' => $note
$this->getPointService()->commit(); ];
return $this->redirect->to(DBMS_SITE_URL . "/IdcPointUseMK.cup?client_code=" . $service->getClientCode()); $this->getServiceService()->beginTransaction();
// //서비스포인트 갯수 수정
// $this->getServiceService()->usePointByService($service, $point);
// //포인트 사용내역 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);;
$this->getPointService()->getModel()->insert($formDatas);
$this->getServiceService()->commit();
return $this->redirect->to(DBMS_SITE_URL . "/IdcPointList.cup")->with('success', ['message' => '포인트 작업이 완료되었습니다.']);
} catch (\Exception $e) { } catch (\Exception $e) {
$this->getPointService()->rollback(); $this->getServiceService()->rollback();
return $this->redirect->back()->withInput()->with('error', ['message' => '쿠폰 사용에 실패하였습니다.:' . $e->getMessage()]); return $this->redirect->back()->withInput()->with('error', ['message' => '포인트 사용에 실패하였습니다.:' . $e->getMessage()]);
} }
} }
} //Class } //Class

View File

@ -176,21 +176,22 @@ class DashboardController extends DBMSController
//WEB 접속방법 : http://localhost/site/dashboard/cscount/service_code/서비스코드/client_code/고객코드 //WEB 접속방법 : http://localhost/site/dashboard/cscount/service_code/서비스코드/client_code/고객코드
public function cscount(): string public function cscount(): string
{ {
//서비스정보
$service_code = $this->request->get('service_code'); $service_code = $this->request->get('service_code');
if (!$service_code) { // echo "service_code:" . $service_code;
throw new \Exception("service_code 값이 정의되지 않았습니다."); if ($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;
} }
$this->getServiceService()->getModel()->where('service_code', $service_code);
$service = $this->getServiceService()->getEntity();
if (!$service) {
throw new \Exception("[$service_code]에 해당하는 서비스정보가 존재하지 않습니다.");
}
$this->service = $service;
//VPC정보갯수 //VPC정보갯수
$this->getVPCService()->getModel()->where('service_code', $service->getServiceCode()); $this->getVPCService()->getModel()->where('service_code', $this->service->getServiceCode());
$this->vpc = $this->getVPCService()->getCount(); $this->vpc = $this->getVPCService()->getCount();
//KCS정보갯수 //KCS정보갯수
$this->getKCSService()->getModel()->where('service_code', $service->getServiceCode()); $this->getKCSService()->getModel()->where('service_code', $this->service->getServiceCode());
$this->kcs = $this->getKCSService()->getCount(); $this->kcs = $this->getKCSService()->getCount();
return $this->render(__FUNCTION__); return $this->render(__FUNCTION__);
} }
@ -199,14 +200,16 @@ class DashboardController extends DBMSController
//WEB 접속방법 : http://localhost/site/dashboard/cscount/service_code/서비스코드/client_code/고객코드 //WEB 접속방법 : http://localhost/site/dashboard/cscount/service_code/서비스코드/client_code/고객코드
public function coupon(): string public function coupon(): string
{ {
//서비스정보
$service_code = $this->request->get('service_code'); $service_code = $this->request->get('service_code');
if (!$service_code) { // echo "service_code:" . $service_code;
throw new \Exception("service_code 값이 정의되지 않았습니다."); if ($service_code) {
} $this->getServiceService()->getModel()->where($this->getServiceService()->getModel()::PKField, $service_code);
$this->getServiceService()->getModel()->where('service_code', $service_code); $service = $this->getServiceService()->getEntity();
$this->entity = $this->getServiceService()->getEntity(); if (!$service) {
if (!$this->entity) { throw new \Exception("[$service_code]에 해당하는 서비스정보가 존재하지 않습니다.");
throw new \Exception("[$service_code]에 해당하는 서비스정보가 존재하지 않습니다."); }
$this->service = $service;
} }
return $this->render(__FUNCTION__); return $this->render(__FUNCTION__);
} }

View File

@ -5,7 +5,6 @@ namespace lib\Controllers\DBMS;
use lib\Entities\GearlistEntity; use lib\Entities\GearlistEntity;
use lib\Services\GearlistService; use lib\Services\GearlistService;
use lib\Services\ServerService; use lib\Services\ServerService;
use lib\Utils\Pagination;
class GearlistController extends DBMSController class GearlistController extends DBMSController
{ {

View File

@ -17,4 +17,8 @@ abstract class Entity
{ {
$this->_values[$name] = $value; $this->_values[$name] = $value;
} }
final public function toArray(): array
{
return $this->_values;
}
} //Class } //Class

View File

@ -60,13 +60,17 @@ abstract class CommonService extends Core
return [$total, $entities]; return [$total, $entities];
} }
public function insert(array $formData): int protected function insert(array $formData): mixed
{ {
$insertId = $this->getModel()->insert($formData); $insertId = $this->getModel()->insert($formData);
if (!$insertId) { if (!$insertId) {
throw new \Exception("Insert Error : " . $this->getModel()->getLastError()); throw new \Exception("Insert Error : " . $this->getModel()->getLastError());
} }
return $insertId; $entityClass = $this->getEntityClass();
$entity = new $entityClass($formData);
$pkField = $this->getModel()::PKFIELD;
$entity->$pkField = $insertId;
return $entity;
} // } //
//transaction관련련 //transaction관련련

View File

@ -32,21 +32,6 @@ class OnetimeService extends CommonService
return Entity::class; return Entity::class;
} }
// //Coupon 리스트
// public function getEntitiesForDomainCoupon_Test(int $curPage, int $perPage): array
// {
// $this->getModel()->like(["onetime_case" => "%domain%"]);
// $this->getModel()->orderBy("onetime_request_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);
// $entities = $this->getEntities();
// return [$total, $this->getEntities()];
// }
//도메인쿠폰 사용용 //도메인쿠폰 사용용
public function useCouponByService(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
{ {

View File

@ -27,4 +27,9 @@ class PointService extends CommonService
{ {
return Entity::class; return Entity::class;
} }
}
public function insert(array $formDatas): Entity
{
return parent::insert($formDatas);
} //insert
} //Class

View File

@ -89,7 +89,8 @@ 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;
} //도메인쿠폰 Reset }
//도메인쿠폰 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

@ -1,5 +1,5 @@
<?php if ($this->client) { ?> <?php if ($this->client) { ?>
<h3>고객명 : <a href="/serviceDetail.sev?client_code=<?= $this->client->getClientCode() ?>"><?= $this->client->getTitle() ?></a> / 쿠폰발급대상 : <?= count($this->services) ?> 대 / 전체 남은 수량 : <?= $this->total_coupon; ?> 개</h3> <h3>고객명 : <a href="/serviceDetail.sev?client_code=<?= $this->client->getClientCode() ?>"><?= $this->client->getTitle() ?></a> / 쿠폰발급대상 : <?= count($this->entities) ?> 대 / 전체 남은 수량 : <?= $this->total_coupon; ?> 개</h3>
<?php } ?> <?php } ?>
<div class="table-responsive" id="table"> <div class="table-responsive" id="table">
<input type="hidden" id="token"> <input type="hidden" id="token">
@ -20,19 +20,19 @@
</thead> </thead>
<tbody> <tbody>
<?php $i = 0; ?> <?php $i = 0; ?>
<?php foreach ($this->services as $service) { ?> <?php foreach ($this->entities as $entity) { ?>
<?php $num = count($this->services) - $i; ?> <?php $num = count($this->entities) - $i; ?>
<tr> <tr>
<td><?= $num ?></td> <td><?= $num ?></td>
<td><a href="/serviceDetailSolo.sev?client_code=<?= $service->getClientCode() ?>&service_code=<?= $service->getServiceCode() ?>"><?= $service->getServiceCode() ?></td> <td><a href="/serviceDetailSolo.sev?client_code=<?= $entity->getClientCode() ?>&service_code=<?= $entity->getServiceCode() ?>"><?= $entity->getServiceCode() ?></td>
<td><?= $service->getServerCode() ?></td> <td><?= $entity->getServerCode() ?></td>
<td><?= $service->service_ip ?></td> <td><?= $entity->service_ip ?></td>
<td><?= $service->service_open_date ?></td> <td><?= $entity->service_open_date ?></td>
<td><?= $service->service_line ?></td> <td><?= $entity->service_line ?></td>
<td><?= $service->getCoupon() + $service->getUsedCoupon() ?></td> <td><?= $entity->getCoupon() + $entity->getUsedCoupon() ?></td>
<td onclick="location.href='/IdcCouponBuyMK.cup?service_code=<?= $service->getServiceCode() ?>" style=" cursor: pointer;"><?= $service->getCoupon() ?></td> <td onclick="location.href='/IdcCouponBuyMK.cup?service_code=<?= $entity->getServiceCode() ?>" style=" cursor: pointer;"><?= $entity->getCoupon() ?></td>
<td><?= $service->getUsedCoupon() ?></td> <td><?= $entity->getUsedCoupon() ?></td>
<td><a href="/IdcCouponBuyMK.cup?service_code=<?= $service->getServiceCode() ?>&mkid=<?= $this->member ? $this->member->getPK() : "" ?>"><?= !$service->getCoupon() ? "사용완료" : "사용하기" ?></a></td> <td><a href="/IdcCouponBuyMK.cup?service_code=<?= $entity->getServiceCode() ?>&mkid=<?= $this->member ? $this->member->getPK() : "" ?>"><?= !$entity->getCoupon() ? "사용완료" : "사용하기" ?></a></td>
</tr> </tr>
<?php $i++; ?> <?php $i++; ?>
<?php } ?> <?php } ?>

View File

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

View File

@ -1,44 +0,0 @@
<h3>고객명 : <a href="/serviceDetail.sev?client_code=<?= $this->client->getClientCode() ?>"><?= $this->client->getTitle() ?></a> / 쿠폰발급대상 : <?= count($this->services) ?> 대 / 전체 남은 수량 : <?= $this->total_coupon; ?> 개</h3>
<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; ?>
<?php foreach ($this->services as $service) { ?>
<?php $num = count($this->services) - $i; ?>
<tr>
<td><?= $num ?></td>
<td><a href="/serviceDetailSolo.sev?client_code=<?= $service->getClientCode() ?>&service_code=<?= $service->getServiceCode() ?>"><?= $service->getServiceCode() ?></td>
<td><?= $service->getServerCode() ?></td>
<td><?= $service->service_ip ?></td>
<td><?= $service->service_open_date ?></td>
<td><?= $service->service_line ?></td>
<td><?= $service->getCoupon() + $service->getUsedCoupon() ?></td>
<td onclick="location.href='/IdcCouponBuyMK.cup?service_code=<?= $service->getServiceCode() ?>&mkid=<?= $this->member->getPK() ?>'" style=" cursor: pointer;"><?= $service->getCoupon() ?></td>
<td><?= $service->getUsedCoupon() ?></td>
<?php if (!$service->getCoupon()) { ?>
<td><a href="/IdcCouponBuyMK.cup?service_code=<?= $service->getServiceCode() ?>&mkid=<?= $this->member->getPK() ?>">사용완료</a></td>
<?php } else { ?>
<td><a href="/IdcCouponBuyMK.cup?service_code=<?= $service->getServiceCode() ?>&mkid=<?= $this->member->getPK() ?>">사용하기</a></td>
<?php } ?>
</tr>
<?php $i++; ?>
<?php } ?>
</tbody>
</table>
</div>
<div align='center'><?= $this->pagination->render(DBMS_SITE_URL . "/IdcCouponUseMK.cup", ['client_code' => $this->client->getClientCode(), 'member_code' => $this->member->getPK(), 'curPage' => $this->curPage, 'perPage' => $this->perPage]) ?></div>

View File

@ -4,23 +4,21 @@
<thead> <thead>
<tr> <tr>
<th style="text-align:center;">No</th> <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;">서버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> <th style="text-align:center;">작업일</th>
<th style="text-align:center;">쿠폰 잔량수</th>
<th style="text-align:center;">쿠폰 사용수</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php $i = 0; ?> <?php $i = 0; ?>
<?php foreach ($this->services as $service) { ?> <?php foreach ($this->entities as $entity) { ?>
<?php $num = count($this->services) - $i; ?> <?php $num = count($this->entities) - $i; ?>
<tr> <tr>
<td><?= $num ?></td> <td><?= $num ?></td>
<td><a href="/serviceDetailSolo.sev?client_code=<?= $service->getClientCode() ?>&service_code=<?= $service->getServiceCode() ?>"><?= $service->getServiceCode() ?></td> <td><?= $this->client->getServiceCode() ?></td>
<td><?= $service->getServerCode() ?></td> <td><?= $service->getServerCode() ?></td>
<td><?= $service->service_ip ?></td> <td><?= $service->service_ip ?></td>
<td><?= $service->service_open_date ?></td> <td><?= $service->service_open_date ?></td>

View File

@ -8,8 +8,8 @@
<td colspan="5"><?= $this->client->getTitle() ?></td> <td colspan="5"><?= $this->client->getTitle() ?></td>
</tr> </tr>
<tr> <tr>
<td>서비스코드</td> <td>형식</td>
<td colspan="5"><?= $this->service->getServiceCode() ?></td> <td colspan="5"><?= $this->client->getServiceCode() ?></td>
</tr> </tr>
<tr> <tr>
<td>장비번호</td> <td>장비번호</td>

View File

@ -1 +1 @@
<a href="/IdcCouponUseMK.cup?client_code=<?= $this->client_code ?>" onclick=" location.href='/IdcCouponUseMK.cup?client_code=<?= $this->client_code ?>'" style="cursor: pointer;\"><?= $this->entity->coupon ?>개</a> <a href="/IdcCouponUseMK.cup?client_code=<?= $this->client_code ?>" onclick=" location.href='/IdcCouponUseMK.cup?client_code=<?= $this->client_code ?>'" style="cursor: pointer;\"><?= $this->service->coupon ?>개</a>