dbms init...1

This commit is contained in:
최준흠 2025-05-03 22:00:08 +09:00
parent 958729abd7
commit 67b1c5c5a7
6 changed files with 37 additions and 17 deletions

View File

@ -6,8 +6,9 @@ namespace App\Controllers\Admin;
use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface; use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use App\Helpers\MyLogHelper as Helper;
use App\Services\MyLogService as Service; use App\Services\MyLogService as Service;
use App\Helpers\MyLogHelper as Helper;
use App\Services\UserService; use App\Services\UserService;
class MyLogController extends AdminController class MyLogController extends AdminController
@ -16,10 +17,10 @@ class MyLogController extends AdminController
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{ {
parent::initController($request, $response, $logger); parent::initController($request, $response, $logger);
$this->uri_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR; $this->uri_path .= strtolower($this->getService()->getClassName()) . '/';
$this->class_path = $this->getService()->getClassPath(); $this->class_path = $this->getService()->getClassPath();
$this->title = lang("{$this->getService()->getClassPath()}.title"); $this->title = lang("{$this->getService()->getClassPath()}.title");
$this->helper = new Helper(); $this->helper = $this->getHelper();
} }
final public function getService(): Service final public function getService(): Service
{ {
@ -28,6 +29,13 @@ class MyLogController extends AdminController
} }
return $this->_service; return $this->_service;
} }
public function getHelper(): mixed
{
if (!$this->_helper) {
$this->_helper = new Helper($this->request);
}
return $this->_helper;
}
public function getUserService(): UserService public function getUserService(): UserService
{ {
if (!$this->_userService) { if (!$this->_userService) {

View File

@ -20,7 +20,7 @@ class UserController extends AdminController
$this->uri_path .= strtolower($this->getService()->getClassName()) . '/'; $this->uri_path .= strtolower($this->getService()->getClassName()) . '/';
$this->class_path = $this->getService()->getClassPath(); $this->class_path = $this->getService()->getClassPath();
$this->title = lang("{$this->getService()->getClassPath()}.title"); $this->title = lang("{$this->getService()->getClassPath()}.title");
$this->helper = new Helper(); $this->helper = $this->getHelper();
} }
final public function getService(): Service final public function getService(): Service
{ {
@ -29,6 +29,13 @@ class UserController extends AdminController
} }
return $this->_service; return $this->_service;
} }
public function getHelper(): mixed
{
if (!$this->_helper) {
$this->_helper = new Helper($this->request);
}
return $this->_helper;
}
//Index,FieldForm관련 //Index,FieldForm관련
public function getFields(): array public function getFields(): array
{ {

View File

@ -9,6 +9,7 @@ use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface; use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use App\Helpers\AuthHelper as Helper;
use App\Libraries\MySocket\GoogleSocket\API as GoogleSocket; use App\Libraries\MySocket\GoogleSocket\API as GoogleSocket;
use App\Services\UserService; use App\Services\UserService;
use App\Entities\UserEntity as Entity; use App\Entities\UserEntity as Entity;
@ -33,6 +34,13 @@ abstract class AuthController extends CommonController
} }
return $this->_socket; return $this->_socket;
} }
public function getHelper(): mixed
{
if (!$this->_helper) {
$this->_helper = new Helper($this->request);
}
return $this->_helper;
}
final public function getUserService(): UserService final public function getUserService(): UserService
{ {
if (!$this->_userService) { if (!$this->_userService) {
@ -60,6 +68,7 @@ abstract class AuthController extends CommonController
{ {
switch ($action) { switch ($action) {
case 'login_form': case 'login_form':
$this->getHelper()->setViewDatas($this->getViewDatas());
$result = view($this->view_path . $action, ['viewDatas' => $this->getViewDatas()]); $result = view($this->view_path . $action, ['viewDatas' => $this->getViewDatas()]);
break; break;
default: default:

View File

@ -6,7 +6,6 @@ use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface; use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use App\Helpers\AuthHelper as Helper;
use App\Services\Auth\GoogleService as Service; use App\Services\Auth\GoogleService as Service;
use App\Entities\UserEntity as Entity; use App\Entities\UserEntity as Entity;
@ -19,7 +18,6 @@ class GoogleController extends AuthController
$this->uri_path .= strtolower($this->getService()->getClassName()) . '/'; $this->uri_path .= strtolower($this->getService()->getClassName()) . '/';
$this->class_path = $this->getService()->getClassPath(); $this->class_path = $this->getService()->getClassPath();
$this->title = lang("{$this->getService()->getClassPath()}.title");; $this->title = lang("{$this->getService()->getClassPath()}.title");;
$this->helper = new Helper();
} }
final public function getService(): Service final public function getService(): Service

View File

@ -5,9 +5,7 @@ namespace App\Controllers\Auth;
use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface; use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use CodeIgniter\HTTP\RedirectResponse;
use App\Helpers\AuthHelper as Helper;
use App\Services\Auth\LocalService as Service; use App\Services\Auth\LocalService as Service;
use App\Entities\UserEntity as Entity; use App\Entities\UserEntity as Entity;
@ -20,7 +18,6 @@ class LocalController extends AuthController
$this->uri_path .= strtolower($this->getService()->getClassName()) . '/'; $this->uri_path .= strtolower($this->getService()->getClassName()) . '/';
$this->class_path = $this->getService()->getClassPath(); $this->class_path = $this->getService()->getClassPath();
$this->title = lang("{$this->getService()->getClassPath()}.title");; $this->title = lang("{$this->getService()->getClassPath()}.title");;
$this->helper = new Helper();
} }
final public function getService(): Service final public function getService(): Service
{ {

View File

@ -17,12 +17,12 @@ use Psr\Log\LoggerInterface;
use App\Libraries\LogCollector; use App\Libraries\LogCollector;
use App\Services\MyLogService; use App\Services\MyLogService;
use App\Helpers\CommonHelper as Helper;
abstract class CommonController extends BaseController abstract class CommonController extends BaseController
{ {
private $_myAuth = null; private $_myAuth = null;
private $_myLogService = null; private $_myLogService = null;
private $_helper = null;
private $_viewDatas = []; private $_viewDatas = [];
abstract public function getService(): mixed; abstract public function getService(): mixed;
abstract public function getFields(): array; abstract public function getFields(): array;
@ -38,10 +38,6 @@ abstract class CommonController extends BaseController
$this->myAuthUID = $this->getMyAuth()->getUIDByAuthInfo(); $this->myAuthUID = $this->getMyAuth()->getUIDByAuthInfo();
} }
} }
final protected function getMyAuth(): mixed
{
return $this->_myAuth;
}
final public function __get($name) final public function __get($name)
{ {
if (!array_key_exists($name, $this->_viewDatas)) { if (!array_key_exists($name, $this->_viewDatas)) {
@ -53,6 +49,10 @@ abstract class CommonController extends BaseController
{ {
$this->_viewDatas[$name] = $value; $this->_viewDatas[$name] = $value;
} }
final protected function getMyAuth(): mixed
{
return $this->_myAuth;
}
final public function getMyLogService(): mixed final public function getMyLogService(): mixed
{ {
if (!$this->_myLogService) { if (!$this->_myLogService) {
@ -60,13 +60,14 @@ abstract class CommonController extends BaseController
} }
return $this->_myLogService; return $this->_myLogService;
} }
final public function getHelper(): mixed public function getHelper(): mixed
{ {
if (!$this->_helper) { if (!$this->_helper) {
$this->_helper = new MyLogService($this->request); $this->_helper = new Helper($this->request);
} }
return $this->_helper; return $this->_helper;
} }
protected function getResultPageByActon(string $action, string $message = MESSAGES["SUCCESS"]): RedirectResponse|string protected function getResultPageByActon(string $action, string $message = MESSAGES["SUCCESS"]): RedirectResponse|string
{ {
switch ($action) { switch ($action) {
@ -74,7 +75,7 @@ abstract class CommonController extends BaseController
case 'modify_form': case 'modify_form':
case 'index': case 'index':
case 'view': case 'view':
$this->helper->setViewDatas($this->getViewDatas()); $this->getHelper()->setViewDatas($this->getViewDatas());
$result = view($this->view_path . $action, ['viewDatas' => $this->getViewDatas()]); $result = view($this->view_path . $action, ['viewDatas' => $this->getViewDatas()]);
break; break;
default: default: