cfmgrv4 init...10
This commit is contained in:
parent
e34e07ebc8
commit
06501b7970
@ -8,16 +8,15 @@ use App\Services\CommonService;
|
||||
use CodeIgniter\Session\Session;
|
||||
|
||||
// 참고:https://github.com/SyntaxPhoenix/iloclient
|
||||
class AuthService extends CommonService
|
||||
abstract class AuthService extends CommonService
|
||||
{
|
||||
private ?Session $_session = 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
|
||||
{
|
||||
if ($this->_session === null) {
|
||||
|
||||
@ -14,9 +14,16 @@ class GoogleService extends AuthService
|
||||
public function __construct(mixed $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
|
||||
{
|
||||
if ($this->_mySocket === null) {
|
||||
|
||||
@ -8,9 +8,16 @@ class LocalService extends AuthService
|
||||
{
|
||||
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
|
||||
{
|
||||
if (!isset($formDatas['id']) || !$formDatas['id']) {
|
||||
|
||||
@ -16,9 +16,16 @@ class AccountService extends CloudflareService
|
||||
|
||||
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
|
||||
{
|
||||
if ($this->_parent_entity === null) {
|
||||
|
||||
@ -12,12 +12,18 @@ class AuditLogService extends CloudflareService
|
||||
private ?AuditLogModel $_model = null;
|
||||
private ?AccountModel $_accountModel = null;
|
||||
private ?ZoneModel $_zoneModel = null;
|
||||
|
||||
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
|
||||
{
|
||||
if ($this->_model === null) {
|
||||
|
||||
@ -12,9 +12,16 @@ class AuthService extends CloudflareService
|
||||
|
||||
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
|
||||
{
|
||||
if ($this->_model === null) {
|
||||
|
||||
@ -13,11 +13,14 @@ abstract class CloudflareService extends CommonService
|
||||
private array $_mySockets = [];
|
||||
private ?AuthEntity $_auth_entity = 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
|
||||
{
|
||||
$authEntityPK = $this->getAuthEntity()->getPK();
|
||||
|
||||
@ -16,7 +16,15 @@ class FirewallService extends CloudflareService
|
||||
|
||||
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
|
||||
|
||||
@ -17,9 +17,16 @@ class RecordService extends CloudflareService
|
||||
|
||||
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
|
||||
{
|
||||
if ($this->_parent_entity === null) {
|
||||
|
||||
@ -23,9 +23,16 @@ class ZoneService extends CloudflareService
|
||||
|
||||
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
|
||||
{
|
||||
if ($this->_parent_entity === null) {
|
||||
|
||||
@ -5,16 +5,11 @@ namespace App\Services;
|
||||
abstract class CommonService
|
||||
{
|
||||
private $_serviceDatas = [];
|
||||
private $class_name = "";
|
||||
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);
|
||||
}
|
||||
public function __construct() {}
|
||||
|
||||
abstract public function getModel(): mixed;
|
||||
abstract public function getClassName(): string;
|
||||
abstract public function getClassPath(): string;
|
||||
final public function __get($name)
|
||||
{
|
||||
if (!array_key_exists($name, $this->_serviceDatas)) {
|
||||
@ -26,14 +21,6 @@ abstract class CommonService
|
||||
{
|
||||
$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
|
||||
{
|
||||
return $this->_serviceDatas;
|
||||
|
||||
@ -12,7 +12,15 @@ class MapurlService extends CommonService
|
||||
private ?MapurlModel $_model = null;
|
||||
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
|
||||
{
|
||||
|
||||
@ -10,16 +10,14 @@ class MyLogService
|
||||
{
|
||||
private static ?MyLogModel $_model = null;
|
||||
private static $_logBuffers = [];
|
||||
private static $_class_name = "MyLog";
|
||||
private static $_class_path = "MyLog";
|
||||
public function __construct() {}
|
||||
final public function getClassName(): string
|
||||
{
|
||||
return self::$_class_name;
|
||||
return "MyLog";
|
||||
}
|
||||
final public function getClassPath(): string
|
||||
{
|
||||
return self::$_class_path;
|
||||
return $this->getClassName();
|
||||
}
|
||||
static public function getModel(): MyLogModel
|
||||
{
|
||||
|
||||
@ -11,7 +11,15 @@ class UserSNSService extends CommonService
|
||||
private ?UserSNSModel $_model = null;
|
||||
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
|
||||
{
|
||||
|
||||
@ -10,7 +10,15 @@ class UserService extends CommonService
|
||||
private ?UserModel $_model = null;
|
||||
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
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user