dbms_primeidc/extdbms/lib/Controllers/DBMS/Client/ClientController.php
2025-04-17 19:09:50 +09:00

63 lines
2.3 KiB
PHP

<?php
namespace lib\Controllers\DBMS\Client;
use lib\Services\ClientService;
use lib\Controllers\DBMS\DBMSController;
class ClientController extends DBMSController
{
private ?ClientService $_clientService = null;
public function __construct(array $params = [])
{
parent::__construct($params);
$this->getView()->setPath('client');
} //
final public function getClientService(): ClientService
{
if ($this->_clientService === null) {
$this->_clientService = new ClientService();
}
return $this->_clientService;
}
//서비스카운팅 , 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) {
$client = $this->getClientService()->getEntityByCode($client_code);
if (!$client) {
throw new \Exception("[$client_code]에 해당하는 사용자정보가 존재하지 않습니다.");
}
$this->client = $client;
}
//서비스위치별(치바,도쿄등)
$dashboard = [];
foreach (DBMS_SERVICE_SWITCHCODE as $district => $switchcodes) {
$switchcode_begin = $switchcodes['begin'];
$switchcode_end = $switchcodes['end'];
$dashboard[$district] = $this->getServiceService()->getDistrictCountByClient(
$client_code,
$switchcode_begin,
$switchcode_end
);
} //foreach
//서비스라인별(일반,방어,전용,테스트,대체등)
foreach (DBMS_SERVICE_LINE as $service_line => $label) {
$dashboard[$service_line] = $this->getServiceService()->getServiceLineCountByClient($client_code, $service_line);
} //foreach
//서비스상태별(정상,정지,해지등)
$dashboard['coupon'] = intval($this->getServiceService()->getCouponTotalCountByClient($client_code));
$this->dashboard = $dashboard;
$this->client_code = $client_code;
return $this->render(__FUNCTION__);
}
} //Class