dbms_primeidc_init...1
This commit is contained in:
parent
94f0c6ecbf
commit
7ac80afc1f
64
extdbms/lib/Controllers/DBMS/Client/CouponController.php
Normal file
64
extdbms/lib/Controllers/DBMS/Client/CouponController.php
Normal file
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace lib\Controllers\DBMS\Client;
|
||||
|
||||
use lib\Services\MemberService;
|
||||
use lib\Utils\Pagination;
|
||||
|
||||
class CouponController extends ClientController
|
||||
{
|
||||
private ?MemberService $_memberService = null;
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->getView()->setPath('onetime');
|
||||
} //
|
||||
public function getMemberService(): MemberService
|
||||
{
|
||||
if ($this->_memberService === null) {
|
||||
$this->_memberService = new MemberService();
|
||||
}
|
||||
return $this->_memberService;
|
||||
}
|
||||
//IdcCouponUseMK.jsp -> domain_coupon_use.php
|
||||
//CLI 접속방법 : php index.php site/client/counpon
|
||||
//WEB 접속방법 : http://localhost/site/client/coupon
|
||||
public function index(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;
|
||||
//전체 관리자정보(등록자)
|
||||
$member_code = $params['member_code'];
|
||||
$member = $this->getMemberService()->getEntityByCode($member_code);
|
||||
if (!$member) {
|
||||
throw new \Exception("[$member_code]에 해당하는 관리자정보가 존재하지 않습니다.");
|
||||
}
|
||||
$this->member = $member;
|
||||
//쿠폰내역
|
||||
$this->getServiceService()->getModel()->where("client_code", $client_code);
|
||||
$this->getServiceService()->getModel()->whereNotIn("service_line", ['vpn', 'test', 'soloLine', 'substitution']);
|
||||
//Query문 Rest여부 -> 같은조건에 Count 받고, 결과값을 받고 싶을때는 continue()
|
||||
$this->getServiceService()->getModel()->setContinue(true);
|
||||
$this->total = $this->getServiceService()->getCount();
|
||||
//limit, offset 설정
|
||||
$this->curPage = intval($params['curPage'] ?? $this->getRequest()->get('curPage') ?? 1);
|
||||
$this->perPage = intval($params['perPage'] ?? $this->getRequest()->get('perPage') ?? VIEW_LIST_PERPAGE);
|
||||
$this->getServiceService()->getModel()->limit($this->perPage);
|
||||
$this->getServiceService()->getModel()->offset(($this->curPage - 1) * $this->perPage);
|
||||
$this->services = $this->getServiceService()->getEntities();
|
||||
$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__);
|
||||
}
|
||||
} //Class
|
||||
@ -21,8 +21,7 @@ class MemoController extends ClientController
|
||||
throw new \Exception("client_code 값이 정의되지 않았습니다.");
|
||||
}
|
||||
$client_code = $params['client_code'];
|
||||
$this->getClientService()->getModel()->where("Client_Code", $client_code);
|
||||
$entity = $this->getClientService()->getEntity();
|
||||
$entity = $this->getClientService()->getEntityByCode($client_code);
|
||||
if (!$entity) {
|
||||
throw new \Exception("[$client_code]에 해당하는 사용자정보가 존재하지 않습니다.");
|
||||
}
|
||||
|
||||
@ -51,8 +51,6 @@ class PaymentController extends ClientController
|
||||
//mode 당일,1일전,2일전,3일전,custom
|
||||
$today = date("Y-m-d");;
|
||||
$mode = $params['mode'] ?? $this->getRequest()->get('mode') ?? 'all';
|
||||
$curPage = intval($params['curPage'] ?? $this->getRequest()->get('curPage') ?? 1);
|
||||
$perPage = intval($params['perPage'] ?? $this->getRequest()->get('perPage') ?? VIEW_LIST_PERPAGE);
|
||||
switch ($mode) {
|
||||
case 'today':
|
||||
$this->getServiceService()->getModel()->where("service_payment_date = CURDATE()");
|
||||
@ -91,13 +89,12 @@ class PaymentController extends ClientController
|
||||
$this->getServiceService()->getModel()->setContinue(true);
|
||||
$this->total = $this->getServiceService()->getCount();
|
||||
//limit, offset 설정
|
||||
$this->getServiceService()->getModel()->limit($perPage);
|
||||
$this->getServiceService()->getModel()->offset(($curPage - 1) * $perPage);
|
||||
|
||||
$this->curPage = intval($params['curPage'] ?? $this->getRequest()->get('curPage') ?? 1);
|
||||
$this->perPage = intval($params['perPage'] ?? $this->getRequest()->get('perPage') ?? VIEW_LIST_PERPAGE);
|
||||
$this->getServiceService()->getModel()->limit($this->perPage);
|
||||
$this->getServiceService()->getModel()->offset(($this->curPage - 1) * $this->perPage);
|
||||
$this->entities = $this->getServiceService()->getEntities();
|
||||
$this->mode = $mode;
|
||||
$this->curPage = $curPage;
|
||||
$this->perPage = $perPage;
|
||||
$this->pagination = new Pagination($this->total, (int)$this->curPage, (int)$this->perPage);
|
||||
return $this->render(path: __FUNCTION__);
|
||||
}
|
||||
|
||||
@ -31,4 +31,12 @@ class ServiceEntity extends Entity
|
||||
{
|
||||
return $this->client_code;
|
||||
}
|
||||
public function getCoupon(): string
|
||||
{
|
||||
return $this->coupon;
|
||||
}
|
||||
public function getUsedCoupon(): string
|
||||
{
|
||||
return $this->coupon_use;
|
||||
}
|
||||
} //Class
|
||||
|
||||
@ -27,4 +27,9 @@ class MemberService extends CommonService
|
||||
{
|
||||
return Entity::class;
|
||||
}
|
||||
public function getEntityByCode(string $key): Entity|null|false
|
||||
{
|
||||
$this->getModel()->where(Model::PKField, $key);
|
||||
return $this->getEntity();
|
||||
}
|
||||
}
|
||||
|
||||
41
extdbms/lib/Views/dbms/client/coupon/index.php
Normal file
41
extdbms/lib/Views/dbms/client/coupon/index.php
Normal file
@ -0,0 +1,41 @@
|
||||
<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;">사용완료</th>
|
||||
<th>고객명</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>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $i = 0; ?>
|
||||
<?php foreach ($this->services as $service) { ?>
|
||||
<?php $num = count($this->services) - $i; ?>
|
||||
<tr>
|
||||
<td><?= $num ?></td>
|
||||
<td><?= $service->getCoupon() + $service->getUsedCoupon() ?></td>
|
||||
<td onclick="location.href='/IdcCouponBuyMK.cup?service_code=<?= $service->getServiceCode() ?>" style="cursor: pointer;"><?= $service->getCoupon() ?></td>
|
||||
<td><?= $this->client->getName() ?></td>
|
||||
<td><?= $service->getUsedCoupon() ?></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><a href=/IdcCouponBuyMK.cup?service_code=<?= $service->getServiceCode() ?>&client_name=<?= $this->client->getName() ?>&client_code=<?= $service->getClientCode() ?>&server_code=<?= $service->getServerCode() ?>&coupon=<?= $service->getCoupon() ?>&mkid=<?= $this->member->getPK() ?>>사용하기</a></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div align='center'><?= $this->pagination->render(DBMS_SITE_URL . "/IdcCouponUseMK.cup", ['client_code' => $this->member->getClientCode(), 'member_code' => $this->member->getPK(), 'curPage' => $this->curPage, 'perPage' => $this->perPage]) ?></div>
|
||||
@ -11,7 +11,7 @@
|
||||
<h4><i class="fa fa-desktop fa-fw"></i> 도메인 쿠폰 사용하기</h4>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<c:import url="${phpurl}/domain_coupon_use.php?client_code=${mk_client_code }&mkworker=${member.name}&mkid=${member.id}" />
|
||||
<c:import url="${phpurl}/dbms/client/coupon/index/client_code=${mk_client_code }/member_code=${member.id}" />
|
||||
</div>
|
||||
<!-- panel-body -->
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user