cfmgrv4 init...10
This commit is contained in:
parent
b74684f8bd
commit
0490e8731f
@ -88,8 +88,8 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
|
||||
$routes->get('view/(:num)', 'AuthController::view/$1');
|
||||
$routes->get('delete/(:num)', 'AuthController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'AuthController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'AuthController::batchjob');
|
||||
$routes->post('batchjob_delete', 'AuthController::batchjob_delete');
|
||||
// $routes->post('batchjob', 'AuthController::batchjob');
|
||||
// $routes->post('batchjob_delete', 'AuthController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'AccountController::download/$1');
|
||||
});
|
||||
$routes->group('account', ['namespace' => 'App\Controllers\Admin\Cloudflare'], function ($routes) {
|
||||
|
||||
@ -7,6 +7,9 @@ use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use App\Services\MyLogService;
|
||||
|
||||
abstract class AdminController extends CommonController
|
||||
{
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
@ -16,4 +19,89 @@ abstract class AdminController extends CommonController
|
||||
$this->uri_path = "admin/";
|
||||
$this->view_path = "admin/";
|
||||
}
|
||||
|
||||
|
||||
protected function create_process_result($message): RedirectResponse|string
|
||||
{
|
||||
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, $message, $this->myauth->getUIDByAuthInfo());
|
||||
return parent::create_process_result($message);
|
||||
// $this->init(__FUNCTION__);
|
||||
// helper(['form']);
|
||||
// $this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
|
||||
// return view(
|
||||
// strtolower($this->view_path . $this->getService()->getClassPath() . "/create_result"),
|
||||
// data: ['viewDatas' => $this->getViewDatas()]
|
||||
// );
|
||||
}
|
||||
protected function create_process_failed($message): RedirectResponse|string
|
||||
{
|
||||
MyLogService::add("error", $message);
|
||||
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, MESSAGES["FAILED"], $this->myauth->getUIDByAuthInfo());
|
||||
return parent::create_process_failed($message);
|
||||
}
|
||||
|
||||
//수정관련
|
||||
protected function modify_process_result($message): RedirectResponse|string
|
||||
{
|
||||
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, $message, $this->myauth->getUIDByAuthInfo());
|
||||
return parent::modify_process_result($message);
|
||||
}
|
||||
protected function modify_process_failed($message): RedirectResponse|string
|
||||
{
|
||||
MyLogService::add("error", $message);
|
||||
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, MESSAGES["FAILED"], $this->myauth->getUIDByAuthInfo());
|
||||
return parent::modify_process_failed($message);
|
||||
}
|
||||
|
||||
//단일필드작업
|
||||
protected function toggle_process_result($message): RedirectResponse|string
|
||||
{
|
||||
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, $message, $this->myauth->getUIDByAuthInfo());
|
||||
return parent::toggle_process_result($message);
|
||||
}
|
||||
protected function toggle_process_failed($message): RedirectResponse|string
|
||||
{
|
||||
MyLogService::add("error", $message);
|
||||
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, MESSAGES["FAILED"], $this->myauth->getUIDByAuthInfo());
|
||||
return parent::toggle_process_failed($message);
|
||||
}
|
||||
|
||||
//일괄처리작업
|
||||
protected function batchjob_process_result($message): RedirectResponse|string
|
||||
{
|
||||
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, $message, $this->myauth->getUIDByAuthInfo());
|
||||
return parent::batchjob_process_result($message);
|
||||
}
|
||||
protected function batchjob_process_failed($message): RedirectResponse|string
|
||||
{
|
||||
MyLogService::add("error", $message);
|
||||
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, MESSAGES["FAILED"], $this->myauth->getUIDByAuthInfo());
|
||||
return parent::batchjob_process_failed($message);
|
||||
}
|
||||
|
||||
//Delete관련
|
||||
protected function delete_process_result($message): RedirectResponse|string
|
||||
{
|
||||
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, $message, $this->myauth->getUIDByAuthInfo());
|
||||
return parent::delete_process_result($message);
|
||||
}
|
||||
protected function delete_process_failed($message): RedirectResponse|string
|
||||
{
|
||||
MyLogService::add("error", $message);
|
||||
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, MESSAGES["FAILED"], $this->myauth->getUIDByAuthInfo());
|
||||
return parent::delete_process_failed($message);
|
||||
}
|
||||
|
||||
//일괄삭제관련
|
||||
protected function batchjob_delete_process_result($message): RedirectResponse|string
|
||||
{
|
||||
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, $message, $this->myauth->getUIDByAuthInfo());
|
||||
return parent::batchjob_delete_process_result($message);
|
||||
}
|
||||
protected function batchjob_delete_process_failed($message): RedirectResponse|string
|
||||
{
|
||||
MyLogService::add("error", $message);
|
||||
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, MESSAGES["FAILED"], $this->myauth->getUIDByAuthInfo());
|
||||
return parent::batchjob_delete_process_failed($message);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,8 +4,6 @@ namespace App\Controllers\Admin\Cloudflare;
|
||||
|
||||
use App\Helpers\Cloudflare\AccountHelper;
|
||||
use App\Services\Cloudflare\AccountService;
|
||||
use CodeIgniter\HTTP\DownloadResponse;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
@ -42,24 +40,7 @@ class AccountController extends CloudflareController
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
//View
|
||||
public function view(string $uid): RedirectResponse|string
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->view_procedure($uid);
|
||||
}
|
||||
// 리스트
|
||||
public function index(): string
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->list_procedure();
|
||||
}
|
||||
// Download
|
||||
public function download(string $output_type, mixed $uid = false): DownloadResponse|string
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->download_procedure($output_type, $uid);
|
||||
}
|
||||
|
||||
//reload Account By Auth
|
||||
protected function reload_process(mixed $uid): void
|
||||
{
|
||||
@ -70,8 +51,4 @@ class AccountController extends CloudflareController
|
||||
}
|
||||
$this->getService()->reload($this->auth_entity);
|
||||
}
|
||||
public function reload(int $uid): RedirectResponse
|
||||
{
|
||||
return $this->reload_procedure($uid);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,10 +3,7 @@
|
||||
namespace App\Controllers\Admin\Cloudflare;
|
||||
|
||||
use App\Helpers\Cloudflare\AuditLogHelper;
|
||||
use App\Models\Cloudflare\AuditLogModel;
|
||||
use App\Services\Cloudflare\AuditLogService;
|
||||
use CodeIgniter\HTTP\DownloadResponse;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
@ -29,28 +26,11 @@ class AuditLogController extends CloudflareController
|
||||
}
|
||||
return $this->service;
|
||||
}
|
||||
//View
|
||||
public function view(string $uid): RedirectResponse|string
|
||||
{
|
||||
$this->init(__FUNCTION__, ['zone_name', $this->getService()->getModel()::TITLE, 'actor', 'action_info', 'interface', 'meta', 'resource', 'status', 'updated_at', 'created_at']);
|
||||
return $this->view_procedure($uid);
|
||||
}
|
||||
// 리스트
|
||||
protected function list_entitys_process(): array
|
||||
protected function index_entitys_process(): array
|
||||
{
|
||||
//기본Soring처리
|
||||
$this->getService()->getModel()->orderBy("created_at DESC,zone_name ASC");
|
||||
return parent::list_entitys_process();
|
||||
}
|
||||
public function index(): string
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->list_procedure();
|
||||
}
|
||||
// Download
|
||||
public function download(string $output_type, mixed $uid = false): DownloadResponse|string
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->download_procedure($output_type, $uid);
|
||||
return parent::index_entitys_process();
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,8 +4,6 @@ namespace App\Controllers\Admin\Cloudflare;
|
||||
|
||||
use App\Helpers\Cloudflare\AuthHelper;
|
||||
use App\Services\Cloudflare\AuthService;
|
||||
use CodeIgniter\HTTP\DownloadResponse;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
@ -27,55 +25,19 @@ class AuthController extends CloudflareController
|
||||
}
|
||||
return $this->service;
|
||||
}
|
||||
//생성
|
||||
public function create_form(): RedirectResponse|string
|
||||
protected function create_init(string $action, $fields = []): void
|
||||
{
|
||||
$this->init('create', [$this->getService()->getModel()::TITLE, 'authkey', 'status']);
|
||||
return $this->create_form_procedure();
|
||||
}
|
||||
public function create(): RedirectResponse|string
|
||||
{
|
||||
$this->init(__FUNCTION__, [$this->getService()->getModel()::TITLE, 'authkey', 'status']);
|
||||
return $this->create_procedure();
|
||||
$fields = [
|
||||
'fields' => [$this->getService()->getModel()::TITLE, 'authkey', 'status'],
|
||||
];
|
||||
parent::create_init($action, fields: $fields);
|
||||
}
|
||||
//수정
|
||||
public function modify_form(int $uid): RedirectResponse|string
|
||||
protected function modify_init(string $action, $fields = []): void
|
||||
{
|
||||
$this->init('modify', [$this->getService()->getModel()::TITLE, 'authkey', 'status']);
|
||||
return $this->modify_form_procedure($uid);
|
||||
}
|
||||
public function modify(int $uid): RedirectResponse|string
|
||||
{
|
||||
$this->init(__FUNCTION__, [$this->getService()->getModel()::TITLE, 'authkey', 'status']);
|
||||
return $this->modify_procedure($uid);
|
||||
}
|
||||
//단일필드작업
|
||||
public function toggle(mixed $uid, string $field): RedirectResponse
|
||||
{
|
||||
return $this->toggle_procedure($uid, $field);
|
||||
}
|
||||
//일괄처리작업
|
||||
public function batchjob(): RedirectResponse
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->batchjob_procedure();
|
||||
}
|
||||
//View
|
||||
public function view(int $uid): RedirectResponse|string
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->view_procedure($uid);
|
||||
}
|
||||
// 리스트
|
||||
public function index(): string
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->list_procedure();
|
||||
}
|
||||
// Download
|
||||
public function download(string $output_type, mixed $uid = false): DownloadResponse|string
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->download_procedure($output_type, $uid);
|
||||
$fields = [
|
||||
'fields' => [$this->getService()->getModel()::TITLE, 'authkey', 'status'],
|
||||
];
|
||||
parent::modify_init($action, $fields);
|
||||
}
|
||||
}
|
||||
|
||||
@ -55,124 +55,29 @@ abstract class CloudflareController extends AdminController
|
||||
return $this->_recordModel;
|
||||
}
|
||||
|
||||
//생성관련
|
||||
protected function create_process_result($message): RedirectResponse|string
|
||||
{
|
||||
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, $message, $this->myauth->getUIDByAuthInfo());
|
||||
return parent::create_process_result($message);
|
||||
// $this->init(__FUNCTION__);
|
||||
// helper(['form']);
|
||||
// $this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
|
||||
// return view(
|
||||
// strtolower($this->view_path . $this->getService()->getClassPath() . "/create_result"),
|
||||
// data: ['viewDatas' => $this->getViewDatas()]
|
||||
// );
|
||||
}
|
||||
protected function create_process_failed($message): RedirectResponse|string
|
||||
{
|
||||
MyLogService::add("error", $message);
|
||||
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, MESSAGES["FAILED"], $this->myauth->getUIDByAuthInfo());
|
||||
return parent::create_process_failed($message);
|
||||
}
|
||||
|
||||
//수정관련
|
||||
protected function modify_process_result($message): RedirectResponse|string
|
||||
{
|
||||
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, $message, $this->myauth->getUIDByAuthInfo());
|
||||
return parent::modify_process_result($message);
|
||||
}
|
||||
protected function modify_process_failed($message): RedirectResponse|string
|
||||
{
|
||||
MyLogService::add("error", $message);
|
||||
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, MESSAGES["FAILED"], $this->myauth->getUIDByAuthInfo());
|
||||
return parent::modify_process_failed($message);
|
||||
}
|
||||
|
||||
//단일필드작업
|
||||
protected function toggle_process_result($message): RedirectResponse|string
|
||||
{
|
||||
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, $message, $this->myauth->getUIDByAuthInfo());
|
||||
return parent::toggle_process_result($message);
|
||||
}
|
||||
protected function toggle_process_failed($message): RedirectResponse|string
|
||||
{
|
||||
MyLogService::add("error", $message);
|
||||
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, MESSAGES["FAILED"], $this->myauth->getUIDByAuthInfo());
|
||||
return parent::toggle_process_failed($message);
|
||||
}
|
||||
|
||||
//일괄처리작업
|
||||
protected function batchjob_process_result($message): RedirectResponse|string
|
||||
{
|
||||
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, $message, $this->myauth->getUIDByAuthInfo());
|
||||
return parent::batchjob_process_result($message);
|
||||
}
|
||||
protected function batchjob_process_failed($message): RedirectResponse|string
|
||||
{
|
||||
MyLogService::add("error", $message);
|
||||
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, MESSAGES["FAILED"], $this->myauth->getUIDByAuthInfo());
|
||||
return parent::batchjob_process_failed($message);
|
||||
}
|
||||
|
||||
//Delete관련
|
||||
protected function delete_process_result($message): RedirectResponse|string
|
||||
{
|
||||
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, $message, $this->myauth->getUIDByAuthInfo());
|
||||
return parent::delete_process_result($message);
|
||||
}
|
||||
protected function delete_process_failed($message): RedirectResponse|string
|
||||
{
|
||||
MyLogService::add("error", $message);
|
||||
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, MESSAGES["FAILED"], $this->myauth->getUIDByAuthInfo());
|
||||
return parent::delete_process_failed($message);
|
||||
}
|
||||
|
||||
//일괄삭제
|
||||
protected function batchdelete_process_result($message): RedirectResponse|string
|
||||
{
|
||||
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, $message, $this->myauth->getUIDByAuthInfo());
|
||||
return parent::batchjob_delete_process_result($message);
|
||||
}
|
||||
protected function batchdelete_process_failed($message): RedirectResponse|string
|
||||
{
|
||||
MyLogService::add("error", $message);
|
||||
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, MESSAGES["FAILED"], $this->myauth->getUIDByAuthInfo());
|
||||
return parent::batchjob_delete_process_failed($message);
|
||||
}
|
||||
|
||||
//Sync관련련
|
||||
//Sync관련
|
||||
protected function sync_process(string $uid): void {}
|
||||
protected function sync_process_result($message): RedirectResponse|string
|
||||
{
|
||||
return redirect()->to($this->myauth->popPreviousUrl())->with('error', $message);
|
||||
}
|
||||
final protected function sync_procedure(string $uid): RedirectResponse
|
||||
{
|
||||
//Transaction Start
|
||||
$this->getService()->getModel()->transStart();
|
||||
try {
|
||||
$this->sync_process($uid);
|
||||
if ($this->isMyLog) {
|
||||
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, MESSAGES["SUCCESS"], $this->myauth->getUIDByAuthInfo());
|
||||
}
|
||||
$this->getService()->getModel()->transCommit();
|
||||
return $this->sync_process_result(MESSAGES["SUCCESS"]);
|
||||
return redirect()->to($this->myauth->popPreviousUrl())->with('error', MESSAGES["SUCCESS"]);
|
||||
} catch (\Exception $e) {
|
||||
//Transaction Rollback
|
||||
$this->getService()->getModel()->transRollback();
|
||||
if ($this->isMyLog) {
|
||||
MyLogService::add("error", $e->getMessage());
|
||||
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, MESSAGES["FAILED"], $this->myauth->getUIDByAuthInfo());
|
||||
return redirect()->to($this->myauth->popPreviousUrl())->with('error', $e->getMessage());
|
||||
}
|
||||
return redirect()->back()->with('error', $e->getMessage());
|
||||
}
|
||||
final public function sync(string $uid): RedirectResponse
|
||||
{
|
||||
return $this->sync_procedure($uid);
|
||||
}
|
||||
|
||||
//Reload관련
|
||||
protected function reload_process(mixed $uid): void {}
|
||||
protected function reload_process_result($message): RedirectResponse|string
|
||||
{
|
||||
return redirect()->to($this->myauth->popPreviousUrl())->with('error', $message);
|
||||
}
|
||||
final protected function reload_procedure(mixed $uid): RedirectResponse
|
||||
{
|
||||
//Transaction Start
|
||||
@ -183,7 +88,7 @@ abstract class CloudflareController extends AdminController
|
||||
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, MESSAGES["SUCCESS"], $this->myauth->getUIDByAuthInfo());
|
||||
}
|
||||
$this->getService()->getModel()->transCommit();
|
||||
return $this->reload_process_result(MESSAGES["SUCCESS"]);
|
||||
return redirect()->to($this->myauth->popPreviousUrl())->with('error', MESSAGES["SUCCESS"]);
|
||||
} catch (\Exception $e) {
|
||||
//Transaction Rollback
|
||||
$this->getService()->getModel()->transRollback();
|
||||
@ -194,4 +99,8 @@ abstract class CloudflareController extends AdminController
|
||||
return redirect()->back()->with('error', $e->getMessage());
|
||||
}
|
||||
}
|
||||
final public function reload(string $uid): RedirectResponse
|
||||
{
|
||||
return $this->reload_procedure($uid);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,14 +2,14 @@
|
||||
|
||||
namespace App\Controllers\Admin\Cloudflare;
|
||||
|
||||
use CodeIgniter\HTTP\DownloadResponse;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
|
||||
use App\Entities\Cloudflare\ZoneEntity;
|
||||
use App\Helpers\Cloudflare\FirewallHelper;
|
||||
use App\Models\Cloudflare\ZoneModel;
|
||||
use App\Services\Cloudflare\FirewallService;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use App\Services\Cloudflare\FirewallService;
|
||||
use App\Helpers\Cloudflare\FirewallHelper;
|
||||
use App\Models\Cloudflare\ZoneModel;
|
||||
|
||||
class FirewallController extends CloudflareController
|
||||
{
|
||||
@ -19,7 +19,6 @@ class FirewallController extends CloudflareController
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->title = lang("{$this->getService()->getClassPath()}.title");
|
||||
$this->helper = new FirewallHelper();
|
||||
$this->isMyLog = env("mylog.cloudflare.firewall.use") == "true"; //MyLogService 사용여부
|
||||
}
|
||||
protected function getService(): FirewallService
|
||||
{
|
||||
@ -45,6 +44,17 @@ class FirewallController extends CloudflareController
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
//부모데이터 정의
|
||||
private function getParentEntity($uid): ZoneEntity
|
||||
{
|
||||
//부모데이터정의
|
||||
$zone_entity = $this->getZoneModel()->getEntityByPK($uid);
|
||||
if ($zone_entity === null) {
|
||||
throw new \Exception("Zone: [{$this->entity->getParent()}] 정보를 찾을수 없습니다.");
|
||||
}
|
||||
return $zone_entity;
|
||||
}
|
||||
|
||||
//수정 (modify,toggle,batchjob사용)
|
||||
protected function modify_process(mixed $uid): void
|
||||
{
|
||||
@ -56,25 +66,14 @@ class FirewallController extends CloudflareController
|
||||
throw new \Exception("{$uid} 정보를 찾을수 없습니다.");
|
||||
}
|
||||
//부모데이터정의
|
||||
$this->_zone_entity = $this->getZoneModel()->getEntityByPK($this->entity->getParent());
|
||||
if ($this->_zone_entity === null) {
|
||||
throw new \Exception("Zone: [{$this->entity->getParent()}] 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->_zone_entity = $this->getParentEntity($this->entity->getParent());
|
||||
//Socket처리
|
||||
$this->entity = $this->getService()->modify($this->_zone_entity, $this->entity, $this->formDatas);
|
||||
}
|
||||
//View
|
||||
//create_process_result에서 결과값을 entitys에 저장하고 호출하기때문에 아래와 같이 처리함
|
||||
//create_process_result에서 같이 사용한다는 점 주의
|
||||
public function view(string $uid): RedirectResponse|string
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->view_procedure($uid);
|
||||
}
|
||||
// 리스트
|
||||
protected function list_entitys_process(): array
|
||||
protected function index_entitys_process(): array
|
||||
{
|
||||
$this->list_condition_process();
|
||||
$this->index_condition_process();
|
||||
//기본Soring처리
|
||||
$this->getService()->getModel()->orderBy(ZoneModel::TABLE . "." . ZoneModel::TITLE . " ASC ," . $this->getService()->getModel()::TITLE . " ASC");
|
||||
//Sorting 처리
|
||||
@ -101,29 +100,11 @@ class FirewallController extends CloudflareController
|
||||
log_message("debug", $this->getService()->getModel()->getLastQuery());
|
||||
return $entitys;
|
||||
}
|
||||
public function index(): string
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->list_procedure();
|
||||
}
|
||||
// Download
|
||||
public function download(string $output_type, mixed $uid = false): DownloadResponse|string
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->download_procedure($output_type, $uid);
|
||||
}
|
||||
//reload Firewall By Zone
|
||||
protected function reload_process(mixed $uid): void
|
||||
{
|
||||
//부모데이터정의
|
||||
$this->_zone_entity = $this->getZoneModel()->getEntityByPK($uid);
|
||||
if ($this->_zone_entity === null) {
|
||||
throw new \Exception("Zone: [{$uid}] 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->getService()->reload($this->_zone_entity);
|
||||
}
|
||||
public function reload(string $uid): RedirectResponse
|
||||
{
|
||||
return $this->reload_procedure($uid);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,14 +2,14 @@
|
||||
|
||||
namespace App\Controllers\Admin\Cloudflare;
|
||||
|
||||
use CodeIgniter\HTTP\DownloadResponse;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use App\Entities\Cloudflare\ZoneEntity;
|
||||
use App\Helpers\Cloudflare\RecordHelper;
|
||||
use App\Services\Cloudflare\RecordService;
|
||||
use App\Models\Cloudflare\ZoneModel;
|
||||
use App\Services\Cloudflare\RecordService;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
|
||||
class RecordController extends CloudflareController
|
||||
{
|
||||
@ -44,15 +44,28 @@ class RecordController extends CloudflareController
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
//생성
|
||||
public function create_form(): RedirectResponse|string
|
||||
|
||||
//부모데이터 정의
|
||||
private function getParentEntity($uid): ZoneEntity
|
||||
{
|
||||
$this->init('create', [$this->getService()->getModel()::PARENT, 'hosts', 'type', 'content', 'proxied']);
|
||||
$this->field_rules = $this->getService()->getModel()->getFieldRules($this->action, $this->fields);
|
||||
//부모데이터정의
|
||||
$zone_entity = $this->getZoneModel()->getEntityByPK($uid);
|
||||
if ($zone_entity === null) {
|
||||
throw new \Exception("Zone: [{$this->entity->getParent()}] 정보를 찾을수 없습니다.");
|
||||
}
|
||||
return $zone_entity;
|
||||
}
|
||||
|
||||
//생성
|
||||
protected function create_init(string $action, $fields = []): void
|
||||
{
|
||||
$fields = [
|
||||
'fields' => [$this->getService()->getModel()::PARENT, 'hosts', 'type', 'content', 'proxied'],
|
||||
];
|
||||
parent::create_init($action, $fields);
|
||||
//부모데이터 정의
|
||||
$parent_field = $this->getService()->getModel()::PARENT;
|
||||
$this->$parent_field = $this->request->getVar($parent_field) ?: DEFAULTS["EMPTY"];
|
||||
return $this->create_form_procedure();
|
||||
$this->$parent_field = $this->request->getVar($parent_field) ?? DEFAULTS["EMPTY"];
|
||||
}
|
||||
protected function create_process(): void
|
||||
{
|
||||
@ -78,10 +91,7 @@ class RecordController extends CloudflareController
|
||||
}
|
||||
//Socket처리
|
||||
//부모데이터정의
|
||||
$this->_zone_entity = $this->getZoneModel()->getEntityByPK($this->formDatas[$this->getService()->getModel()::PARENT]);
|
||||
if ($this->_zone_entity === null) {
|
||||
throw new \Exception("Zone: [{$this->formDatas[$this->getService()->getModel()::PARENT]}] 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->_zone_entity = $this->getParentEntity($this->formDatas[$this->getService()->getModel()::PARENT]);
|
||||
$entitys = [];
|
||||
foreach ($hosts as $host) {
|
||||
$entity = $this->getService()->create(
|
||||
@ -105,12 +115,6 @@ class RecordController extends CloudflareController
|
||||
data: ['viewDatas' => $this->getViewDatas()]
|
||||
);
|
||||
}
|
||||
public function create(): RedirectResponse|string
|
||||
{
|
||||
$this->init(__FUNCTION__, [$this->getService()->getModel()::PARENT, 'hosts', 'type', 'content', 'proxied']);
|
||||
$this->field_rules = $this->getService()->getModel()->getFieldRules($this->action, $this->fields);
|
||||
return $this->create_procedure();
|
||||
}
|
||||
//수정 (modify,toggle,batchjob사용)
|
||||
protected function modify_process(mixed $uid): void
|
||||
{
|
||||
@ -122,31 +126,10 @@ class RecordController extends CloudflareController
|
||||
throw new \Exception("{$uid} 정보를 찾을수 없습니다.");
|
||||
}
|
||||
//부모데이터정의
|
||||
$this->_zone_entity = $this->getZoneModel()->getEntityByPK($this->entity->getParent());
|
||||
if ($this->_zone_entity === null) {
|
||||
throw new \Exception("Zone: [{$this->entity->getParent()}] 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->_zone_entity = $this->getParentEntity($this->entity->getParent());
|
||||
//Socket처리
|
||||
$this->entity = $this->getService()->modify($this->_zone_entity, $this->entity, $this->formDatas);
|
||||
}
|
||||
//단일필드작업
|
||||
public function toggle(mixed $uid, string $field): RedirectResponse
|
||||
{
|
||||
return $this->toggle_procedure($uid, $field);
|
||||
}
|
||||
//일괄처리작업
|
||||
public function batchjob(): RedirectResponse
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->batchjob_procedure();
|
||||
}
|
||||
//View
|
||||
//create_process_result에서 결과값을 entitys에 저장하고 호출하기때문에 아래와 같이 처리함
|
||||
public function view(string $uid): RedirectResponse|string
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->view_procedure($uid);
|
||||
}
|
||||
//삭제
|
||||
protected function delete_process(mixed $uid): void
|
||||
{
|
||||
@ -157,15 +140,32 @@ class RecordController extends CloudflareController
|
||||
throw new \Exception("{$uid} 정보를 찾을수 없습니다.");
|
||||
}
|
||||
//부모데이터정의
|
||||
$this->_zone_entity = $this->getZoneModel()->getEntityByPK($this->entity->getParent());
|
||||
if ($this->_zone_entity === null) {
|
||||
throw new \Exception("Zone: [{$this->entity->getParent()}] 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->_zone_entity = $this->getParentEntity($this->entity->getParent());
|
||||
//Cloudflare 삭제
|
||||
$this->entity = $this->getService()->delete($this->_zone_entity, $this->entity);
|
||||
}
|
||||
//Sync작업
|
||||
protected function sync_process(string $uid): void
|
||||
{
|
||||
//자신정보정의
|
||||
$this->entity = $this->getService()->getModel()->getEntityByPK($uid);
|
||||
if ($this->entity === null) {
|
||||
throw new \Exception("{$uid} 정보를 찾을수 없습니다.");
|
||||
}
|
||||
//부모데이터정의
|
||||
$this->_zone_entity = $this->getParentEntity($this->entity->getParent());
|
||||
//Socket처리
|
||||
$this->entity = $this->getService()->sync($this->_zone_entity, $this->entity);
|
||||
}
|
||||
//reload Record By Zone
|
||||
protected function reload_process(mixed $zone_uid): void
|
||||
{
|
||||
//부모데이터정의
|
||||
$this->_zone_entity = $this->getParentEntity($zone_uid);
|
||||
$this->getService()->reload($this->_zone_entity);
|
||||
}
|
||||
//리스트
|
||||
protected function list_entitys_process(): array
|
||||
protected function index_entitys_process(): array
|
||||
{
|
||||
//기본Soring처리
|
||||
$this->getService()->getModel()->orderBy(ZoneModel::TABLE . "." . ZoneModel::TITLE . " ASC ," . $this->getService()->getModel()::TITLE . " ASC");
|
||||
@ -177,51 +177,6 @@ class RecordController extends CloudflareController
|
||||
ZoneModel::TABLE,
|
||||
ZoneModel::PK
|
||||
));
|
||||
return parent::list_entitys_process();
|
||||
}
|
||||
public function index(): string
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->list_procedure();
|
||||
}
|
||||
// Download
|
||||
public function download(string $output_type, mixed $uid = false): DownloadResponse|string
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->download_procedure($output_type, $uid);
|
||||
}
|
||||
//Sync작업
|
||||
protected function sync_process(string $uid): void
|
||||
{
|
||||
//자신정보정의
|
||||
$this->entity = $this->getService()->getModel()->getEntityByPK($uid);
|
||||
if ($this->entity === null) {
|
||||
throw new \Exception("{$uid} 정보를 찾을수 없습니다.");
|
||||
}
|
||||
//부모데이터정의
|
||||
$this->_zone_entity = $this->getZoneModel()->getEntityByPK($this->entity->getParent());
|
||||
if ($this->_zone_entity === null) {
|
||||
throw new \Exception("Zone: [{$this->entity->getParent()}] 정보를 찾을수 없습니다.");
|
||||
}
|
||||
//Socket처리
|
||||
$this->entity = $this->getService()->sync($this->_zone_entity, $this->entity);
|
||||
}
|
||||
public function sync(string $uid): RedirectResponse
|
||||
{
|
||||
return $this->sync_procedure($uid);
|
||||
}
|
||||
//reload Record By Zone
|
||||
protected function reload_process(mixed $uid): void
|
||||
{
|
||||
//부모데이터정의
|
||||
$this->_zone_entity = $this->getZoneModel()->getEntityByPK($uid);
|
||||
if ($this->_zone_entity === null) {
|
||||
throw new \Exception("Zone: [{$uid}] 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->getService()->reload($this->_zone_entity);
|
||||
}
|
||||
public function reload(string $uid): RedirectResponse
|
||||
{
|
||||
return $this->reload_procedure($uid);
|
||||
return parent::index_entitys_process();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,12 +2,11 @@
|
||||
|
||||
namespace App\Controllers\Admin\Cloudflare;
|
||||
|
||||
use App\Entities\Cloudflare\AccountEntity;
|
||||
use App\Helpers\Cloudflare\ZoneHelper;
|
||||
use App\Models\Cloudflare\AccountModel;
|
||||
use App\Services\Cloudflare\RecordService;
|
||||
use App\Services\Cloudflare\ZoneService;
|
||||
use CodeIgniter\HTTP\DownloadResponse;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
@ -49,28 +48,36 @@ class ZoneController extends CloudflareController
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
//생성
|
||||
public function create_form(): RedirectResponse|string
|
||||
|
||||
//부모데이터 정의
|
||||
private function getParentEntity($uid): AccountEntity
|
||||
{
|
||||
$this->init('create', [$this->getService()->getModel()::PARENT, 'domains', 'hosts', 'type', 'content', 'proxied']);
|
||||
$this->field_rules = $this->getService()->getModel()->getFieldRules($this->action, $this->fields);
|
||||
$this->filter_fields = [$this->getService()->getModel()::PARENT, 'type', 'proxied'];
|
||||
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
||||
//부모데이터정의
|
||||
$account_entity = $this->getAccountModel()->getEntityByPK($uid);
|
||||
if ($account_entity === null) {
|
||||
throw new \Exception("Zone: [{$this->entity->getParent()}] 정보를 찾을수 없습니다.");
|
||||
}
|
||||
return $account_entity;
|
||||
}
|
||||
|
||||
//생성
|
||||
protected function create_init(string $action, $fields = []): void
|
||||
{
|
||||
$fields = [
|
||||
'fields' => [$this->getService()->getModel()::PARENT, 'hosts', 'type', 'content', 'proxied'],
|
||||
'filter_fields' => [$this->getService()->getModel()::PARENT, 'type', 'proxied']
|
||||
];
|
||||
parent::create_init($action, $fields);
|
||||
//부모데이터 정의
|
||||
$parent_field = $this->getService()->getModel()::PARENT;
|
||||
$this->$parent_field = $this->request->getVar($parent_field) ?: DEFAULTS["EMPTY"];
|
||||
return $this->create_form_procedure();
|
||||
}
|
||||
protected function create_process(): void
|
||||
{
|
||||
//DB작업도 Socket에서 다 처리하므로 parent::create_process()하면 않됨
|
||||
$this->formDatas = $this->create_validate($this->action, $this->fields);
|
||||
//부모데이터 정의
|
||||
$this->_account_entity = $this->getAccountModel()->getEntityByPK($this->formDatas[$this->getService()->getModel()::PARENT]);
|
||||
if ($this->_account_entity === null) {
|
||||
throw new \Exception("Account: [{$this->formDatas[$this->getService()->getModel()::PARENT]}] 정보를 찾을수 없습니다.");
|
||||
}
|
||||
|
||||
$this->_account_entity = $this->getParentEntity($this->formDatas[$this->getService()->getModel()::PARENT]);
|
||||
//데이터검증
|
||||
//Type이 A형식일경우 IP형태인지 확인
|
||||
if ($this->formDatas['type'] === 'A') {
|
||||
@ -132,15 +139,7 @@ class ZoneController extends CloudflareController
|
||||
$this->entitys = $entitys;
|
||||
}
|
||||
|
||||
public function create(): RedirectResponse|string
|
||||
{
|
||||
$this->init(__FUNCTION__, [$this->getService()->getModel()::PARENT, 'domains', 'hosts', 'type', 'content', 'proxied']);
|
||||
$this->field_rules = $this->getService()->getModel()->getFieldRules($this->action, $this->fields);
|
||||
$this->filter_fields = [$this->getService()->getModel()::PARENT, 'type', 'proxied'];
|
||||
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
||||
return $this->create_procedure();
|
||||
}
|
||||
//수정 (modify,toggle,batchjob사용)
|
||||
//수정관련 (modify,toggle,batchjob사용)
|
||||
protected function modify_process(mixed $uid): void
|
||||
{
|
||||
//DB작업도 Socket에서 다 처리하므로 parent::modify_process($uid)하면 않됨
|
||||
@ -151,32 +150,11 @@ class ZoneController extends CloudflareController
|
||||
throw new \Exception("{$uid} 정보를 찾을수 없습니다.");
|
||||
}
|
||||
//부모데이터정의
|
||||
$this->_account_entity = $this->getAccountModel()->getEntityByPK($this->entity->getParent());
|
||||
if ($this->_account_entity === null) {
|
||||
throw new \Exception("Account: [{$this->entity->getParent()}] 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->_account_entity = $this->getParentEntity($this->entity->getParent());
|
||||
//Socket처리
|
||||
$this->entity = $this->getService()->modify($this->_account_entity, $this->entity, $this->formDatas);
|
||||
}
|
||||
public function toggle(mixed $uid, string $field): RedirectResponse
|
||||
{
|
||||
return $this->toggle_procedure($uid, $field);
|
||||
}
|
||||
//일괄처리작업
|
||||
public function batchjob(): RedirectResponse
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->batchjob_procedure();
|
||||
}
|
||||
//View
|
||||
//create_process_result에서 결과값을 entitys에 저장하고 호출하기때문에 아래와 같이 처리함
|
||||
//create_process_result에서 같이 사용한다는 점 주의
|
||||
public function view(string $uid): RedirectResponse|string
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->view_procedure($uid);
|
||||
}
|
||||
//삭제
|
||||
//삭제관련
|
||||
protected function delete_process(mixed $uid): void
|
||||
{
|
||||
//DB작업도 Socket에서 다 처리하므로 parent::delete_process($uid)하면 않됨
|
||||
@ -193,14 +171,11 @@ class ZoneController extends CloudflareController
|
||||
}
|
||||
//Zone 삭제
|
||||
//부모데이터정의
|
||||
$this->_account_entity = $this->getAccountModel()->getEntityByPK($this->entity->getParent());
|
||||
if ($this->_account_entity === null) {
|
||||
throw new \Exception("Account: [{$this->entity->getParent()}] 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->_account_entity = $this->getParentEntity($this->entity->getParent());
|
||||
$this->entity = $this->getService()->delete($this->_account_entity, $this->entity);
|
||||
}
|
||||
// 리스트
|
||||
protected function list_entitys_process(): array
|
||||
//리스트관련
|
||||
protected function index_entitys_process(): array
|
||||
{
|
||||
//기본Soring처리
|
||||
$this->getService()->getModel()->orderBy(orderBy: AccountModel::TABLE . "." . AccountModel::TITLE . " ASC ," . $this->getService()->getModel()::TITLE . " ASC");
|
||||
@ -212,20 +187,9 @@ class ZoneController extends CloudflareController
|
||||
AccountModel::TABLE,
|
||||
AccountModel::PK
|
||||
));
|
||||
return parent::list_entitys_process();
|
||||
return parent::index_entitys_process();
|
||||
}
|
||||
public function index(): string
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->list_procedure();
|
||||
}
|
||||
// Download
|
||||
public function download(string $output_type, mixed $uid = false): DownloadResponse|string
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->download_procedure($output_type, $uid);
|
||||
}
|
||||
//Sync작업
|
||||
//Sync작업관련
|
||||
protected function sync_process(mixed $uid): void
|
||||
{
|
||||
//자신정보정의
|
||||
@ -234,29 +198,15 @@ class ZoneController extends CloudflareController
|
||||
throw new \Exception("{$uid} 정보를 찾을수 없습니다.");
|
||||
}
|
||||
//부모데이터정의
|
||||
$this->_account_entity = $this->getAccountModel()->getEntityByPK($this->entity->getParent());
|
||||
if ($this->_account_entity === null) {
|
||||
throw new \Exception("Account: [{$this->entity->getParent()}] 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->_account_entity = $this->getParentEntity($this->entity->getParent());
|
||||
//Socket처리
|
||||
$this->entity = $this->getService()->sync($this->_account_entity, $this->entity);
|
||||
}
|
||||
public function sync(string $uid): RedirectResponse
|
||||
{
|
||||
return $this->sync_procedure($uid);
|
||||
}
|
||||
//reload Zone By Account
|
||||
protected function reload_process(mixed $uid): void
|
||||
//Reload작업관련
|
||||
protected function reload_process(mixed $account_uid): void
|
||||
{
|
||||
//부모데이터정의
|
||||
$this->_account_entity = $this->getAccountModel()->getEntityByPK($uid);
|
||||
if ($this->_account_entity === null) {
|
||||
throw new \Exception("Account: [{$uid}] 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->_account_entity = $this->getParentEntity($account_uid);
|
||||
$this->getService()->reload($this->_account_entity);
|
||||
}
|
||||
public function reload(string $uid): RedirectResponse
|
||||
{
|
||||
return $this->reload_procedure($uid);
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,7 +9,6 @@ use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use App\Services\MyLogService;
|
||||
|
||||
class MapurlController extends AdminController
|
||||
{
|
||||
@ -46,141 +45,28 @@ class MapurlController extends AdminController
|
||||
}
|
||||
}
|
||||
//생성
|
||||
public function create_form(): RedirectResponse|string
|
||||
protected function create_init(string $action, $fields = []): void
|
||||
{
|
||||
$this->init('create', [$this->getService()->getModel()::TITLE, 'newurl', 'status']);
|
||||
return $this->create_form_procedure();
|
||||
}
|
||||
protected function create_process_failed($message): RedirectResponse|string
|
||||
{
|
||||
MyLogService::add("error", $message);
|
||||
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, MESSAGES["FAILED"], $this->myauth->getUIDByAuthInfo());
|
||||
return parent::create_process_failed($message);
|
||||
$fields = [
|
||||
'fields' => [$this->getService()->getModel()::TITLE, 'newurl', 'status'],
|
||||
];
|
||||
parent::create_init($action, fields: $fields);
|
||||
}
|
||||
protected function create_process(): void
|
||||
{
|
||||
parent::create_process();
|
||||
$this->remaping_process();
|
||||
}
|
||||
public function create(): RedirectResponse|string
|
||||
{
|
||||
$this->init(__FUNCTION__, [$this->getService()->getModel()::TITLE, 'newurl', 'status']);
|
||||
return $this->create_procedure();
|
||||
}
|
||||
|
||||
//수정
|
||||
public function modify_form(int $uid): RedirectResponse|string
|
||||
{
|
||||
$this->init('modify', [$this->getService()->getModel()::TITLE, 'newurl', 'status']);
|
||||
return $this->modify_form_procedure($uid);
|
||||
}
|
||||
//(modify,toggle,batchjob사용)
|
||||
//수정관련
|
||||
protected function modify_process_result($message): RedirectResponse|string
|
||||
{
|
||||
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, $message, $this->myauth->getUIDByAuthInfo());
|
||||
return parent::modify_process_result($message);
|
||||
}
|
||||
protected function modify_process_failed($message): RedirectResponse|string
|
||||
{
|
||||
MyLogService::add("error", $message);
|
||||
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, MESSAGES["FAILED"], $this->myauth->getUIDByAuthInfo());
|
||||
return parent::modify_process_failed($message);
|
||||
}
|
||||
//수정,단일필드작업,일괄처리작업 공통
|
||||
protected function modify_process(mixed $uid): void
|
||||
{
|
||||
parent::modify_process($uid);
|
||||
$this->remaping_process();
|
||||
}
|
||||
public function modify(int $uid): RedirectResponse|string
|
||||
{
|
||||
$this->init(__FUNCTION__, [$this->getService()->getModel()::TITLE, 'newurl', 'status']);
|
||||
return $this->modify_procedure($uid);
|
||||
}
|
||||
|
||||
//단일필드작업
|
||||
protected function toggle_process_result($message): RedirectResponse|string
|
||||
{
|
||||
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, $message, $this->myauth->getUIDByAuthInfo());
|
||||
return parent::toggle_process_result($message);
|
||||
}
|
||||
protected function toggle_process_failed($message): RedirectResponse|string
|
||||
{
|
||||
MyLogService::add("error", $message);
|
||||
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, MESSAGES["FAILED"], $this->myauth->getUIDByAuthInfo());
|
||||
return parent::toggle_process_failed($message);
|
||||
}
|
||||
public function toggle(mixed $uid, string $field): RedirectResponse
|
||||
{
|
||||
return $this->toggle_procedure($uid, $field);
|
||||
}
|
||||
|
||||
//일괄처리작업
|
||||
protected function batchjob_process_result($message): RedirectResponse|string
|
||||
{
|
||||
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, $message, $this->myauth->getUIDByAuthInfo());
|
||||
return parent::batchjob_process_result($message);
|
||||
}
|
||||
protected function batchjob_process_failed($message): RedirectResponse|string
|
||||
{
|
||||
MyLogService::add("error", $message);
|
||||
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, MESSAGES["FAILED"], $this->myauth->getUIDByAuthInfo());
|
||||
return parent::batchjob_process_failed($message);
|
||||
}
|
||||
public function batchjob(): RedirectResponse
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->batchjob_procedure();
|
||||
}
|
||||
|
||||
//View
|
||||
public function view(int $uid): RedirectResponse|string
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->view_procedure($uid);
|
||||
}
|
||||
//삭제
|
||||
protected function delete_process_result($message): RedirectResponse|string
|
||||
{
|
||||
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, $message, $this->myauth->getUIDByAuthInfo());
|
||||
return parent::delete_process_result($message);
|
||||
}
|
||||
protected function delete_process_failed($message): RedirectResponse|string
|
||||
{
|
||||
MyLogService::add("error", $message);
|
||||
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, MESSAGES["FAILED"], $this->myauth->getUIDByAuthInfo());
|
||||
return parent::delete_process_failed($message);
|
||||
}
|
||||
//삭제,일괄삭제 공통
|
||||
protected function delete_process(mixed $uid): void
|
||||
{
|
||||
parent::delete_process($uid);
|
||||
$this->remaping_process();
|
||||
}
|
||||
|
||||
//일괄삭제
|
||||
protected function batchdelete_process_result($message): RedirectResponse|string
|
||||
{
|
||||
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, $message, $this->myauth->getUIDByAuthInfo());
|
||||
return parent::batchjob_delete_process_result($message);
|
||||
}
|
||||
protected function batchdelete_process_failed($message): RedirectResponse|string
|
||||
{
|
||||
MyLogService::add("error", $message);
|
||||
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, MESSAGES["FAILED"], $this->myauth->getUIDByAuthInfo());
|
||||
return parent::batchjob_delete_process_failed($message);
|
||||
}
|
||||
|
||||
// 리스트
|
||||
public function index(): string
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->list_procedure();
|
||||
}
|
||||
|
||||
// Download
|
||||
public function download(string $output_type, mixed $uid = false): DownloadResponse|string
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->download_procedure($output_type, $uid);
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,16 +50,4 @@ class MyLogController extends AdminController
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
//View
|
||||
public function view(int $uid): RedirectResponse|string
|
||||
{
|
||||
$this->init(__FUNCTION__, ['user_uid', 'class_name', 'method_name', $this->getService()->getModel()::TITLE, 'created_at', 'content']);
|
||||
return $this->view_procedure($uid);
|
||||
}
|
||||
// 리스트
|
||||
public function index(): string
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->list_procedure();
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,53 +43,19 @@ class UserController extends AdminController
|
||||
return $validation;
|
||||
}
|
||||
//생성
|
||||
public function create_form(): RedirectResponse|string
|
||||
protected function create_init(string $action, $fields = []): void
|
||||
{
|
||||
$this->init('create', ['id', 'passwd', 'confirmpassword', $this->getService()->getModel()::TITLE, 'email', 'mobile', 'role']);
|
||||
return $this->create_form_procedure();
|
||||
}
|
||||
public function create(): RedirectResponse|string
|
||||
{
|
||||
$this->init(__FUNCTION__, ['id', 'passwd', 'confirmpassword', $this->getService()->getModel()::TITLE, 'email', 'mobile', 'role']);
|
||||
return $this->create_procedure();
|
||||
$fields = [
|
||||
'fields' => ['id', 'passwd', 'confirmpassword', $this->getService()->getModel()::TITLE, 'email', 'mobile', 'role'],
|
||||
];
|
||||
parent::create_init($action, fields: $fields);
|
||||
}
|
||||
//수정
|
||||
public function modify_form(int $uid): RedirectResponse|string
|
||||
protected function modify_init(string $action, $fields = []): void
|
||||
{
|
||||
$this->init('modify', ['passwd', 'confirmpassword', $this->getService()->getModel()::TITLE, 'email', 'mobile', 'role', 'status']);
|
||||
return $this->modify_form_procedure($uid);
|
||||
}
|
||||
public function modify(int $uid): RedirectResponse|string
|
||||
{
|
||||
$this->init(__FUNCTION__, ['passwd', 'confirmpassword', $this->getService()->getModel()::TITLE, 'email', 'mobile', 'role', 'status']);
|
||||
return $this->modify_procedure($uid);
|
||||
}
|
||||
public function toggle(mixed $uid, string $field): RedirectResponse
|
||||
{
|
||||
return $this->toggle_procedure($uid, $field);
|
||||
}
|
||||
//일괄작업
|
||||
public function batchjob(): RedirectResponse
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->batchjob_procedure();
|
||||
}
|
||||
//View
|
||||
public function view(int $uid): RedirectResponse|string
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->view_procedure($uid);
|
||||
}
|
||||
// 리스트
|
||||
public function index(): string
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->list_procedure();
|
||||
}
|
||||
// Download
|
||||
public function download(string $output_type, mixed $uid = false): DownloadResponse|string
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->download_procedure($output_type, $uid);
|
||||
$fields = [
|
||||
'fields' => ['id', 'passwd', 'confirmpassword', $this->getService()->getModel()::TITLE, 'email', 'mobile', 'role', 'status'],
|
||||
];
|
||||
parent::modify_init($action, $fields);
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,37 +44,21 @@ class UserSNSController extends AdminController
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
|
||||
//생성
|
||||
protected function create_init(string $action, $fields = []): void
|
||||
{
|
||||
$fields = [
|
||||
'fields' => [$this->getService()->getModel()::PARENT, 'site', 'id', $this->getService()->getModel()::TITLE, 'email'],
|
||||
];
|
||||
parent::create_init($action, fields: $fields);
|
||||
}
|
||||
//수정
|
||||
public function modify_form(int $uid): RedirectResponse|string
|
||||
protected function modify_init(string $action, $fields = []): void
|
||||
{
|
||||
$this->init('modify', [$this->getService()->getModel()::PARENT, 'site', 'id', $this->getService()->getModel()::TITLE, 'email']);
|
||||
return $this->modify_form_procedure($uid);
|
||||
}
|
||||
public function modify(int $uid): RedirectResponse|string
|
||||
{
|
||||
$this->init(__FUNCTION__, [$this->getService()->getModel()::PARENT, 'site', 'id', $this->getService()->getModel()::TITLE, 'email']);
|
||||
return $this->modify_procedure($uid);
|
||||
}
|
||||
public function toggle(mixed $uid, string $field): RedirectResponse
|
||||
{
|
||||
return $this->toggle_procedure($uid, $field);
|
||||
}
|
||||
//일괄작업
|
||||
public function batchjob(): RedirectResponse
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->batchjob_procedure();
|
||||
}
|
||||
// 리스트
|
||||
public function index(): string
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->list_procedure();
|
||||
}
|
||||
// Download
|
||||
public function download(string $output_type, mixed $uid = false): DownloadResponse|string
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->download_procedure($output_type, $uid);
|
||||
$fields = [
|
||||
'fields' => [$this->getService()->getModel()::PARENT, 'site', 'id', $this->getService()->getModel()::TITLE, 'email', 'status'],
|
||||
];
|
||||
parent::modify_init($action, $fields);
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,16 +39,6 @@ abstract class CommonController extends BaseController
|
||||
return $this->_viewDatas;
|
||||
}
|
||||
|
||||
protected function init(string $action, array $fields = []): void
|
||||
{
|
||||
$this->action = $action;
|
||||
$this->fields = count($fields) ? $fields : $this->getService()->getModel()->getFields();
|
||||
$this->field_rules = $this->getService()->getModel()->getFieldRules($this->action, $this->fields);
|
||||
$this->filter_fields = $this->getService()->getModel()->getFilterFields();
|
||||
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
||||
$this->batchjob_fields = $this->getService()->getModel()->getBatchJobFields();
|
||||
}
|
||||
|
||||
protected function setValidation(string $action, string $field, Validation $validation): Validation
|
||||
{
|
||||
switch ($field) {
|
||||
@ -75,6 +65,7 @@ abstract class CommonController extends BaseController
|
||||
// dd($options);
|
||||
break;
|
||||
}
|
||||
// dd($options);
|
||||
return $options;
|
||||
}
|
||||
final protected function getFormFieldOptions(array $fields, array $options = []): array
|
||||
@ -88,8 +79,43 @@ abstract class CommonController extends BaseController
|
||||
// dd($options);
|
||||
return $options;
|
||||
}
|
||||
|
||||
//Field관련
|
||||
protected function init(string $action, array $fields = []): void
|
||||
{
|
||||
$this->action = $action;
|
||||
$this->fields = array_key_exists('fields', $fields) &&
|
||||
is_array($fields['fields']) &&
|
||||
count($fields['fields']) ?
|
||||
$fields['fields'] : $this->getService()->getModel()->getFields();
|
||||
$this->field_rules = array_key_exists('field_rules', $fields) &&
|
||||
is_array($fields['field_rules']) &&
|
||||
count($fields['field_rules']) ?
|
||||
$fields['field_rules'] : $this->getService()->getModel()->getFieldRules($this->action, $this->fields);
|
||||
$this->filter_fields = array_key_exists('filter_fields', $fields) &&
|
||||
is_array($fields['filter_fields']) &&
|
||||
count($fields['filter_fields']) ?
|
||||
$fields['filter_fields'] : $this->getService()->getModel()->getFilterFields();
|
||||
$this->field_options = array_key_exists('field_options', $fields) &&
|
||||
is_array($fields['field_optionss']) &&
|
||||
count($fields['field_options']) ?
|
||||
$fields['field_options'] : $this->getFormFieldOptions($this->filter_fields);
|
||||
$this->batchjob_fields = array_key_exists('batchjob_fields', $fields) &&
|
||||
is_array($fields['batchjob_fields']) &&
|
||||
count($fields['batchjob_fields']) ?
|
||||
$fields['filter_fields'] : $this->getService()->getModel()->getBatchJobFields();
|
||||
}
|
||||
// 생성
|
||||
protected function create_init(string $action, $fields = []): void
|
||||
{
|
||||
$this->init($action, $fields);
|
||||
}
|
||||
protected function create_form_process(): void {}
|
||||
final public function create_form(): RedirectResponse|string
|
||||
{
|
||||
$this->create_init('create');
|
||||
return $this->create_form_procedure();
|
||||
}
|
||||
final protected function create_form_procedure(): RedirectResponse|string
|
||||
{
|
||||
try {
|
||||
@ -145,7 +171,22 @@ abstract class CommonController extends BaseController
|
||||
return $this->create_process_result($e->getMessage());
|
||||
}
|
||||
}
|
||||
// 수정
|
||||
final public function create(int $uid): RedirectResponse|string
|
||||
{
|
||||
$this->create_init(__FUNCTION__);
|
||||
return $this->modify_procedure($uid);
|
||||
}
|
||||
|
||||
//수정관련
|
||||
protected function modify_init(string $action, $fields = []): void
|
||||
{
|
||||
$this->init($action, $fields);
|
||||
}
|
||||
final public function modify_form(mixed $uid): RedirectResponse|string
|
||||
{
|
||||
$this->modify_init('modify');
|
||||
return $this->modify_form_procedure($uid);
|
||||
}
|
||||
protected function modify_form_process(mixed $uid): void
|
||||
{
|
||||
$this->entity = $this->getService()->getModel()->getEntityByPK($uid);
|
||||
@ -214,6 +255,12 @@ abstract class CommonController extends BaseController
|
||||
return $this->modify_process_result($e->getMessage());
|
||||
}
|
||||
}
|
||||
final public function modify(int $uid): RedirectResponse|string
|
||||
{
|
||||
$this->modify_init(__FUNCTION__);
|
||||
return $this->modify_procedure($uid);
|
||||
}
|
||||
|
||||
//단일필드작업
|
||||
protected function toggle_process_result($message): RedirectResponse|string
|
||||
{
|
||||
@ -239,6 +286,11 @@ abstract class CommonController extends BaseController
|
||||
return $this->toggle_process_failed($e->getMessage());
|
||||
}
|
||||
}
|
||||
final public function toggle(mixed $uid, string $field): RedirectResponse|string
|
||||
{
|
||||
return $this->toggle_procedure($uid, $field);
|
||||
}
|
||||
|
||||
//일괄처리작업
|
||||
protected function batchjob_process_result($message): RedirectResponse|string
|
||||
{
|
||||
@ -277,6 +329,85 @@ abstract class CommonController extends BaseController
|
||||
return $this->batchjob_process_failed($e->getMessage());
|
||||
}
|
||||
}
|
||||
//일괄처리작업
|
||||
final public function batchjob(): RedirectResponse
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->batchjob_procedure();
|
||||
}
|
||||
|
||||
//삭제 delete,batchjob_delete 공통사용
|
||||
protected function delete_process(mixed $uid): void
|
||||
{
|
||||
//자신정보정의
|
||||
$this->entity = $this->getService()->getModel()->getEntityByPK($uid);
|
||||
if ($this->entity === null) {
|
||||
throw new \Exception("{$uid} 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->entity = $this->getService()->delete($this->entity);
|
||||
}
|
||||
protected function delete_process_result($message): RedirectResponse|string
|
||||
{
|
||||
return redirect()->to($this->myauth->popPreviousUrl())->with('error', $message);
|
||||
}
|
||||
protected function delete_process_failed($message): RedirectResponse|string
|
||||
{
|
||||
return redirect()->back()->with('error', $message);
|
||||
}
|
||||
final protected function delete_procedure(mixed $uid): RedirectResponse|string
|
||||
{
|
||||
//Transaction Start
|
||||
$this->getService()->getModel()->transStart();
|
||||
try {
|
||||
$this->delete_process($uid);
|
||||
$this->getService()->getModel()->transCommit();
|
||||
return $this->delete_process_result(MESSAGES["SUCCESS"]);
|
||||
} catch (\Exception $e) {
|
||||
//Transaction Rollback
|
||||
$this->getService()->getModel()->transRollback();
|
||||
return $this->delete_process_failed($e->getMessage());
|
||||
}
|
||||
}
|
||||
final public function delete(mixed $uid): RedirectResponse|string
|
||||
{
|
||||
return $this->delete_procedure($uid);
|
||||
}
|
||||
|
||||
//일괄삭제
|
||||
protected function batchjob_delete_process_result($message): RedirectResponse|string
|
||||
{
|
||||
return redirect()->to($this->myauth->popPreviousUrl())->with('error', $message);
|
||||
}
|
||||
protected function batchjob_delete_process_failed($message): RedirectResponse|string
|
||||
{
|
||||
return redirect()->back()->with('error', $message);
|
||||
}
|
||||
final protected function batchjob_delete_procedure(): RedirectResponse|string
|
||||
{
|
||||
//Transaction Start
|
||||
$this->getService()->getModel()->transStart();
|
||||
try {
|
||||
//변경할 UIDS
|
||||
$uids = $this->request->getVar('batchjob_uids');
|
||||
if (!$uids) {
|
||||
throw new \Exception("적용할 리스트를 선택하셔야합니다.");
|
||||
}
|
||||
foreach (explode(",", $uids) as $uid) {
|
||||
$this->delete_process($uid);
|
||||
}
|
||||
$this->getService()->getModel()->transCommit();
|
||||
return $this->batchjob_delete_process_result(MESSAGES["SUCCESS"]);
|
||||
} catch (\Exception $e) {
|
||||
//Transaction Rollback
|
||||
$this->getService()->getModel()->transRollback();
|
||||
return $this->batchjob_delete_process_failed($e->getMessage());
|
||||
}
|
||||
}
|
||||
final public function batchjob_delete(): RedirectResponse|string
|
||||
{
|
||||
return $this->batchjob_delete_procedure();
|
||||
}
|
||||
|
||||
//View
|
||||
protected function view_process(mixed $uid): void
|
||||
{
|
||||
@ -308,70 +439,18 @@ abstract class CommonController extends BaseController
|
||||
return $this->view_process_failed($e->getMessage());
|
||||
}
|
||||
}
|
||||
//삭제 delete,batchjob_delete 공통사용
|
||||
protected function delete_process(mixed $uid): void
|
||||
protected function view_init(string $action, $fields = []): void
|
||||
{
|
||||
//자신정보정의
|
||||
$this->entity = $this->getService()->getModel()->getEntityByPK($uid);
|
||||
if ($this->entity === null) {
|
||||
throw new \Exception("{$uid} 정보를 찾을수 없습니다.");
|
||||
$this->init($action, $fields);
|
||||
}
|
||||
$this->entity = $this->getService()->delete($this->entity);
|
||||
}
|
||||
protected function delete_process_result($message): RedirectResponse|string
|
||||
final public function view(string $uid): RedirectResponse|string
|
||||
{
|
||||
return redirect()->to($this->myauth->popPreviousUrl())->with('error', $message);
|
||||
}
|
||||
protected function delete_process_failed($message): RedirectResponse|string
|
||||
{
|
||||
return redirect()->back()->with('error', $message);
|
||||
}
|
||||
final public function delete(mixed $uid): RedirectResponse
|
||||
{
|
||||
//Transaction Start
|
||||
$this->getService()->getModel()->transStart();
|
||||
try {
|
||||
$this->delete_process($uid);
|
||||
$this->getService()->getModel()->transCommit();
|
||||
return $this->delete_process_result(MESSAGES["SUCCESS"]);
|
||||
} catch (\Exception $e) {
|
||||
//Transaction Rollback
|
||||
$this->getService()->getModel()->transRollback();
|
||||
return $this->delete_process_failed($e->getMessage());
|
||||
}
|
||||
}
|
||||
protected function batchjob_delete_process_result($message): RedirectResponse|string
|
||||
{
|
||||
return redirect()->to($this->myauth->popPreviousUrl())->with('error', $message);
|
||||
}
|
||||
protected function batchjob_delete_process_failed($message): RedirectResponse|string
|
||||
{
|
||||
return redirect()->back()->with('error', $message);
|
||||
}
|
||||
//일괄삭제
|
||||
final public function batchjob_delete(): RedirectResponse|string
|
||||
{
|
||||
//Transaction Start
|
||||
$this->getService()->getModel()->transStart();
|
||||
try {
|
||||
//변경할 UIDS
|
||||
$uids = $this->request->getVar('batchjob_uids');
|
||||
if (!$uids) {
|
||||
throw new \Exception("적용할 리스트를 선택하셔야합니다.");
|
||||
}
|
||||
foreach (explode(",", $uids) as $uid) {
|
||||
$this->delete_process($uid);
|
||||
}
|
||||
$this->getService()->getModel()->transCommit();
|
||||
return $this->delete_process_result(MESSAGES["SUCCESS"]);
|
||||
} catch (\Exception $e) {
|
||||
//Transaction Rollback
|
||||
$this->getService()->getModel()->transRollback();
|
||||
return $this->delete_process_result($e->getMessage());
|
||||
}
|
||||
$this->view_init(__FUNCTION__);
|
||||
return $this->view_procedure($uid);
|
||||
}
|
||||
|
||||
// 리스트
|
||||
protected function list_condition_process(): void
|
||||
protected function index_condition_process(): void
|
||||
{
|
||||
//조건절 처리
|
||||
foreach ($this->filter_fields as $field) {
|
||||
@ -391,15 +470,15 @@ abstract class CommonController extends BaseController
|
||||
$this->getService()->getModel()->setList_DateFilter($this->start, $this->end);
|
||||
}
|
||||
//Totalcount 처리
|
||||
private function list_total_process(): int
|
||||
private function index_total_process(): int
|
||||
{
|
||||
$this->list_condition_process();
|
||||
$this->index_condition_process();
|
||||
$total_count = $this->getService()->getModel()->countAllResults();
|
||||
// log_message("debug", $this->getService()->getModel()->getLastQuery());
|
||||
return $total_count;
|
||||
}
|
||||
//PageNation 처리
|
||||
private function list_pagination_process($pager_group = 'default', int $segment = 0, $template = 'bootstrap_full'): string
|
||||
private function index_pagination_process($pager_group = 'default', int $segment = 0, $template = 'bootstrap_full'): string
|
||||
{
|
||||
//Page, Per_page필요부분
|
||||
$this->page = (int) $this->request->getVar('page') ?: 1;
|
||||
@ -427,9 +506,9 @@ abstract class CommonController extends BaseController
|
||||
$this->total_page = $pager->getPageCount($pager_group);
|
||||
return $pager->links($pager_group, $template);
|
||||
}
|
||||
protected function list_entitys_process(): array
|
||||
protected function index_entitys_process(): array
|
||||
{
|
||||
$this->list_condition_process();
|
||||
$this->index_condition_process();
|
||||
//Sorting 처리
|
||||
$this->order_field = $this->request->getVar('order_field') ?: DEFAULTS['EMPTY'];
|
||||
$this->order_value = $this->request->getVar('order_value') ?: DEFAULTS['EMPTY'];
|
||||
@ -446,32 +525,41 @@ abstract class CommonController extends BaseController
|
||||
log_message("debug", $this->getService()->getModel()->getLastQuery());
|
||||
return $entitys;
|
||||
}
|
||||
protected function list_process_result(): string
|
||||
protected function index_process_result(): string
|
||||
{
|
||||
return view(
|
||||
$this->view_path . "index",
|
||||
['viewDatas' => $this->getViewDatas()]
|
||||
);
|
||||
}
|
||||
final protected function list_procedure(): string
|
||||
final protected function index_procedure(): string
|
||||
{
|
||||
try {
|
||||
helper(['form']);
|
||||
//URL처리
|
||||
$this->uri = $this->request->getUri();
|
||||
//total 처리
|
||||
$this->total_count = $this->list_total_process();
|
||||
$this->total_count = $this->index_total_process();
|
||||
//pagenation 처리
|
||||
$this->pagination = $this->list_pagination_process();
|
||||
$this->pagination = $this->index_pagination_process();
|
||||
//모델 처리
|
||||
$this->entitys = $this->list_entitys_process();
|
||||
$this->entitys = $this->index_entitys_process();
|
||||
// 현재 URL을 스택에 저장
|
||||
$this->myauth->pushCurrentUrl($this->request->getUri()->getPath() . ($this->request->getUri()->getQuery() ? "?" . $this->request->getUri()->getQuery() : ""));
|
||||
return $this->list_process_result();
|
||||
return $this->index_process_result();
|
||||
} catch (\Exception $e) {
|
||||
return $this->helper->alert($e->getMessage());
|
||||
}
|
||||
}
|
||||
protected function index_init(string $action, $fields = []): void
|
||||
{
|
||||
$this->init($action, $fields);
|
||||
}
|
||||
public function index(): string
|
||||
{
|
||||
$this->index_init(__FUNCTION__);
|
||||
return $this->index_procedure();
|
||||
}
|
||||
|
||||
//OUPUT Document 관련
|
||||
private function output_save_process(string $document_type, mixed $loaded_data): array
|
||||
@ -515,7 +603,7 @@ abstract class CommonController extends BaseController
|
||||
case 'excel':
|
||||
case 'pdf':
|
||||
// string buffer에서 읽어오는 경우
|
||||
$this->entitys = $this->list_entitys_process();
|
||||
$this->entitys = $this->index_entitys_process();
|
||||
$html = view(
|
||||
'templates' . DIRECTORY_SEPARATOR . $this->action,
|
||||
['viewDatas' => $this->getViewDatas()]
|
||||
@ -543,4 +631,10 @@ abstract class CommonController extends BaseController
|
||||
return $this->helper->alert($e->getMessage());
|
||||
}
|
||||
}
|
||||
// Download
|
||||
final public function download(string $output_type, mixed $uid = false): DownloadResponse|string
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->download_procedure($output_type, $uid);
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,16 +29,19 @@ class UserController extends CommonController
|
||||
}
|
||||
return $this->service;
|
||||
}
|
||||
protected function init(string $action, array $fields = []): void
|
||||
protected function login_init(string $action, array $fields = []): void
|
||||
{
|
||||
$this->action = $action;
|
||||
$this->fields = count($fields) ? $fields : ['id', 'passwd'];
|
||||
$fields = [
|
||||
'fields' => ['id', 'passwd'],
|
||||
];
|
||||
$this->init($action, $fields);
|
||||
}
|
||||
//로그인화면
|
||||
public function login_form(): RedirectResponse|string
|
||||
{
|
||||
try {
|
||||
$this->init('login');
|
||||
$this->login_init('login');
|
||||
helper(['form']);
|
||||
//구글 로그인 BUTTON용
|
||||
$google_socket = new GoogleSocket();
|
||||
@ -57,7 +60,7 @@ class UserController extends CommonController
|
||||
public function login(): RedirectResponse|string
|
||||
{
|
||||
try {
|
||||
$this->init('login');
|
||||
$this->login_init('login');
|
||||
$this->formDatas = $this->create_validate($this->action, $this->fields);
|
||||
$auth = new LocalService();
|
||||
$auth->login($auth->checkUser($this->formDatas));
|
||||
|
||||
@ -31,7 +31,7 @@ class MyLogModel extends CommonModel
|
||||
}
|
||||
public function getFields(): array
|
||||
{
|
||||
return ['class_name', 'method_name', self::TITLE, 'user_uid', 'created_at'];
|
||||
return ['user_uid', 'class_name', 'method_name', self::TITLE, 'user_uid', 'created_at'];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user