58 lines
2.3 KiB
PHP
58 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace lib\Controllers;
|
|
|
|
use lib\Entities\ClientEntity;
|
|
use lib\Services\ClientService;
|
|
use lib\Services\OnetimeService;
|
|
use lib\Utils\Pagination;
|
|
|
|
class OnetimeController extends DBMSController
|
|
{
|
|
private ?ClientService $_clientService = null;
|
|
private ?OnetimeService $_onetimeService = null;
|
|
public function __construct(array $params = [])
|
|
{
|
|
parent::__construct($params);
|
|
$this->setPath('onetime');
|
|
} //
|
|
public function getClientService(): ClientService
|
|
{
|
|
if ($this->_clientService === null) {
|
|
$this->_clientService = new ClientService();
|
|
}
|
|
return $this->_clientService;
|
|
}
|
|
public function getOnetimeService(): OnetimeService
|
|
{
|
|
if ($this->_onetimeService === null) {
|
|
$this->_onetimeService = new OnetimeService();
|
|
}
|
|
return $this->_onetimeService;
|
|
}
|
|
//IdcCouponListMK.jsp -> domain_coupon.php
|
|
//CLI 접속방법 : php index.php site/client/onetime/index
|
|
//WEB 접속방법 : http://localhost/site/client/onetime/index
|
|
public function index()
|
|
{
|
|
//기본적으로 필요한 client_code, member_code, service_code를 설정합니다.
|
|
list($this->client, $this->member, $this->service) = $this->setDefaultRequestData(null, null, true);
|
|
//사용자 코드가 있으면
|
|
if ($this->client instanceof ClientEntity) {
|
|
$this->getOnetimeService()->getModel()->where('client_code', $this->client->getClientCode());
|
|
}
|
|
//업체명_일회성만 나오게하기 위해서
|
|
$this->getOnetimeService()->getModel()->where('service_code', $this->service->getServiceCode());
|
|
$this->curPage = intval($this->request->get('curPage', 1));
|
|
$this->perPage = intval($this->request->get('perPage', APP_VIEW_LIST_PERPAGE));
|
|
[$this->total, $this->entities] = $this->getOnetimeService()->getList($this->curPage, $this->perPage);
|
|
$this->pagination = new Pagination($this->total, (int)$this->curPage, (int)$this->perPage);
|
|
|
|
//전체 사용자정보
|
|
$this->clients = $this->getClientService()->getEntities();
|
|
//전체 관리자정보
|
|
$this->members = $this->getMemberService()->getEntities();
|
|
return $this->render(__FUNCTION__);
|
|
}
|
|
} //Class
|