bt-trader init

This commit is contained in:
최준흠 2026-03-02 13:44:22 +09:00
parent 73b44dd3ee
commit a785e49fba

View File

@ -1,11 +1,4 @@
<?php <?php
// =========================================================
// CommonController.php (FINAL)
// - index() runAction 적용 (렌더링 예외도 동일 처리)
// - batchjob/batchjob_delete/download runAction 적용
// - "결과/리다이렉트"는 RedirectResponse|ResponseInterface로 엄격 정리
// =========================================================
namespace App\Controllers; namespace App\Controllers;
use RuntimeException; use RuntimeException;
@ -64,17 +57,18 @@ abstract class CommonController extends AbstractCRUDController
)); ));
} }
final public function batchjob(): RedirectResponse|ResponseInterface|string final public function batchjob(): string|RedirectResponse
{ {
try {
$action = __FUNCTION__; $action = __FUNCTION__;
// 사전작업 및 데이터 추출 초기화
return $this->runAction($action, function () use ($action) { list($uids, $formDatas) = $this->batchjob_pre_process($this->request->getPost());
[$uids, $formDatas] = $this->batchjob_pre_process($this->request->getPost());
$entities = $this->batchjob_process($uids, $formDatas); $entities = $this->batchjob_process($uids, $formDatas);
return $this->batchjob_result_process($uids, $entities); 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 // 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__; try {
return $this->runAction($action, function () use ($action) {
$uids = $this->batchjob_delete_pre_process($this->request->getPost()); $uids = $this->batchjob_delete_pre_process($this->request->getPost());
$entities = $this->batchjob_delete_process($uids); $entities = $this->batchjob_delete_process($uids);
return $this->batchjob_delete_result_process($uids, $entities); 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() ?? []); $this->addViewDatas('formDatas', $this->request->getVar() ?? []);
} }
public function index(): string|RedirectResponse|ResponseInterface final public function index(): string
{ {
$action = __FUNCTION__; $action = __FUNCTION__;
return $this->runAction($action, function () use ($action) {
$this->action_init_process($action); $this->action_init_process($action);
$this->index_process($action); $this->index_process($action);
return $this->index_result_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); 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
{ {
try {
$action = __FUNCTION__; $action = __FUNCTION__;
return $this->runAction($action, function () use ($action, $output_type, $uid) {
$this->action_init_process($action); $this->action_init_process($action);
return $this->download_process($action, $output_type, $uid); return $this->download_process($action, $output_type, $uid);
}); } catch (\Throwable $e) {
return $this->action_redirect_process('error', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 다운로드 오류:" . $e->getMessage());
}
} }
} }