From 86e82321a1178f517fa8f9097ae4edbac913eb48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=A4=80=ED=9D=A0?= Date: Mon, 23 Feb 2026 09:58:04 +0900 Subject: [PATCH] daemon-idc init --- app/Controllers/Admin/BoardController.php | 7 ++++++- app/Controllers/Admin/Welcome.php | 9 +++++++-- app/Libraries/AuthContext.php | 10 ++-------- app/Services/CommonService.php | 4 ++-- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/app/Controllers/Admin/BoardController.php b/app/Controllers/Admin/BoardController.php index 7cab8a2..525de97 100644 --- a/app/Controllers/Admin/BoardController.php +++ b/app/Controllers/Admin/BoardController.php @@ -6,6 +6,7 @@ use App\Entities\BoardEntity; use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\HTTP\ResponseInterface; use Psr\Log\LoggerInterface; +use RuntimeException; class BoardController extends AdminController { @@ -28,6 +29,10 @@ class BoardController extends AdminController public function reqeusttask(): ResponseInterface { $this->action_init_process(__FUNCTION__); - return $this->response->setJSON($this->service->getRequestTaskCount($this->getAuthContext()->getUID())); + $auth_uid = $this->getAuthContext()->getUID(); + if ($auth_uid === null) { + throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:로그인을 하지 않으셨습니다."); + } + return $this->response->setJSON($this->service->getRequestTaskCount($auth_uid)); } } diff --git a/app/Controllers/Admin/Welcome.php b/app/Controllers/Admin/Welcome.php index f351e3b..5a3cee7 100644 --- a/app/Controllers/Admin/Welcome.php +++ b/app/Controllers/Admin/Welcome.php @@ -2,9 +2,10 @@ namespace App\Controllers\Admin; +use RuntimeException; +use Psr\Log\LoggerInterface; use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\HTTP\ResponseInterface; -use Psr\Log\LoggerInterface; class Welcome extends AdminController { @@ -32,7 +33,11 @@ class Welcome extends AdminController $action = __FUNCTION__; $this->action_init_process($action); //요청업무 - $this->addViewDatas('boardRequestTaskCount', service('boardservice')->getRequestTaskCount($this->getAuthContext()->getUID())); + $auth_uid = $this->getAuthContext()->getUID(); + if ($auth_uid === null) { + throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:로그인을 하지 않으셨습니다."); + } + $this->addViewDatas('boardRequestTaskCount', service('boardservice')->getRequestTaskCount($auth_uid)); //Total 서버 현황 //interval을 기준으로 최근 신규 서비스정보 가져오기 // $interval = intval($this->request->getVar('interval') ?? 7); diff --git a/app/Libraries/AuthContext.php b/app/Libraries/AuthContext.php index 680bd0e..890900d 100644 --- a/app/Libraries/AuthContext.php +++ b/app/Libraries/AuthContext.php @@ -38,15 +38,9 @@ class AuthContext // Public Accessors (AuthService에서 이동) // ---------------------------------------------------- - public function getUID(): int + public function getUID(): int|null { - $uid = $this->getAuthInfo('uid'); - - if ($uid === null || $uid === '') { - throw new \RuntimeException('Not logged in'); - } - - return (int) $uid; + return $this->getAuthInfo('uid'); } public function getID(): string|null diff --git a/app/Services/CommonService.php b/app/Services/CommonService.php index fb31963..2d921ee 100644 --- a/app/Services/CommonService.php +++ b/app/Services/CommonService.php @@ -286,7 +286,7 @@ abstract class CommonService final public function create(array $formDatas): CommonEntity { return $this->dbTransaction(function () use ($formDatas) { - $formDatas['user_uid'] = (int) $this->getAuthContext()->getUID(); + $formDatas['user_uid'] = $this->getAuthContext()->getUID(); return $this->create_process($formDatas); }, __FUNCTION__); } @@ -332,7 +332,7 @@ abstract class CommonService if (!$entity) { throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$uid}에 해당하는 정보을 찾을수 없습니다."); } - $formDatas['user_uid'] = (int) $this->getAuthContext()->getUID(); + $formDatas['user_uid'] = $this->getAuthContext()->getUID(); return $this->modify_process($entity, $formDatas); }, __FUNCTION__); }