From a785e49fba98d8f47a88606658f87f92948876d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=A4=80=ED=9D=A0?= Date: Mon, 2 Mar 2026 13:44:22 +0900 Subject: [PATCH] bt-trader init --- app/Controllers/CommonController.php | 54 ++++++++++++---------------- 1 file changed, 23 insertions(+), 31 deletions(-) diff --git a/app/Controllers/CommonController.php b/app/Controllers/CommonController.php index f741ee1..248787a 100644 --- a/app/Controllers/CommonController.php +++ b/app/Controllers/CommonController.php @@ -1,11 +1,4 @@ runAction($action, function () use ($action) { - [$uids, $formDatas] = $this->batchjob_pre_process($this->request->getPost()); + try { + $action = __FUNCTION__; + // 사전작업 및 데이터 추출 초기화 + list($uids, $formDatas) = $this->batchjob_pre_process($this->request->getPost()); $entities = $this->batchjob_process($uids, $formDatas); return $this->batchjob_result_process($uids, $entities); - }); + } catch (\Throwable $e) { + return $this->action_redirect_process('error', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 일괄수정 오류:" . $e->getMessage()); + } } - // ========================================================= // Batch Job Delete // ========================================================= @@ -103,15 +97,15 @@ abstract class CommonController extends AbstractCRUDController )); } - final public function batchjob_delete(): RedirectResponse|ResponseInterface|string + final public function batchjob_delete(): string|RedirectResponse { - $action = __FUNCTION__; - - return $this->runAction($action, function () use ($action) { + try { $uids = $this->batchjob_delete_pre_process($this->request->getPost()); $entities = $this->batchjob_delete_process($uids); return $this->batchjob_delete_result_process($uids, $entities); - }); + } catch (\Throwable $e) { + return $this->action_redirect_process('error', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 일괄삭제 오류:" . $e->getMessage()); + } } // ========================================================= @@ -207,15 +201,12 @@ abstract class CommonController extends AbstractCRUDController $this->addViewDatas('formDatas', $this->request->getVar() ?? []); } - public function index(): string|RedirectResponse|ResponseInterface + final public function index(): string { $action = __FUNCTION__; - - return $this->runAction($action, function () use ($action) { - $this->action_init_process($action); - $this->index_process($action); - return $this->index_result_process($action); - }); + $this->action_init_process($action); + $this->index_process($action); + return $this->index_result_process($action); } // ========================================================= @@ -284,13 +275,14 @@ abstract class CommonController extends AbstractCRUDController return $this->response->download($full_path, null)->setFileName($file_name); } - final public function download(string $output_type, mixed $uid = false): DownloadResponse|RedirectResponse|string|ResponseInterface + final public function download(string $output_type, mixed $uid = false): DownloadResponse|RedirectResponse|string { - $action = __FUNCTION__; - - return $this->runAction($action, function () use ($action, $output_type, $uid) { + try { + $action = __FUNCTION__; $this->action_init_process($action); return $this->download_process($action, $output_type, $uid); - }); + } catch (\Throwable $e) { + return $this->action_redirect_process('error', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 다운로드 오류:" . $e->getMessage()); + } } }