dbms_primeidc/extdbms/lib/Controllers/DBMS/ServerController.php
2025-04-21 14:45:14 +09:00

55 lines
1.9 KiB
PHP

<?php
namespace lib\Controllers\DBMS;
use lib\Services\ClientService;
use lib\Services\ServerService;
use lib\Utils\Pagination;
class ServerController extends DBMSController
{
private ?ServerService $_serverService = null;
private ?ClientService $_clientService = null;
public function __construct(array $params = [])
{
parent::__construct($params);
$this->getView()->setPath('server');
} //
public function getServerService(): ServerService
{
if ($this->_serverService === null) {
$this->_serverService = new ServerService();
}
return $this->_serverService;
}
public function getClientService(): ClientService
{
if ($this->_clientService === null) {
$this->_clientService = new ClientService();
}
return $this->_clientService;
}
//IdcCouponListMK.jsp -> domain_coupon.php
//CLI 접속방법 : php index.php site/client/counpon/index
//WEB 접속방법 : http://localhost/site/client/coupon/index
public function index()
{
//서비스스코드가 있는
$service_code = $this->request->get('service_code');
if ($service_code) {
$this->getServerService()->getModel()->where('service_code', $service_code);
}
//쿠폰내역
$this->curPage = intval($this->request->get('curPage', 1));
$this->perPage = intval($this->request->get('perPage', VIEW_LIST_PERPAGE));
[$this->total, $this->entities] = $this->getServerService()->getList($this->curPage, $this->perPage);
$this->pagination = new Pagination($this->total, (int)$this->curPage, (int)$this->perPage);
$total_coupon = 0;
foreach ($this->entities as $entity) {
$total_coupon += $entity->getCoupon();
}
$this->total_coupon = $total_coupon;
return $this->render(__FUNCTION__);
}
} //Class