cfmgrv4 init...10

This commit is contained in:
최준흠 2025-03-19 12:57:44 +09:00
parent e34e07ebc8
commit 06501b7970
15 changed files with 113 additions and 46 deletions

View File

@ -8,16 +8,15 @@ use App\Services\CommonService;
use CodeIgniter\Session\Session; use CodeIgniter\Session\Session;
// 참고:https://github.com/SyntaxPhoenix/iloclient // 참고:https://github.com/SyntaxPhoenix/iloclient
class AuthService extends CommonService abstract class AuthService extends CommonService
{ {
private ?Session $_session = null; private ?Session $_session = null;
private ?UserModel $_model = null; private ?UserModel $_model = null;
public function __construct(string $class_name, string $class_path) public function __construct()
{ {
parent::__construct($class_name, $class_path); parent::__construct();
} }
final public function getSession(): Session final public function getSession(): Session
{ {
if ($this->_session === null) { if ($this->_session === null) {

View File

@ -14,9 +14,16 @@ class GoogleService extends AuthService
public function __construct(mixed $mySocket) public function __construct(mixed $mySocket)
{ {
$this->_mySocket = $mySocket; $this->_mySocket = $mySocket;
parent::__construct("Google", class_path: "Google"); parent::__construct();
}
final public function getClassName(): string
{
return "Google";
}
final public function getClassPath(): string
{
return $this->getClassName();
} }
public function getMySocket(string $access_code): mixed public function getMySocket(string $access_code): mixed
{ {
if ($this->_mySocket === null) { if ($this->_mySocket === null) {

View File

@ -8,9 +8,16 @@ class LocalService extends AuthService
{ {
public function __construct() public function __construct()
{ {
parent::__construct("Local", class_path: "Local"); parent::__construct();
}
final public function getClassName(): string
{
return "Local";
}
final public function getClassPath(): string
{
return $this->getClassName();
} }
public function checkUser(array $formDatas): UserEntity public function checkUser(array $formDatas): UserEntity
{ {
if (!isset($formDatas['id']) || !$formDatas['id']) { if (!isset($formDatas['id']) || !$formDatas['id']) {

View File

@ -16,9 +16,16 @@ class AccountService extends CloudflareService
public function __construct() public function __construct()
{ {
parent::__construct("Account", "Account"); parent::__construct();
}
final public function getClassName(): string
{
return "Account";
}
final public function getClassPath(): string
{
return parent::getClassPath() . $this->getClassName();
} }
private function getParentEntity(): AuthEntity private function getParentEntity(): AuthEntity
{ {
if ($this->_parent_entity === null) { if ($this->_parent_entity === null) {

View File

@ -12,12 +12,18 @@ class AuditLogService extends CloudflareService
private ?AuditLogModel $_model = null; private ?AuditLogModel $_model = null;
private ?AccountModel $_accountModel = null; private ?AccountModel $_accountModel = null;
private ?ZoneModel $_zoneModel = null; private ?ZoneModel $_zoneModel = null;
public function __construct() public function __construct()
{ {
parent::__construct("AuditLog", "AuditLog"); parent::__construct();
}
final public function getClassName(): string
{
return "AuditLog";
}
final public function getClassPath(): string
{
return parent::getClassPath() . $this->getClassName();
} }
public function getModel(): AuditLogModel public function getModel(): AuditLogModel
{ {
if ($this->_model === null) { if ($this->_model === null) {

View File

@ -12,9 +12,16 @@ class AuthService extends CloudflareService
public function __construct() public function __construct()
{ {
parent::__construct("Auth", "Auth"); parent::__construct();
}
final public function getClassName(): string
{
return "Auth";
}
final public function getClassPath(): string
{
return parent::getClassPath() . $this->getClassName();
} }
public function getModel(): AuthModel public function getModel(): AuthModel
{ {
if ($this->_model === null) { if ($this->_model === null) {

View File

@ -13,11 +13,14 @@ abstract class CloudflareService extends CommonService
private array $_mySockets = []; private array $_mySockets = [];
private ?AuthEntity $_auth_entity = null; private ?AuthEntity $_auth_entity = null;
private ?AuthModel $_authModel = null; private ?AuthModel $_authModel = null;
protected function __construct(string $class_name, string $class_path) public function __construct()
{ {
parent::__construct($class_name, "Cloudflare/" . $class_path); parent::__construct();
}
public function getClassPath(): string
{
return "Cloudflare/";
} }
final public function getMySocket(): CloudflareSocket final public function getMySocket(): CloudflareSocket
{ {
$authEntityPK = $this->getAuthEntity()->getPK(); $authEntityPK = $this->getAuthEntity()->getPK();

View File

@ -16,7 +16,15 @@ class FirewallService extends CloudflareService
public function __construct() public function __construct()
{ {
parent::__construct("Firewall", "Firewall"); parent::__construct();
}
final public function getClassName(): string
{
return "Firewall";
}
final public function getClassPath(): string
{
return parent::getClassPath() . $this->getClassName();
} }
private function getParentEntity(): ZoneEntity private function getParentEntity(): ZoneEntity

View File

@ -17,9 +17,16 @@ class RecordService extends CloudflareService
public function __construct() public function __construct()
{ {
parent::__construct("Record", "Record"); parent::__construct();
}
final public function getClassName(): string
{
return "Record";
}
final public function getClassPath(): string
{
return parent::getClassPath() . $this->getClassName();
} }
private function getParentEntity(): ZoneEntity private function getParentEntity(): ZoneEntity
{ {
if ($this->_parent_entity === null) { if ($this->_parent_entity === null) {

View File

@ -23,9 +23,16 @@ class ZoneService extends CloudflareService
public function __construct() public function __construct()
{ {
parent::__construct("Zone", class_path: "Zone"); parent::__construct();
}
final public function getClassName(): string
{
return "Zone";
}
final public function getClassPath(): string
{
return parent::getClassPath() . $this->getClassName();
} }
private function getParentEntity(): AccountEntity private function getParentEntity(): AccountEntity
{ {
if ($this->_parent_entity === null) { if ($this->_parent_entity === null) {

View File

@ -5,16 +5,11 @@ namespace App\Services;
abstract class CommonService abstract class CommonService
{ {
private $_serviceDatas = []; private $_serviceDatas = [];
private $class_name = ""; public function __construct() {}
private $class_path = "";
public function __construct(string $class_name, string $class_path)
{
$this->class_name = $class_name;
$this->class_path = $class_path;
// dd($this->class_name, $this->class_path);
}
abstract public function getModel(): mixed; abstract public function getModel(): mixed;
abstract public function getClassName(): string;
abstract public function getClassPath(): string;
final public function __get($name) final public function __get($name)
{ {
if (!array_key_exists($name, $this->_serviceDatas)) { if (!array_key_exists($name, $this->_serviceDatas)) {
@ -26,14 +21,6 @@ abstract class CommonService
{ {
$this->_serviceDatas[$name] = $value; $this->_serviceDatas[$name] = $value;
} }
final public function getClassName(): string
{
return $this->class_name;
}
final public function getClassPath(): string
{
return $this->class_path;
}
final public function getServiceDatas(): array final public function getServiceDatas(): array
{ {
return $this->_serviceDatas; return $this->_serviceDatas;

View File

@ -12,7 +12,15 @@ class MapurlService extends CommonService
private ?MapurlModel $_model = null; private ?MapurlModel $_model = null;
public function __construct() public function __construct()
{ {
parent::__construct("Mapurl", "Mapurl"); parent::__construct();
}
final public function getClassName(): string
{
return "Mapurl";
}
final public function getClassPath(): string
{
return parent::getClassPath() . $this->getClassName();
} }
public function getModel(): MapurlModel public function getModel(): MapurlModel
{ {

View File

@ -10,16 +10,14 @@ class MyLogService
{ {
private static ?MyLogModel $_model = null; private static ?MyLogModel $_model = null;
private static $_logBuffers = []; private static $_logBuffers = [];
private static $_class_name = "MyLog";
private static $_class_path = "MyLog";
public function __construct() {} public function __construct() {}
final public function getClassName(): string final public function getClassName(): string
{ {
return self::$_class_name; return "MyLog";
} }
final public function getClassPath(): string final public function getClassPath(): string
{ {
return self::$_class_path; return $this->getClassName();
} }
static public function getModel(): MyLogModel static public function getModel(): MyLogModel
{ {

View File

@ -11,7 +11,15 @@ class UserSNSService extends CommonService
private ?UserSNSModel $_model = null; private ?UserSNSModel $_model = null;
public function __construct() public function __construct()
{ {
parent::__construct("UserSNS", "UserSNS"); parent::__construct();
}
final public function getClassName(): string
{
return "UserSNS";
}
final public function getClassPath(): string
{
return parent::getClassPath() . $this->getClassName();
} }
public function getModel(): UserSNSModel public function getModel(): UserSNSModel
{ {

View File

@ -10,7 +10,15 @@ class UserService extends CommonService
private ?UserModel $_model = null; private ?UserModel $_model = null;
public function __construct() public function __construct()
{ {
parent::__construct("User", "User"); parent::__construct();
}
final public function getClassName(): string
{
return "User";
}
final public function getClassPath(): string
{
return $this->getClassName();
} }
public function getModel(): UserModel public function getModel(): UserModel
{ {