dbms_primeidc_init...1
This commit is contained in:
parent
539d5135c1
commit
1a5f258950
@ -6,6 +6,7 @@ use lib\Controllers\DBMS\Client\ClientController;
|
||||
use lib\Controllers\DBMS\Client\CouponController;
|
||||
use lib\Controllers\DBMS\Client\MemoController;
|
||||
use lib\Controllers\DBMS\Client\PaymentController;
|
||||
use lib\Controllers\DBMS\Client\PointController;
|
||||
use lib\Controllers\DBMS\DashboardController;
|
||||
use lib\Controllers\DBMS\DefenceController;
|
||||
use lib\Controllers\DBMS\GearlistController;
|
||||
@ -51,6 +52,24 @@ $router->group('dbms/client', function (Router $router) {
|
||||
// Response::view($result);
|
||||
});
|
||||
});
|
||||
//Point관련
|
||||
$router->group('point', function (Router $router) {
|
||||
$router->add('GET', 'index', function ($params) {
|
||||
$controller = new PointController($params);
|
||||
return $controller->index();
|
||||
// Response::view($result);
|
||||
});
|
||||
$router->add('GET', 'insert_form', function ($params) {
|
||||
$controller = new PointController($params);
|
||||
return $controller->insert_form();
|
||||
// Response::view($result);
|
||||
});
|
||||
$router->add('POST', 'insert', function ($params) {
|
||||
$controller = new PointController($params);
|
||||
return $controller->insert();
|
||||
// Response::view($result);
|
||||
});
|
||||
});
|
||||
//결제관련
|
||||
$router->group('payment', function (Router $router) {
|
||||
$router->add('GET', 'index', function ($params) {
|
||||
|
||||
@ -2,14 +2,14 @@
|
||||
|
||||
namespace lib\Controllers\DBMS\Client;
|
||||
|
||||
use lib\Services\ClientService;
|
||||
use lib\Controllers\DBMS\DBMSController;
|
||||
use lib\Services\ClientService;
|
||||
use lib\Services\MemberService;
|
||||
|
||||
class ClientController extends DBMSController
|
||||
{
|
||||
|
||||
private ?ClientService $_clientService = null;
|
||||
|
||||
private ?MemberService $_memberService = null;
|
||||
public function __construct(array $params = [])
|
||||
{
|
||||
parent::__construct($params);
|
||||
@ -22,16 +22,66 @@ class ClientController extends DBMSController
|
||||
}
|
||||
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
|
||||
//CLI 접속방법 : php index.php site/client/totalcount/client_code/코드번호
|
||||
//WEB 접속방법 : http://localhost/site/client/totalcount/client_code/코드번호
|
||||
public function totalcount()
|
||||
{
|
||||
//사용자정보
|
||||
//사용자정보
|
||||
$client_code = $this->request->get('client_code');
|
||||
// echo "Client_Code:" . $client_code;
|
||||
if ($client_code) {
|
||||
$this->getClientService()->getModel()->where('Client_Code', $client_code);
|
||||
$client = $this->getClientService()->getEntity();
|
||||
if (!$client) {
|
||||
throw new \Exception("[$client_code]에 해당하는 고객정보가 존재하지 않습니다.");
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
namespace lib\Controllers\DBMS\Client;
|
||||
|
||||
use lib\Services\HistoryService;
|
||||
use lib\Services\MemberService;
|
||||
use lib\Services\OnetimeService;
|
||||
use lib\Utils\Pagination;
|
||||
|
||||
@ -11,19 +10,11 @@ class CouponController extends ClientController
|
||||
{
|
||||
private ?OnetimeService $_onetimeService = null;
|
||||
private ?HistoryService $_historyService = null;
|
||||
private ?MemberService $_memberService = null;
|
||||
public function __construct(array $params = [])
|
||||
{
|
||||
parent::__construct($params);
|
||||
$this->getView()->setPath('coupon');
|
||||
} //
|
||||
public function getMemberService(): MemberService
|
||||
{
|
||||
if ($this->_memberService === null) {
|
||||
$this->_memberService = new MemberService();
|
||||
}
|
||||
return $this->_memberService;
|
||||
}
|
||||
public function getOnetimeService(): OnetimeService
|
||||
{
|
||||
if ($this->_onetimeService === null) {
|
||||
@ -44,34 +35,19 @@ class CouponController extends ClientController
|
||||
//WEB 접속방법 : http://localhost/site/client/coupon/index
|
||||
public function index()
|
||||
{
|
||||
//사용자정보
|
||||
$client_code = $this->request->get('client_code');
|
||||
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;
|
||||
}
|
||||
//기본적으로 필요한 client_code, mkid, service_code를 설정합니다.
|
||||
list($client_code, $member_code, $service_code) = $this->setDefaultRequestData();
|
||||
//사용자별 쿠폰내역
|
||||
$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->perPage = intval($this->request->get('perPage', VIEW_LIST_PERPAGE));
|
||||
[$this->total, $this->entities] = $this->getServiceService()->getList($this->curPage, $this->perPage);
|
||||
$this->pagination = new Pagination($this->total, (int)$this->curPage, (int)$this->perPage);
|
||||
$total_coupon = 0;
|
||||
foreach ($this->services as $service) {
|
||||
$total_coupon += $service->getCoupon();
|
||||
foreach ($this->entities as $entity) {
|
||||
$total_coupon += $entity->getCoupon();
|
||||
}
|
||||
$this->total_coupon = $total_coupon;
|
||||
return $this->render(__FUNCTION__);
|
||||
@ -82,34 +58,8 @@ class CouponController extends ClientController
|
||||
//WEB 접속방법 : http://localhost/site/client/coupon/insert_form
|
||||
public function insert_form()
|
||||
{
|
||||
$service_code = $this->request->get('service_code');
|
||||
if (!$service_code) {
|
||||
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;
|
||||
//기본적으로 필요한 client_code, mkid, service_code를 설정합니다.
|
||||
list($client_code, $member_code, $service_code) = $this->setDefaultRequestData();
|
||||
$this->today = date("Y-m-d");
|
||||
return $this->render(__FUNCTION__);
|
||||
}
|
||||
@ -119,31 +69,8 @@ class CouponController extends ClientController
|
||||
//WEB 접속방법 : http://localhost/site/client/coupon/insert_form
|
||||
public function insert()
|
||||
{
|
||||
$service_code = $this->request->get('service_code');
|
||||
if (!$service_code) {
|
||||
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]에 해당하는 관리자정보가 존재하지 않습니다.");
|
||||
}
|
||||
//기본적으로 필요한 client_code, mkid, service_code를 설정합니다.
|
||||
list($client_code, $member_code, $service_code) = $this->setDefaultRequestData();
|
||||
//onetime_sub 도메인 구매 수량
|
||||
$coupon = $this->request->get('coupon');
|
||||
if (! $coupon || $coupon < 1) {
|
||||
@ -161,13 +88,13 @@ class CouponController extends ClientController
|
||||
try {
|
||||
$this->getServiceService()->beginTransaction();
|
||||
//서비스쿠폰 갯수 수정
|
||||
$this->getServiceService()->useCouponByService($service, $coupon);
|
||||
$this->getServiceService()->useCouponByService($this->service, $coupon);
|
||||
//쿠폰 사용내역 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에 등록
|
||||
$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();
|
||||
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) {
|
||||
$this->getServiceService()->rollback();
|
||||
return $this->redirect->back()->withInput()->with('error', ['message' => '쿠폰 사용에 실패하였습니다.:' . $e->getMessage()]);
|
||||
|
||||
@ -17,29 +17,15 @@ class MemoController extends ClientController
|
||||
//WEB 접속방법 : http://localhost/site/client/memo/update_form/client_code/코드번호
|
||||
public function update_form()
|
||||
{
|
||||
//사용자정보
|
||||
$client_code = $this->request->get('client_code');
|
||||
if ($client_code) {
|
||||
$client = $this->getClientService()->getEntity();
|
||||
if (!$client) {
|
||||
throw new \Exception("[$client_code]에 해당하는 고객정보보가 존재하지 않습니다.");
|
||||
}
|
||||
$this->client = $client;
|
||||
}
|
||||
//기본적으로 필요한 client_code, mkid, service_code를 설정합니다.
|
||||
list($client_code, $member_code, $service_code) = $this->setDefaultRequestData();
|
||||
return $this->render(__FUNCTION__);
|
||||
}
|
||||
|
||||
public function update()
|
||||
{
|
||||
//사용자정보
|
||||
$client_code = $this->request->get('client_code');
|
||||
if ($client_code) {
|
||||
$client = $this->getClientService()->getEntity();
|
||||
if (!$client) {
|
||||
throw new \Exception("[$client_code]에 해당하는 고객정보보가 존재하지 않습니다.");
|
||||
}
|
||||
$this->client = $client;
|
||||
}
|
||||
//기본적으로 필요한 client_code, mkid, service_code를 설정합니다.
|
||||
list($client_code, $member_code, $service_code) = $this->setDefaultRequestData();
|
||||
return $this->render(__FUNCTION__);
|
||||
}
|
||||
} //Class
|
||||
|
||||
@ -17,24 +17,8 @@ class PaymentController extends ClientController
|
||||
//WEB 접속방법 : http://localhostsite/client/payment/billpaper
|
||||
public function billpaper(): string
|
||||
{
|
||||
//사이트 정보 가져오기
|
||||
$sitekey = $this->request->get('sitekey');
|
||||
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;
|
||||
}
|
||||
//기본적으로 필요한 client_code, mkid, service_code를 설정합니다.
|
||||
list($client_code, $member_code, $service_code) = $this->setDefaultRequestData();
|
||||
return $this->render(__FUNCTION__);
|
||||
}
|
||||
//미납리스트트, NonPaymentList.php
|
||||
|
||||
@ -2,14 +2,16 @@
|
||||
|
||||
namespace lib\Controllers\DBMS\Client;
|
||||
|
||||
use lib\Services\MemberService;
|
||||
use lib\Services\HistoryService;
|
||||
use lib\Services\OnetimeService;
|
||||
use lib\Services\PointService;
|
||||
use lib\Utils\Pagination;
|
||||
|
||||
class PointController extends ClientController
|
||||
{
|
||||
private ?PointService $_pointService = null;
|
||||
private ?MemberService $_memberService = null;
|
||||
private ?OnetimeService $_onetimeService = null;
|
||||
private ?HistoryService $_historyService = null;
|
||||
public function __construct(array $params = [])
|
||||
{
|
||||
parent::__construct($params);
|
||||
@ -22,141 +24,103 @@ class PointController extends ClientController
|
||||
}
|
||||
return $this->_pointService;
|
||||
}
|
||||
public function getMemberService(): MemberService
|
||||
public function getOnetimeService(): OnetimeService
|
||||
{
|
||||
if ($this->_memberService === null) {
|
||||
$this->_memberService = new MemberService();
|
||||
if ($this->_onetimeService === null) {
|
||||
$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
|
||||
//CLI 접속방법 : php index.php site/client/counpon/index
|
||||
//WEB 접속방법 : http://localhost/site/client/coupon/index
|
||||
//IdcPointListMK.jsp -> domain_point.php
|
||||
//CLI 접속방법 : php index.php site/client/point/index
|
||||
//WEB 접속방법 : http://localhost/site/client/point/index
|
||||
public function index()
|
||||
{
|
||||
//사용자정보
|
||||
//전체 고객객정보
|
||||
$this->clients = $this->getClientService()->getEntities();
|
||||
//전체 관리자정보(등록자)
|
||||
$this->members = $this->getMemberService()->getEntities();
|
||||
//사용자별 포인트내역
|
||||
$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;
|
||||
$this->getPointService()->getModel()->where('client_code', $client_code);
|
||||
}
|
||||
//관리자정보(등록자)
|
||||
$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->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);
|
||||
$total_coupon = 0;
|
||||
foreach ($this->services as $service) {
|
||||
$total_coupon += $service->getPoint();
|
||||
}
|
||||
$this->total_coupon = $total_coupon;
|
||||
return $this->render(__FUNCTION__);
|
||||
}
|
||||
|
||||
//IdcPointBuyMK.jsp -> domain_coupon_buy.php
|
||||
//CLI 접속방법 : php index.php site/client/counpon/insert_form
|
||||
//WEB 접속방법 : http://localhost/site/client/coupon/insert_form
|
||||
//IdcPointBuyMK.jsp -> domain_point_buy.php
|
||||
//CLI 접속방법 : php index.php site/client/point/insert_form
|
||||
//WEB 접속방법 : http://localhost/site/client/point/insert_form
|
||||
public function insert_form()
|
||||
{
|
||||
$service_code = $this->request->get('service_code');
|
||||
if (!$service_code) {
|
||||
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;
|
||||
//기본적으로 필요한 client_code, mkid, service_code를 설정합니다.
|
||||
list($client_code, $member_code, $service_code) = $this->setDefaultRequestData();
|
||||
$this->today = date("Y-m-d");
|
||||
return $this->render(__FUNCTION__);
|
||||
}
|
||||
|
||||
//IdcPointBuyMK.jsp -> domain_coupon_buy.php
|
||||
//CLI 접속방법 : php index.php site/client/counpon/insert_form
|
||||
//WEB 접속방법 : http://localhost/site/client/coupon/insert_form
|
||||
//IdcPointBuyMK.jsp -> domain_point_buy.php
|
||||
//CLI 접속방법 : php index.php site/client/point/insert_form
|
||||
//WEB 접속방법 : http://localhost/site/client/point/insert_form
|
||||
public function insert()
|
||||
{
|
||||
$service_code = $this->request->get('service_code');
|
||||
if (!$service_code) {
|
||||
throw new \Exception("service_code 값이 정의되지 않았습니다.");
|
||||
//기본적으로 필요한 client_code, mkid, service_code를 설정합니다.
|
||||
list($client_code, $member_code, $service_code) = $this->setDefaultRequestData();
|
||||
//포인트 형식
|
||||
$type = $this->request->get('type');
|
||||
if (!$type) {
|
||||
throw new \Exception("포인트 형식이 정의되지 않았습니다.");
|
||||
}
|
||||
$service = $this->getPointService()->getEntityByCode($service_code);
|
||||
if (!$service) {
|
||||
throw new \Exception("[$service_code]에 해당하는 서비스정보가 존재하지 않습니다.");
|
||||
//포인트 제목
|
||||
$title = $this->request->get('title');
|
||||
if (!$title) {
|
||||
throw new \Exception("포인트 제목이 정의되지 않았습니다.");
|
||||
}
|
||||
//사용자정보
|
||||
$client = $this->getClientService()->getEntityByCode($service->getClientCode());
|
||||
if (!$client) {
|
||||
throw new \Exception("[{$service->getClientCode()}]에 해당하는 사용자정보가 존재하지 않습니다.");
|
||||
//포인트 값
|
||||
$amount = intval($this->request->get('amount'));
|
||||
if (! $amount || $amount < 1) {
|
||||
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');
|
||||
if (!$note) {
|
||||
throw new \Exception("도메인 리스트 값이 정의되지 않았습니다.");
|
||||
}
|
||||
//onetime_case 사용용도
|
||||
$onetime_case = $this->request->get('onetime_case', 'domain');
|
||||
//onetime_request_date 사용일
|
||||
$onetime_request_date = $this->request->get('onetime_request_date') ?? date("Y-m-d");
|
||||
// //onetime_case 사용용도
|
||||
// $onetime_case = $this->request->get('onetime_case', 'point');
|
||||
// //onetime_request_date 사용일
|
||||
// $onetime_request_date = $this->request->get('onetime_request_date') ?? date("Y-m-d");
|
||||
try {
|
||||
$this->getPointService()->beginTransaction();
|
||||
//서비스쿠폰 갯수 수정
|
||||
$this->getPointService()->usePointForDomain($service, $coupon);
|
||||
//쿠폰 사용내역 onetime에 등록
|
||||
$this->getOnetimeService()->usePointForDomain($service, $client, $member, $onetime_case, $coupon, $note, $onetime_request_date);
|
||||
//쿠폰 사용내역 history에 등록
|
||||
$this->getHistoryService()->usePointForDomain($service, $client, $onetime_case, $coupon, $note, $onetime_request_date);;
|
||||
$this->getPointService()->commit();
|
||||
return $this->redirect->to(DBMS_SITE_URL . "/IdcPointUseMK.cup?client_code=" . $service->getClientCode());
|
||||
$formDatas = [
|
||||
'client_code' => $client_code,
|
||||
'member_code' => $member_code,
|
||||
'type' => $type,
|
||||
'title' => $title,
|
||||
'amount' => $amount,
|
||||
'note' => $note
|
||||
];
|
||||
$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) {
|
||||
$this->getPointService()->rollback();
|
||||
return $this->redirect->back()->withInput()->with('error', ['message' => '쿠폰 사용에 실패하였습니다.:' . $e->getMessage()]);
|
||||
$this->getServiceService()->rollback();
|
||||
return $this->redirect->back()->withInput()->with('error', ['message' => '포인트 사용에 실패하였습니다.:' . $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
} //Class
|
||||
|
||||
@ -176,21 +176,22 @@ class DashboardController extends DBMSController
|
||||
//WEB 접속방법 : http://localhost/site/dashboard/cscount/service_code/서비스코드/client_code/고객코드
|
||||
public function cscount(): string
|
||||
{
|
||||
//서비스정보
|
||||
$service_code = $this->request->get('service_code');
|
||||
if (!$service_code) {
|
||||
throw new \Exception("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;
|
||||
}
|
||||
$this->getServiceService()->getModel()->where('service_code', $service_code);
|
||||
$service = $this->getServiceService()->getEntity();
|
||||
if (!$service) {
|
||||
throw new \Exception("[$service_code]에 해당하는 서비스정보가 존재하지 않습니다.");
|
||||
}
|
||||
$this->service = $service;
|
||||
//VPC정보갯수
|
||||
$this->getVPCService()->getModel()->where('service_code', $service->getServiceCode());
|
||||
$this->getVPCService()->getModel()->where('service_code', $this->service->getServiceCode());
|
||||
$this->vpc = $this->getVPCService()->getCount();
|
||||
//KCS정보갯수
|
||||
$this->getKCSService()->getModel()->where('service_code', $service->getServiceCode());
|
||||
$this->getKCSService()->getModel()->where('service_code', $this->service->getServiceCode());
|
||||
$this->kcs = $this->getKCSService()->getCount();
|
||||
return $this->render(__FUNCTION__);
|
||||
}
|
||||
@ -199,14 +200,16 @@ class DashboardController extends DBMSController
|
||||
//WEB 접속방법 : http://localhost/site/dashboard/cscount/service_code/서비스코드/client_code/고객코드
|
||||
public function coupon(): string
|
||||
{
|
||||
//서비스정보
|
||||
$service_code = $this->request->get('service_code');
|
||||
if (!$service_code) {
|
||||
throw new \Exception("service_code 값이 정의되지 않았습니다.");
|
||||
}
|
||||
$this->getServiceService()->getModel()->where('service_code', $service_code);
|
||||
$this->entity = $this->getServiceService()->getEntity();
|
||||
if (!$this->entity) {
|
||||
throw new \Exception("[$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 $this->render(__FUNCTION__);
|
||||
}
|
||||
|
||||
@ -5,7 +5,6 @@ namespace lib\Controllers\DBMS;
|
||||
use lib\Entities\GearlistEntity;
|
||||
use lib\Services\GearlistService;
|
||||
use lib\Services\ServerService;
|
||||
use lib\Utils\Pagination;
|
||||
|
||||
class GearlistController extends DBMSController
|
||||
{
|
||||
|
||||
@ -17,4 +17,8 @@ abstract class Entity
|
||||
{
|
||||
$this->_values[$name] = $value;
|
||||
}
|
||||
final public function toArray(): array
|
||||
{
|
||||
return $this->_values;
|
||||
}
|
||||
} //Class
|
||||
|
||||
@ -60,13 +60,17 @@ abstract class CommonService extends Core
|
||||
return [$total, $entities];
|
||||
}
|
||||
|
||||
public function insert(array $formData): int
|
||||
protected function insert(array $formData): mixed
|
||||
{
|
||||
$insertId = $this->getModel()->insert($formData);
|
||||
if (!$insertId) {
|
||||
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관련련
|
||||
|
||||
@ -32,21 +32,6 @@ class OnetimeService extends CommonService
|
||||
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
|
||||
{
|
||||
|
||||
@ -27,4 +27,9 @@ class PointService extends CommonService
|
||||
{
|
||||
return Entity::class;
|
||||
}
|
||||
}
|
||||
|
||||
public function insert(array $formDatas): Entity
|
||||
{
|
||||
return parent::insert($formDatas);
|
||||
} //insert
|
||||
} //Class
|
||||
|
||||
@ -89,7 +89,8 @@ class ServiceService extends CommonService
|
||||
$this->getModel()->where("service_code", $service->getServiceCode());
|
||||
$this->getModel()->update(["coupon=(coupon-{$coupon})" => null, "coupon_use=(coupon_use+{$coupon})" => null]);
|
||||
return true;
|
||||
} //도메인쿠폰 Reset
|
||||
}
|
||||
//도메인쿠폰 Reset
|
||||
public function resetCouponByClient(ClientEntity $client, int $coupon): bool
|
||||
{
|
||||
if ($coupon < 0) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?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 } ?>
|
||||
<div class="table-responsive" id="table">
|
||||
<input type="hidden" id="token">
|
||||
@ -20,19 +20,19 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $i = 0; ?>
|
||||
<?php foreach ($this->services as $service) { ?>
|
||||
<?php $num = count($this->services) - $i; ?>
|
||||
<?php foreach ($this->entities as $entity) { ?>
|
||||
<?php $num = count($this->entities) - $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() ?>" style=" cursor: pointer;"><?= $service->getCoupon() ?></td>
|
||||
<td><?= $service->getUsedCoupon() ?></td>
|
||||
<td><a href="/IdcCouponBuyMK.cup?service_code=<?= $service->getServiceCode() ?>&mkid=<?= $this->member ? $this->member->getPK() : "" ?>"><?= !$service->getCoupon() ? "사용완료" : "사용하기" ?></a></td>
|
||||
<td><a href="/serviceDetailSolo.sev?client_code=<?= $entity->getClientCode() ?>&service_code=<?= $entity->getServiceCode() ?>"><?= $entity->getServiceCode() ?></td>
|
||||
<td><?= $entity->getServerCode() ?></td>
|
||||
<td><?= $entity->service_ip ?></td>
|
||||
<td><?= $entity->service_open_date ?></td>
|
||||
<td><?= $entity->service_line ?></td>
|
||||
<td><?= $entity->getCoupon() + $entity->getUsedCoupon() ?></td>
|
||||
<td onclick="location.href='/IdcCouponBuyMK.cup?service_code=<?= $entity->getServiceCode() ?>" style=" cursor: pointer;"><?= $entity->getCoupon() ?></td>
|
||||
<td><?= $entity->getUsedCoupon() ?></td>
|
||||
<td><a href="/IdcCouponBuyMK.cup?service_code=<?= $entity->getServiceCode() ?>&mkid=<?= $this->member ? $this->member->getPK() : "" ?>"><?= !$entity->getCoupon() ? "사용완료" : "사용하기" ?></a></td>
|
||||
</tr>
|
||||
<?php $i++; ?>
|
||||
<?php } ?>
|
||||
|
||||
@ -1,14 +1,16 @@
|
||||
<form method="post" action="<?= $this->helper->baseUrl() ?>/insert">
|
||||
<input type="hidden" name="client_code" value="<?= $this->client->getClientCode() ?>">
|
||||
<table width="100%" cellpadding="0" cellspacing="0" border="0" style="margin-bottom:0px">
|
||||
<tr>
|
||||
<td width="18%">
|
||||
<div align="center"><strong>비 고</strong></div>
|
||||
</td>
|
||||
<td width="72%"><textarea rows="7" cols="120" name="msg"><?= $this->client->getNote() ?></textarea></td>
|
||||
<td width="10%">
|
||||
<div align="center"><input type="submit" value="저장" /></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<?php if ($this->client) { ?>
|
||||
<form method="post" action="<?= $this->helper->baseUrl() ?>/insert">
|
||||
<input type="hidden" name="client_code" value="<?= $this->client->getClientCode() ?>">
|
||||
<table width="100%" cellpadding="0" cellspacing="0" border="0" style="margin-bottom:0px">
|
||||
<tr>
|
||||
<td width="18%">
|
||||
<div align="center"><strong>비 고</strong></div>
|
||||
</td>
|
||||
<td width="72%"><textarea rows="7" cols="120" name="msg"><?= $this->client->getNote() ?></textarea></td>
|
||||
<td width="10%">
|
||||
<div align="center"><input type="submit" value="저장" /></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<?php } ?>
|
||||
@ -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>
|
||||
@ -4,23 +4,21 @@
|
||||
<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>
|
||||
<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; ?>
|
||||
<?php foreach ($this->entities as $entity) { ?>
|
||||
<?php $num = count($this->entities) - $i; ?>
|
||||
<tr>
|
||||
<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->service_ip ?></td>
|
||||
<td><?= $service->service_open_date ?></td>
|
||||
|
||||
@ -8,8 +8,8 @@
|
||||
<td colspan="5"><?= $this->client->getTitle() ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>서비스코드</td>
|
||||
<td colspan="5"><?= $this->service->getServiceCode() ?></td>
|
||||
<td>형식</td>
|
||||
<td colspan="5"><?= $this->client->getServiceCode() ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>장비번호</td>
|
||||
|
||||
@ -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>
|
||||
Loading…
Reference in New Issue
Block a user