93 lines
3.7 KiB
PHP
93 lines
3.7 KiB
PHP
<?php
|
|
|
|
namespace lib\Controllers\DBMS;
|
|
|
|
use lib\Services\ClientService;
|
|
use lib\Services\AddDbService;
|
|
|
|
class ServiceController extends BaseController
|
|
{
|
|
|
|
private ?ClientService $_clientService = null;
|
|
private ?AddDbService $_addDbService = null;
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->getView()->setPath('service');
|
|
} //
|
|
public function getClientService(): ClientService
|
|
{
|
|
if ($this->_clientService === null) {
|
|
$this->_clientService = new ClientService();
|
|
}
|
|
return $this->_clientService;
|
|
}
|
|
public function getAddDbService(): AddDbService
|
|
{
|
|
if ($this->_addDbService === null) {
|
|
$this->_addDbService = new AddDbService();
|
|
}
|
|
return $this->_addDbService;
|
|
}
|
|
|
|
//서비스카운팅 , total_counting_customer.php
|
|
//CLI 접속방법 : php index.php site/service/totalcount/client_code/코드번호
|
|
//WEB 접속방법 : http://localhost/site/service/totalcount/client_code/코드번호
|
|
public function dashboard(mixed $client_code = null)
|
|
{
|
|
if ($client_code === null) {
|
|
$client_code = $this->getSegments('client_code');
|
|
if ($client_code === null) {
|
|
throw new \Exception("client_code 값이 정의되지 않았습니다.");
|
|
}
|
|
}
|
|
$this->client_code = $client_code;
|
|
$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 (array_keys(DBMS_SERVICE_LINE) as $service_line) {
|
|
$dashboard[$service_line] = $this->getServiceService()->getServiceLineCountByClient($client_code, $service_line);
|
|
} //foreach
|
|
$dashboard['coupon'] = $this->getServiceService()->getCouponCountByClient($client_code);
|
|
$this->dashboard = $dashboard;
|
|
return $this->render(__FUNCTION__);
|
|
}
|
|
//부가서비스 : 닷디펜더,딥파인더 등, deepfinder_list.php,dotdefender_list.php
|
|
//CLI 접속방법 : php index.php site/service//extra/adddb_code/코드번호
|
|
//WEB 접속방법 : http://localhost/site/service/extra/adddb_code/코드번호
|
|
public function extra(mixed $adddb_code = null): string
|
|
{
|
|
if ($adddb_code === null) {
|
|
$adddb_code = $this->getSegments('adddb_code');
|
|
if ($adddb_code === null) {
|
|
throw new \Exception("adddb_code 값이 정의되지 않았습니다.");
|
|
}
|
|
}
|
|
//해당 부가서비스의 services_code 목록 가져오기
|
|
//segment의 값이 한글인경우 urldecode가 필요
|
|
$service_codes = [];
|
|
$this->getAddDbService()->getModel()->where('addDB_code', urldecode($adddb_code));
|
|
$entitys = $this->getAddDbService()->getEntities();
|
|
foreach ($entitys as $entity) {
|
|
$service_codes[] = $entity->getServiceCode();
|
|
}
|
|
if (!count($service_codes)) {
|
|
throw new \Exception("[{$adddb_code}] 값에 해당하는 부가서비스정보가 존재하지 않습니다.");
|
|
}
|
|
//부가서비스용 서비스목록 가져오기
|
|
$this->getServiceService()->getModel()->whereIn('service_code', $service_codes);
|
|
$this->services = $this->getServiceService()->getEntities();
|
|
//전체 사용자정보
|
|
$this->clients = $this->getClientService()->getEntities();
|
|
return $this->render(__FUNCTION__);
|
|
}
|
|
} //Class
|