dbms_primeidc/extdbms/lib/Controllers/CommonController.php
2025-03-21 18:48:48 +09:00

77 lines
2.6 KiB
PHP

<?php
namespace lib\Controllers;
use lib\Core\Controller;
use lib\Models\ClientModel;
use lib\Models\ServiceModel;
abstract class CommonController extends Controller
{
private $_clientModel = null;
private $_serviceModel = null;
protected function __construct()
{
parent::__construct();
} //
final protected function getClientModel(): ClientModel
{
if ($this->_clientModel === null) {
$this->_clientModel = new ClientModel();
}
return $this->_clientModel;
}
final protected function getServiceModel(): ServiceModel
{
if ($this->_serviceModel === null) {
$this->_serviceModel = new ServiceModel();
}
return $this->_serviceModel;
}
final public function getSiteInfo(): array
{
$domain = array_key_exists("HTTP_HOST", $_SERVER) ? $_SERVER["HTTP_HOST"] : false;
switch ($domain) {
case 'dbms.prime-idc.jp':
return [
"id" => "PRIMEIDC",
"domain" => "dbms.prime-idc.jp",
"name" => "PrimeIDC",
"email" => "primeidc.jp@gmail.com",
"banks" => [
["id" => "331301-04-217387", "name" => '국민은행', "owner" => "주)듀나미스"]
],
];
break;
case "dbms.itsolution-idc.jp":
return [
"id" => "ITSOLUTION",
"domain" => "dbms.itsolution-idc.jp",
"name" => "Itsolution",
"email" => "support@itsoution-idc.jp",
"banks" => [
["id" => "9002-1932-1654-1", "name" => '새마을금고', "owner" => "주식회사 르호봇"],
["id" => "351-0995-6751-73", "name" => '농협', "owner" => "주식회사 르호봇"],
],
];
break;
case 'dbms.gdidc.jp':
return [
"id" => "GDIDC",
"domain" => "dbms.gdidc.jp",
"name" => "GDIDC",
"email" => "support@gdidc.jp",
"banks" => [
["id" => "1005-204-100758", "name" => '우리은행', "owner" => " (주)브엘라해로이"],
],
];
break;
default:
throw new \Exception(sprintf(__METHOD__ . "에서 오류 Domain[%s]이 정의되지 않았습니다.", $domain));
break;
}
}
} //Class