63 lines
2.2 KiB
PHP
63 lines
2.2 KiB
PHP
<?php
|
|
|
|
namespace lib\Controllers\DBMS;
|
|
|
|
use lib\Services\ClientService;
|
|
use lib\Services\AddDbService;
|
|
use lib\Helpers\ServiceHelper;
|
|
|
|
class ServiceController extends BaseController
|
|
{
|
|
|
|
private ?ClientService $_clientService = null;
|
|
private ?AddDbService $_addDbService = null;
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->getView()->setPath('service');
|
|
$this->helper = new ServiceHelper();
|
|
} //
|
|
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;
|
|
}
|
|
|
|
//부가서비스 : 닷디펜더,딥파인더 등, deepfinder_list.php,dotdefender_list.php
|
|
//CLI 접속방법 : php index.php SiteController/extraservice/client_code/코드번호
|
|
//WEB 접속방법 : http://localhost/SiteController/extraservice/sitekey/dbms.prime-idc.jp/client_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 값이 정의되지 않았습니다.");
|
|
}
|
|
}
|
|
//segment의 값이 한글인경우 urldecode가 필요
|
|
$adddb_code = urldecode($adddb_code);
|
|
$service_codes = $this->getAddDbService()->getServiceCodesByCode($adddb_code);
|
|
if (!count($service_codes)) {
|
|
throw new \Exception("[{$adddb_code}] 값에 해당하는 부가서비스정보가 존재하지 않습니다.");
|
|
}
|
|
$clients = [];
|
|
$services = $this->getService()->geServicesBytExtras($service_codes);
|
|
foreach ($services as $service) {
|
|
$clients[$service->getPK()] = $this->getClientService()->getEntitByCode($service->getClientCode());
|
|
}
|
|
$this->services = $services;
|
|
$this->clients = $clients;
|
|
return $this->render(__FUNCTION__);
|
|
}
|
|
} //Class
|