dbms_init...1

This commit is contained in:
choi.jh 2025-06-11 09:55:42 +09:00
parent 670d67f6f1
commit 5e705984c4
13 changed files with 752 additions and 53 deletions

View File

@ -92,16 +92,14 @@ class ServiceController extends CustomerController
}
return $options;
}
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"]): RedirectResponse|string
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
{
switch ($this->getAction()) {
case 'index':
$this->control = $this->getControlDatas();
$this->getHelper()->setViewDatas($this->getViewDatas());
$result = view($this->view_path . 'service' . DIRECTORY_SEPARATOR . $this->getAction(), ['viewDatas' => $this->getViewDatas()]);
$result = parent::getResultSuccess($message, $this->request->getVar('ActionTemplate') ?? 'service');
break;
default:
$result = parent::getResultSuccess($message);
$result = parent::getResultSuccess($message, $actionTemplate);
break;
}
return $result;

View File

@ -61,16 +61,14 @@ class ServiceHistoryController extends CustomerController
}
return $options;
}
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"]): RedirectResponse|string
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
{
switch ($this->getAction()) {
case 'index':
$this->control = $this->getControlDatas();
$this->getHelper()->setViewDatas($this->getViewDatas());
$result = view($this->view_path . 'popup' . DIRECTORY_SEPARATOR . $this->getAction(), ['viewDatas' => $this->getViewDatas()]);
$result = parent::getResultSuccess($message, $this->request->getVar('ActionTemplate') ?? 'popup');
break;
default:
$result = parent::getResultSuccess($message);
$result = parent::getResultSuccess($message, $actionTemplate);
break;
}
return $result;

View File

@ -2,11 +2,12 @@
namespace App\Controllers\Admin;
use App\Helpers\UserHelper;
use App\Services\UserService;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
use App\Services\UserService;
use App\Helpers\UserHelper;
class Home extends AdminController
{
@ -32,7 +33,7 @@ class Home extends AdminController
}
//Index,FieldForm관련
public function index(): string
public function index(): RedirectResponse|string
{
helper(['form']);
return view('admin/welcome_message', ['viewDatas' => $this->getViewDatas()]);

View File

@ -55,9 +55,10 @@ class MyLogController extends AdminController
}
break;
default:
$options = parent::getFormFieldOption($field . $options);
$options = parent::getFormFieldOption($field, $options);
break;
}
// dd($options);
return $options;
}
//Index,FieldForm관련

View File

@ -35,24 +35,14 @@ abstract class AuthController extends CommonController
return $this->_helper;
}
//로그인 실패시 오류에서는 Logger에 남기지 않아야 함.
protected function getResultFail(string $message = MESSAGES["FAILED"]): RedirectResponse|string
{
if (env('app.debug.' . $this->getAction())) {
$result = $message;
} else {
$result = redirect()->back()->withInput()->with('error', $message);
}
return $result;
}
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"]): RedirectResponse|string
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
{
switch ($this->getAction()) {
case 'create':
$result = redirect()->to($this->getMyAuth()->popPreviousUrl())->with('error', $message);
break;
default:
$result = parent::getResultSuccess($message);
$result = parent::getResultSuccess($message, $actionTemplate);
break;
}
return $result;

View File

@ -220,18 +220,13 @@ abstract class CommonController extends BaseController
return $formDatas;
// return $validation->getValidated();
}
protected function getResultFail(string $message = MESSAGES["FAILED"]): RedirectResponse|string
final protected function getResultFail(string $message = MESSAGES["FAILED"]): RedirectResponse
{
if (env('app.debug.' . $this->getAction())) {
$result = $message;
} else {
LogCollector::debug($message);
$this->getMyLogService()->save($this->getService(), __FUNCTION__, $this->getMyAuth(), $message);
$result = redirect()->back()->withInput()->with('error', $message);
}
return $result;
LogCollector::debug($message);
$this->getMyLogService()->save($this->getService(), __FUNCTION__, $this->getMyAuth(), $message);
return redirect()->back()->withInput()->with('error', $message);
}
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"]): RedirectResponse|string
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
{
switch ($this->getAction()) {
case 'create':
@ -242,17 +237,18 @@ abstract class CommonController extends BaseController
case 'create_form':
case 'modify_form':
case 'login_form':
case 'index':
case 'view':
case 'index':
case 'download':
$this->view_template = $this->view_path . $this->getAction();
$actionFrameType = $this->request->getVar('ActionFrameType');
if ($actionFrameType) {
$this->view_template = $this->view_path . $actionFrameType . DIRECTORY_SEPARATOR . $this->getAction();
}
$this->control = $this->getControlDatas();
$this->getHelper()->setViewDatas($this->getViewDatas());
$result = view($this->view_template, ['viewDatas' => $this->getViewDatas()]);
$actionTemplate = $this->request->getVar('ActionTemplate') ?? $actionTemplate;
if ($actionTemplate) {
$view_file = $this->view_path . $actionTemplate . DIRECTORY_SEPARATOR . $this->getAction();
} else {
$view_file = $this->view_path . $this->getAction();
}
$result = view($view_file, ['viewDatas' => $this->getViewDatas()]);
break;
default:
$result = redirect()->to($this->getMyAuth()->popPreviousUrl())->with('error', $message);
@ -667,7 +663,7 @@ abstract class CommonController extends BaseController
$this->getService()->getModel()->offset(($this->page - 1) * $this->per_page);
return $this->getService()->getEntities();
}
public function index()
public function index(): RedirectResponse|string
{
try {
//각 Field 초기화
@ -682,7 +678,8 @@ abstract class CommonController extends BaseController
$this->entities = $this->index_process();
return $this->getResultSuccess();
} catch (\Exception $e) {
return $this->getResultFail($e->getMessage());
return $e->getMessage();
// return $this->getResultFail($e->getMessage());
}
}

View File

@ -275,7 +275,7 @@ class CommonHelper
$extra_class = isset($extras['class']) ? $extras['class'] . ' select-field' : 'select-field';
$form = form_dropdown($field, $formOptions, $value, ['class' => $extra_class, ...array_diff_key($extras, ['class' => ''])]);
} else {
$form = form_input($field, $value ?? "", ["autocomplete" => $field, $extras]);
$form = form_input($field, $value ?? "", $extras);
}
break;
}

View File

@ -23,7 +23,7 @@ class ClientHelper extends CustomerHelper
number_format(intval($value)),
'index',
[
"data-src" => "/admin/customer/account?clientinfo_uid={$viewDatas['entity']->getPK()}&ActionFrameType=popup",
"data-src" => "/admin/customer/account?clientinfo_uid={$viewDatas['entity']->getPK()}&ActionTemplate=popup",
"data-bs-toggle" => "modal",
"data-bs-target" => "#index_action_form",
...$extras
@ -36,7 +36,7 @@ class ClientHelper extends CustomerHelper
number_format(intval($value)),
'index',
[
"data-src" => "/admin/customer/coupon?clientinfo_uid={$viewDatas['entity']->getPK()}&ActionFrameType=popup",
"data-src" => "/admin/customer/coupon?clientinfo_uid={$viewDatas['entity']->getPK()}&ActionTemplate=popup",
"data-bs-toggle" => "modal",
"data-bs-target" => "#index_action_form",
...$extras
@ -49,7 +49,7 @@ class ClientHelper extends CustomerHelper
number_format(intval($value)),
'index',
[
"data-src" => "/admin/customer/point?clientinfo_uid={$viewDatas['entity']->getPK()}&ActionFrameType=popup",
"data-src" => "/admin/customer/point?clientinfo_uid={$viewDatas['entity']->getPK()}&ActionTemplate=popup",
"data-bs-toggle" => "modal",
"data-bs-target" => "#index_action_form",
...$extras

View File

@ -31,7 +31,7 @@ class ServiceHelper extends CustomerHelper
ICONS['SETUP'],
$field,
[
"data-src" => "/admin/customer/serviceitem?serviceinfo_uid={$viewDatas['entity']->getPK()}&item_type={$field}&ActionFrameType=popup",
"data-src" => "/admin/customer/serviceitem?serviceinfo_uid={$viewDatas['entity']->getPK()}&item_type={$field}&ActionTemplate=popup",
"data-bs-toggle" => "modal",
"data-bs-target" => "#index_action_form",
...$extras

View File

@ -16,7 +16,7 @@ class MyLogHelper extends CommonHelper
public function getFieldView(string $field, array $viewDatas, array $extras = []): string
{
$value = $viewDatas['entity']->$field;
$value = $viewDatas['entity']->$field ?? "";
switch ($field) {
case 'content':
$value = nl2br($value);

View File

@ -26,7 +26,7 @@ abstract class CommonService
}
public function getViewFields(): array
{
return $this->getModel()->getAllowedFields();
return $this->getFormFields();
}
final public function __get($name)
{

View File

@ -45,7 +45,7 @@ class MyLogService extends CommonService
}
public function getIndexFields(): array
{
return ['user_uid', 'class_name', 'method_name', 'title', 'status', 'created_at', 'content'];
return ['user_uid', 'class_name', 'method_name', 'title', 'status', 'created_at'];
}
public function save($service, string $method, AuthService $myauth, string $title): MyLogEntity
{

714
dbms_init_all.sq Normal file

File diff suppressed because one or more lines are too long