diff --git a/extdbms/lib/Controllers/DBMS/Client/PointController.php b/extdbms/lib/Controllers/DBMS/Client/PointController.php new file mode 100644 index 0000000..5534968 --- /dev/null +++ b/extdbms/lib/Controllers/DBMS/Client/PointController.php @@ -0,0 +1,183 @@ +getView()->setPath('point'); + } // + public function getMemberService(): MemberService + { + if ($this->_memberService === null) { + $this->_memberService = new 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 신규추가가 + //CLI 접속방법 : php index.php site/client/point/index + //WEB 접속방법 : http://localhost/site/client/point/index + public function index(array $params) + { + //쿠폰내역 + $this->curPage = intval($params['curPage'] ?? $this->request->get('curPage') ?? 1); + $this->perPage = intval($params['perPage'] ?? $this->request->get('perPage') ?? VIEW_LIST_PERPAGE); + [$this->total, $this->services] = $this->getServiceService()->getEntitiesForCoupon($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(); + } + $this->total_coupon = $total_coupon; + return $this->render(__FUNCTION__); + } + + //IdcCouponUseMK.jsp -> domain_coupon_use.php + //CLI 접속방법 : php index.php site/client/counpon/client/client_code/코드 + //WEB 접속방법 : http://localhost/site/client/coupon/client/client_code/코드 + public function client(array $params) + { + //사용자정보 + if (!array_key_exists('client_code', $params)) { + throw new \Exception("client_code 값이 정의되지 않았습니다."); + } + $client_code = $params['client_code']; + $client = $this->getClientService()->getEntityByCode($client_code); + if (!$client) { + throw new \Exception("[$client_code]에 해당하는 사용자정보가 존재하지 않습니다."); + } + $this->client = $client; + //전체 관리자정보(등록자) + if (!array_key_exists('mkid', $params)) { + throw new \Exception("mkid 값이 정의되지 않았습니다."); + } + $member_code = $params['mkid']; + $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->perPage = intval($params['perPage'] ?? $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 + //WEB 접속방법 : http://localhost/site/client/coupon/insert_form + public function insert_form(array $params) + { + if (!array_key_exists('service_code', $params)) { + throw new \Exception("service_code 값이 정의되지 않았습니다."); + } + $service_code = $params['service_code']; + $service = $this->getServiceService()->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; + //전체 관리자정보(등록자) + if (!array_key_exists('mkid', $params)) { + throw new \Exception("mkid 값이 정의되지 않았습니다."); + } + $member_code = $params['mkid']; + $member = $this->getMemberService()->getEntityByCode($member_code); + if (!$member) { + throw new \Exception("[$member_code]에 해당하는 관리자정보가 존재하지 않습니다."); + } + $this->member = $member; + $this->today = date("Y-m-d"); + return $this->render(__FUNCTION__); + } + + //IdcCouponBuyMK.jsp -> domain_coupon_buy.php + //CLI 접속방법 : php index.php site/client/counpon/insert_form + //WEB 접속방법 : http://localhost/site/client/coupon/insert_form + public function insert(array $params) + { + if (!array_key_exists('service_code', $params)) { + throw new \Exception("service_code 값이 정의되지 않았습니다."); + } + $service_code = $params['service_code']; + $service = $this->getServiceService()->getEntityByCode($service_code); + if (!$service) { + throw new \Exception("[$service_code]에 해당하는 서비스정보가 존재하지 않습니다."); + } + //사용자정보 + $client = $this->getClientService()->getEntityByCode($service->getClientCode()); + if (!$client) { + throw new \Exception("[{$service->getClientCode()}]에 해당하는 사용자정보가 존재하지 않습니다."); + } + //전체 관리자정보(등록자) + if (!array_key_exists('mkid', $params)) { + throw new \Exception("mkid 값이 정의되지 않았습니다."); + } + $member_code = $params['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') ?? 'point'; + //onetime_request_date 사용일 + $onetime_request_date = $this->request->get('onetime_request_date') ?? date("Y-m-d"); + try { + $this->getServiceService()->beginTransaction(); + //서비스쿠폰 갯수 수정 + $this->getServiceService()->useCouponForDomain($service, $coupon); + //쿠폰 사용내역 onetime에 등록 + $this->getOnetimeService()->useCouponForDomain($service, $client, $member, $onetime_case, $coupon, $note, $onetime_request_date); + //쿠폰 사용내역 history에 등록 + $this->getHistoryService()->useCouponForDomain($service, $client, $onetime_case, $coupon, $note, $onetime_request_date);; + $this->getServiceService()->commit(); + return $this->redirect->to(DBMS_SITE_URL . "/IdcCouponUseMK.cup?client_code=" . $service->getClientCode()); + } catch (\Exception $e) { + $this->getServiceService()->rollback(); + return $this->redirect->back()->withInput()->with('error', ['message' => '쿠폰 사용에 실패하였습니다.:' . $e->getMessage()]); + } + } +} //Class diff --git a/extdbms/lib/Entities/ClientEntity.php b/extdbms/lib/Entities/ClientEntity.php index d85687a..9574599 100644 --- a/extdbms/lib/Entities/ClientEntity.php +++ b/extdbms/lib/Entities/ClientEntity.php @@ -30,4 +30,8 @@ class ClientEntity extends Entity { return $this->Client_Note; } + public function getPoint(): string + { + return $this->Client_Poinit; + } } //Class diff --git a/extdbms/lib/Views/dbms/client/point/client.php b/extdbms/lib/Views/dbms/client/point/client.php new file mode 100644 index 0000000..ad8917b --- /dev/null +++ b/extdbms/lib/Views/dbms/client/point/client.php @@ -0,0 +1,44 @@ +

고객명 : client->getTitle() ?> / 쿠폰발급대상 : services) ?> 대 / 전체 남은 수량 : total_coupon; ?> 개

+
+ + + + + + + + + + + + + + + + + + + services as $service) { ?> + services) - $i; ?> + + + + + + + + + + + getCoupon()) { ?> + + + + + + + + +
No서비스코드장비명서버IP서비스개시일회선종류쿠폰 누적수쿠폰 잔량수쿠폰 사용수사용
getServiceCode() ?>getServerCode() ?>service_ip ?>service_open_date ?>service_line ?>getCoupon() + $service->getUsedCoupon() ?>getCoupon() ?>getUsedCoupon() ?>사용완료사용하기
+
+
pagination->render(DBMS_SITE_URL . "/IdcCouponUseMK.cup", ['client_code' => $this->client->getClientCode(), 'member_code' => $this->member->getPK(), 'curPage' => $this->curPage, 'perPage' => $this->perPage]) ?>
\ No newline at end of file diff --git a/extdbms/lib/Views/dbms/client/point/index.php b/extdbms/lib/Views/dbms/client/point/index.php new file mode 100644 index 0000000..aa7e4a8 --- /dev/null +++ b/extdbms/lib/Views/dbms/client/point/index.php @@ -0,0 +1,37 @@ +
+ + + + + + + + + + + + + + + + + + services as $service) { ?> + services) - $i; ?> + + + + + + + + + + + + + + +
No서비스코드장비명서버IP서비스개시일회선종류쿠폰 누적수쿠폰 잔량수쿠폰 사용수
getServiceCode() ?>getServerCode() ?>service_ip ?>service_open_date ?>service_line ?>getCoupon() + $service->getUsedCoupon() ?>getCoupon() ?>getUsedCoupon() ?>
+
+
pagination->render(DBMS_SITE_URL . "/IdcCouponListMK.cup", ['curPage' => $this->curPage, 'perPage' => $this->perPage]) ?>
\ No newline at end of file diff --git a/extdbms/lib/Views/dbms/client/point/insert_form.php b/extdbms/lib/Views/dbms/client/point/insert_form.php new file mode 100644 index 0000000..93f2218 --- /dev/null +++ b/extdbms/lib/Views/dbms/client/point/insert_form.php @@ -0,0 +1,55 @@ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
고객명client->getTitle() ?>
서비스코드service->getServiceCode() ?>
장비번호service->getServerCode() ?>
도메인 구매 수량 + (개별 서버에 할당된 남은 쿠폰 수량 : service->getCoupon() ?>) +
서비스 금액도메인 쿠폰 사용
도메인 신청일today ?>쿠폰 사용일today ?>
도메인 리스트 +
(공백을 허용하지 않습니다. 예제처럼 붙여쓰기 하세요 / 예제 : test.com/123.com/idcjp.jp) +
+ + +
+
+
\ No newline at end of file diff --git a/idcproject/WebContent/jsp/cupon/IdcCouponListMK.jsp b/idcproject/WebContent/jsp/cupon/IdcCouponListMK.jsp index db5dd1b..3fa97e8 100644 --- a/idcproject/WebContent/jsp/cupon/IdcCouponListMK.jsp +++ b/idcproject/WebContent/jsp/cupon/IdcCouponListMK.jsp @@ -57,8 +57,7 @@ $(function()

도메인 쿠폰 리스트

- - +
diff --git a/idcproject/WebContent/jsp/cupon/IdcPointList.jsp b/idcproject/WebContent/jsp/cupon/IdcPointList.jsp new file mode 100644 index 0000000..45f3e08 --- /dev/null +++ b/idcproject/WebContent/jsp/cupon/IdcPointList.jsp @@ -0,0 +1,69 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<% pageContext.setAttribute("phpurl",request.getScheme()+"://"+request.getServerName()); %> + + + + +
+
+
+
+

포인트 리스트

+
+
+ +
+ +
+ +
+ +
+ +