dbms_init...1
This commit is contained in:
parent
1239d97976
commit
bbbdb92ccf
@ -96,7 +96,6 @@ define('EVENT_PRIORITY_HIGH', 10);
|
||||
//Default값 정의
|
||||
define('DEFAULTS', [
|
||||
'ROLE' => "guest",
|
||||
'STATUS' => "use",
|
||||
'EMPTY' => "",
|
||||
'DELIMITER_FILE' => "||",
|
||||
'DELIMITER_ROLE' => ",",
|
||||
@ -133,16 +132,6 @@ define('URLS', [
|
||||
'SIGNUP' => '/auth/signup',
|
||||
'LOGOUT' => '/auth/logout',
|
||||
]);
|
||||
//회원ROLE
|
||||
define('ROLES', [
|
||||
'guest',
|
||||
'user',
|
||||
'vip',
|
||||
'manager',
|
||||
'cloudflare',
|
||||
'director',
|
||||
'master',
|
||||
]);
|
||||
//SESSION 관련
|
||||
define('SESSION_NAMES', [
|
||||
'RETURN_URL' => "return_url",
|
||||
|
||||
@ -40,4 +40,58 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
|
||||
$routes->get('/', 'MyLogController::index');
|
||||
$routes->get('view/(:num)', 'MyLogController::view/$1');
|
||||
});
|
||||
$routes->group('customer', ['namespace' => 'App\Controllers\Admin\Customer'], function ($routes) {
|
||||
$routes->group('client', ['namespace' => 'App\Controllers\Admin\Customer'], function ($routes) {
|
||||
$routes->get('/', 'ClientController::index', []);
|
||||
$routes->get('create', 'ClientController::create_form');
|
||||
$routes->post('create', 'ClientController::create');
|
||||
$routes->get('modify/(:num)', 'ClientController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'ClientController::modify/$1');
|
||||
$routes->get('view/(:num)', 'ClientController::view/$1');
|
||||
$routes->get('delete/(:num)', 'ClientController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'ClientController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'ClientController::batchjob');
|
||||
$routes->post('batchjob_delete', 'ClientController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'ClientController::download/$1');
|
||||
});
|
||||
$routes->group('account', ['namespace' => 'App\Controllers\Admin\Customer'], function ($routes) {
|
||||
$routes->get('/', 'AccountController::index', []);
|
||||
$routes->get('create', 'AccountController::create_form');
|
||||
$routes->post('create', 'AccountController::create');
|
||||
$routes->get('modify/(:num)', 'AccountController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'AccountController::modify/$1');
|
||||
$routes->get('view/(:num)', 'AccountController::view/$1');
|
||||
$routes->get('delete/(:num)', 'AccountController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'AccountController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'AccountController::batchjob');
|
||||
$routes->post('batchjob_delete', 'AccountController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'AccountController::download/$1');
|
||||
});
|
||||
$routes->group('coupon', ['namespace' => 'App\Controllers\Admin\Customer'], function ($routes) {
|
||||
$routes->get('/', 'CouponController::index', []);
|
||||
$routes->get('create', 'CouponController::create_form');
|
||||
$routes->post('create', 'CouponController::create');
|
||||
$routes->get('modify/(:num)', 'CouponController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'CouponController::modify/$1');
|
||||
$routes->get('view/(:num)', 'CouponController::view/$1');
|
||||
$routes->get('delete/(:num)', 'CouponController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'CouponController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'CouponController::batchjob');
|
||||
$routes->post('batchjob_delete', 'CouponController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'CouponController::download/$1');
|
||||
});
|
||||
$routes->group('point', ['namespace' => 'App\Controllers\Admin\Customer'], function ($routes) {
|
||||
$routes->get('/', 'PointController::index', []);
|
||||
$routes->get('create', 'PointController::create_form');
|
||||
$routes->post('create', 'PointController::create');
|
||||
$routes->get('modify/(:num)', 'PointController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'PointController::modify/$1');
|
||||
$routes->get('view/(:num)', 'PointController::view/$1');
|
||||
$routes->get('delete/(:num)', 'PointController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'PointController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'PointController::batchjob');
|
||||
$routes->post('batchjob_delete', 'PointController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'PointController::download/$1');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -5,7 +5,6 @@ namespace App\Controllers\Admin\Customer;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use CodeIgniter\Validation\Validation;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Helpers\Customer\AccountHelper;
|
||||
@ -35,81 +34,5 @@ class AccountController extends CustomerController
|
||||
}
|
||||
return $this->_helper;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
public function getFields(): array
|
||||
{
|
||||
return ['id', $this->getService()->getModel()::TITLE, 'email', 'mobile', 'role', 'status'];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ['role', 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
protected function setValidation(Validation $validation, string $action, string $field, ?string $rule = null): Validation
|
||||
{
|
||||
switch ($field) {
|
||||
case 'role':
|
||||
//아래 Rule Array는 필드명.* checkbox를 사용
|
||||
$validation->setRule("{$field}.*", $field, $rule);
|
||||
break;
|
||||
default:
|
||||
$validation = parent::setValidation($validation, $action, $field, $rule);
|
||||
break;
|
||||
}
|
||||
return $validation;
|
||||
}
|
||||
//Index,FieldForm관련.
|
||||
|
||||
protected function getResultPageByActon(string $action, string $message = MESSAGES["SUCCESS"]): RedirectResponse|string
|
||||
{
|
||||
switch ($action) {
|
||||
case 'create':
|
||||
case 'modify':
|
||||
$url = base_url() . $this->uri_path . "view/" . $this->entity->getPK();
|
||||
$result = redirect()->to($url)->with('error', $message);
|
||||
break;
|
||||
default:
|
||||
$result = parent::getResultPageByActon($action, $message);
|
||||
break;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
//생성
|
||||
protected function create_form_process(): void
|
||||
{
|
||||
$fields = [
|
||||
'fields' => ['id', 'passwd', 'confirmpassword', $this->getService()->getModel()::TITLE, 'email', 'mobile', 'role'],
|
||||
];
|
||||
$this->init('create_form', $fields);
|
||||
parent::create_form_process();
|
||||
}
|
||||
protected function create_process(): mixed
|
||||
{
|
||||
$fields = [
|
||||
'fields' => ['id', 'passwd', 'confirmpassword', $this->getService()->getModel()::TITLE, 'email', 'mobile', 'role'],
|
||||
];
|
||||
$this->init('create', $fields);
|
||||
return parent::create_process();
|
||||
}
|
||||
//수정
|
||||
protected function modify_form_process(mixed $uid): mixed
|
||||
{
|
||||
$fields = [
|
||||
'fields' => ['id', 'passwd', 'confirmpassword', $this->getService()->getModel()::TITLE, 'email', 'mobile', 'role'],
|
||||
];
|
||||
$this->init('modify_form', $fields);
|
||||
return parent::modify_form_process($uid);
|
||||
}
|
||||
protected function modify_process($uid): mixed
|
||||
{
|
||||
$fields = [
|
||||
'fields' => ['id', 'passwd', 'confirmpassword', $this->getService()->getModel()::TITLE, 'email', 'mobile', 'role', 'status'],
|
||||
];
|
||||
$this->init('modify', $fields);
|
||||
return parent::modify_process($uid);
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,18 +37,6 @@ class ClientController extends CustomerController
|
||||
return $this->_helper;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
public function getFields(): array
|
||||
{
|
||||
return ['id', $this->getService()->getModel()::TITLE, 'email', 'mobile', 'role', 'status'];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ['role', 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
protected function setValidation(Validation $validation, string $action, string $field, ?string $rule = null): Validation
|
||||
{
|
||||
switch ($field) {
|
||||
@ -63,54 +51,4 @@ class ClientController extends CustomerController
|
||||
return $validation;
|
||||
}
|
||||
//Index,FieldForm관련.
|
||||
|
||||
protected function getResultPageByActon(string $action, string $message = MESSAGES["SUCCESS"]): RedirectResponse|string
|
||||
{
|
||||
switch ($action) {
|
||||
case 'create':
|
||||
case 'modify':
|
||||
$url = base_url() . $this->uri_path . "view/" . $this->entity->getPK();
|
||||
$result = redirect()->to($url)->with('error', $message);
|
||||
break;
|
||||
default:
|
||||
$result = parent::getResultPageByActon($action, $message);
|
||||
break;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
//생성
|
||||
protected function create_form_process(): void
|
||||
{
|
||||
$fields = [
|
||||
'fields' => ['id', 'passwd', 'confirmpassword', $this->getService()->getModel()::TITLE, 'email', 'mobile', 'role'],
|
||||
];
|
||||
$this->init('create_form', $fields);
|
||||
parent::create_form_process();
|
||||
}
|
||||
protected function create_process(): mixed
|
||||
{
|
||||
$fields = [
|
||||
'fields' => ['id', 'passwd', 'confirmpassword', $this->getService()->getModel()::TITLE, 'email', 'mobile', 'role'],
|
||||
];
|
||||
$this->init('create', $fields);
|
||||
return parent::create_process();
|
||||
}
|
||||
//수정
|
||||
protected function modify_form_process(mixed $uid): mixed
|
||||
{
|
||||
$fields = [
|
||||
'fields' => ['id', 'passwd', 'confirmpassword', $this->getService()->getModel()::TITLE, 'email', 'mobile', 'role'],
|
||||
];
|
||||
$this->init('modify_form', $fields);
|
||||
return parent::modify_form_process($uid);
|
||||
}
|
||||
protected function modify_process($uid): mixed
|
||||
{
|
||||
$fields = [
|
||||
'fields' => ['id', 'passwd', 'confirmpassword', $this->getService()->getModel()::TITLE, 'email', 'mobile', 'role', 'status'],
|
||||
];
|
||||
$this->init('modify', $fields);
|
||||
return parent::modify_process($uid);
|
||||
}
|
||||
}
|
||||
|
||||
38
app/Controllers/Admin/Customer/CouponController.php
Normal file
38
app/Controllers/Admin/Customer/CouponController.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Customer;
|
||||
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Helpers\Customer\CouponHelper;
|
||||
use App\Services\Customer\CouponService;
|
||||
|
||||
class CouponController extends CustomerController
|
||||
{
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->uri_path .= strtolower($this->getService()->getClassName()) . '/';
|
||||
$this->class_path = $this->getService()->getClassPath();
|
||||
$this->title = lang("{$this->getService()->getClassPath()}.title");
|
||||
$this->helper = $this->getHelper();
|
||||
}
|
||||
public function getService(): CouponService
|
||||
{
|
||||
if (!$this->_service) {
|
||||
$this->_service = new CouponService($this->request);
|
||||
}
|
||||
return $this->_service;
|
||||
}
|
||||
public function getHelper(): mixed
|
||||
{
|
||||
if (!$this->_helper) {
|
||||
$this->_helper = new CouponHelper($this->request);
|
||||
}
|
||||
return $this->_helper;
|
||||
}
|
||||
//Index,FieldForm관련.
|
||||
}
|
||||
@ -6,14 +6,39 @@ use App\Controllers\Admin\AdminController;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use App\Services\Customer\ClientService;
|
||||
|
||||
abstract class CustomerController extends AdminController
|
||||
{
|
||||
private $_clientrService = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->uri_path .= 'customer/';
|
||||
$this->uri_path .= "customer/";
|
||||
$this->view_path .= "customer" . DIRECTORY_SEPARATOR;
|
||||
// $this->view_path .= "customer" . DIRECTORY_SEPARATOR;
|
||||
}
|
||||
final public function getClientService(): ClientService
|
||||
{
|
||||
if (!$this->_clientrService) {
|
||||
$this->_clientrService = new ClientService($this->request);
|
||||
}
|
||||
return $this->_clientrService;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
protected function getFormFieldOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'clientinfo_uid':
|
||||
$options[$field] = $this->getClientService()->getFormFieldOption($field);
|
||||
// echo $this->getUserModel()->getLastQuery();
|
||||
// dd($options);
|
||||
break;
|
||||
default:
|
||||
$options = parent::getFormFieldOption($field, $options);
|
||||
break;
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
}
|
||||
|
||||
38
app/Controllers/Admin/Customer/PointController.php
Normal file
38
app/Controllers/Admin/Customer/PointController.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Customer;
|
||||
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Helpers\Customer\PointHelper;
|
||||
use App\Services\Customer\PointService;
|
||||
|
||||
class PointController extends CustomerController
|
||||
{
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->uri_path .= strtolower($this->getService()->getClassName()) . '/';
|
||||
$this->class_path = $this->getService()->getClassPath();
|
||||
$this->title = lang("{$this->getService()->getClassPath()}.title");
|
||||
$this->helper = $this->getHelper();
|
||||
}
|
||||
public function getService(): PointService
|
||||
{
|
||||
if (!$this->_service) {
|
||||
$this->_service = new PointService($this->request);
|
||||
}
|
||||
return $this->_service;
|
||||
}
|
||||
public function getHelper(): mixed
|
||||
{
|
||||
if (!$this->_helper) {
|
||||
$this->_helper = new PointHelper($this->request);
|
||||
}
|
||||
return $this->_helper;
|
||||
}
|
||||
//Index,FieldForm관련.
|
||||
}
|
||||
@ -45,18 +45,6 @@ class MyLogController extends AdminController
|
||||
return $this->_userService;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
public function getFields(): array
|
||||
{
|
||||
return ['class_name', 'method_name', $this->getService()->getModel()::TITLE, 'user_uid', 'status'];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ['user_uid', 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
protected function getFormFieldOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
@ -83,4 +71,12 @@ class MyLogController extends AdminController
|
||||
$this->init('view', $fields);
|
||||
return parent::view_process($uid);
|
||||
}
|
||||
protected function index_process(): array
|
||||
{
|
||||
$fields = [
|
||||
'fields' => ['user_uid', 'class_name', 'method_name', $this->getService()->getModel()::TITLE, 'status', 'created_at'],
|
||||
];
|
||||
$this->init('index', $fields);
|
||||
return parent::index_process();
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,18 +39,6 @@ class UserController extends AdminController
|
||||
return $this->_helper;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
public function getFields(): array
|
||||
{
|
||||
return ['id', $this->getService()->getModel()::TITLE, 'email', 'mobile', 'role', 'status'];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ['role', 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
protected function setValidation(Validation $validation, string $action, string $field, ?string $rule = null): Validation
|
||||
{
|
||||
switch ($field) {
|
||||
@ -81,38 +69,21 @@ class UserController extends AdminController
|
||||
return $result;
|
||||
}
|
||||
|
||||
//생성
|
||||
protected function create_form_process(): void
|
||||
//View관련
|
||||
protected function view_process($uid): mixed
|
||||
{
|
||||
$fields = [
|
||||
'fields' => ['id', 'passwd', 'confirmpassword', $this->getService()->getModel()::TITLE, 'email', 'mobile', 'role'],
|
||||
'fields' => ['id', $this->getService()->getModel()::TITLE, 'email', 'mobile', 'role', 'status'],
|
||||
];
|
||||
$this->init('create_form', $fields);
|
||||
parent::create_form_process();
|
||||
$this->init('view', $fields);
|
||||
return parent::view_process($uid);
|
||||
}
|
||||
protected function create_process(): mixed
|
||||
protected function index_process(): array
|
||||
{
|
||||
$fields = [
|
||||
'fields' => ['id', 'passwd', 'confirmpassword', $this->getService()->getModel()::TITLE, 'email', 'mobile', 'role'],
|
||||
'fields' => ['id', $this->getService()->getModel()::TITLE, 'email', 'mobile', 'role', 'status'],
|
||||
];
|
||||
$this->init('create', $fields);
|
||||
return parent::create_process();
|
||||
}
|
||||
//수정
|
||||
protected function modify_form_process(mixed $uid): mixed
|
||||
{
|
||||
$fields = [
|
||||
'fields' => ['id', 'passwd', 'confirmpassword', $this->getService()->getModel()::TITLE, 'email', 'mobile', 'role'],
|
||||
];
|
||||
$this->init('modify_form', $fields);
|
||||
return parent::modify_form_process($uid);
|
||||
}
|
||||
protected function modify_process($uid): mixed
|
||||
{
|
||||
$fields = [
|
||||
'fields' => ['id', 'passwd', 'confirmpassword', $this->getService()->getModel()::TITLE, 'email', 'mobile', 'role', 'status'],
|
||||
];
|
||||
$this->init('modify', $fields);
|
||||
return parent::modify_process($uid);
|
||||
$this->init('index', $fields);
|
||||
return parent::index_process();
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,21 +34,6 @@ abstract class AuthController extends CommonController
|
||||
return $this->_helper;
|
||||
}
|
||||
|
||||
//Index,FieldForm관련
|
||||
public function getFields(): array
|
||||
{
|
||||
return ['id', 'passwd'];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ['role', 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
|
||||
protected function getResultPageByActon(string $action, string $message = MESSAGES["SUCCESS"]): RedirectResponse|string
|
||||
{
|
||||
switch ($action) {
|
||||
|
||||
@ -25,9 +25,6 @@ abstract class CommonController extends BaseController
|
||||
private $_viewDatas = [];
|
||||
abstract public function getService(): mixed;
|
||||
abstract function getHelper(): mixed;
|
||||
abstract public function getFields(): array;
|
||||
abstract public function getFilterFields(): array;
|
||||
abstract public function getBatchJobFields(): array;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
@ -77,6 +74,18 @@ abstract class CommonController extends BaseController
|
||||
$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->getBatchJobFields();
|
||||
}
|
||||
public function getFields(): array
|
||||
{
|
||||
return $this->getService()->getFields();
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return $this->getService()->getFilterFields();
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return $this->getService()->getBatchJobFields();
|
||||
}
|
||||
protected function getFieldRule(string $action, string $field): string
|
||||
{
|
||||
if (is_array($field)) {
|
||||
@ -148,6 +157,11 @@ abstract class CommonController extends BaseController
|
||||
protected function getResultPageByActon(string $action, string $message = MESSAGES["SUCCESS"]): RedirectResponse|string
|
||||
{
|
||||
switch ($action) {
|
||||
case 'create':
|
||||
case 'modify':
|
||||
$this->getHelper()->setViewDatas($this->getViewDatas());
|
||||
$result = view($this->view_path . 'view', ['viewDatas' => $this->getViewDatas()]);;
|
||||
break;
|
||||
case 'create_form':
|
||||
case 'modify_form':
|
||||
case 'index':
|
||||
|
||||
@ -4,13 +4,13 @@
|
||||
"settings": {
|
||||
"width": 4000,
|
||||
"height": 4000,
|
||||
"scrollTop": -200,
|
||||
"scrollLeft": -790.4997,
|
||||
"scrollTop": -100,
|
||||
"scrollLeft": -867.7529,
|
||||
"zoomLevel": 0.82,
|
||||
"show": 431,
|
||||
"database": 4,
|
||||
"databaseName": "",
|
||||
"canvasType": "ERD",
|
||||
"canvasType": "@dineug/erd-editor/builtin-schema-sql",
|
||||
"language": 1,
|
||||
"tableNameCase": 4,
|
||||
"columnNameCase": 2,
|
||||
@ -4224,7 +4224,7 @@
|
||||
"3jtklRjnxzZANo69T6vWW": {
|
||||
"id": "3jtklRjnxzZANo69T6vWW",
|
||||
"tableId": "jO40Ej5EXImXnadoJo9bn",
|
||||
"name": "quantity",
|
||||
"name": "amount",
|
||||
"comment": "",
|
||||
"dataType": "INT",
|
||||
"default": "",
|
||||
@ -4237,7 +4237,7 @@
|
||||
"widthDefault": 60
|
||||
},
|
||||
"meta": {
|
||||
"updateAt": 1745914595560,
|
||||
"updateAt": 1746511104589,
|
||||
"createAt": 1745914576666
|
||||
}
|
||||
},
|
||||
@ -5954,7 +5954,7 @@
|
||||
1745914576665,
|
||||
-1,
|
||||
{
|
||||
"name": 1745914587515,
|
||||
"name": 1746511104588,
|
||||
"dataType": 1745914593550,
|
||||
"options(notNull)": 1745914595560
|
||||
}
|
||||
|
||||
@ -36,4 +36,12 @@ abstract class CommonEntity extends Entity
|
||||
return $this->attributes['created_at'];
|
||||
}
|
||||
//공통부분
|
||||
final public function isMatched(string $field, string $value): bool
|
||||
{
|
||||
return $this->attributes[$field] == $value;
|
||||
}
|
||||
public function getStatus(): string|null
|
||||
{
|
||||
return $this->attributes['status'] ?? null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,24 +2,15 @@
|
||||
|
||||
namespace App\Entities\Customer;
|
||||
|
||||
use App\Entities\CommonEntity;
|
||||
use App\Models\Customer\AccountModel;
|
||||
|
||||
class AccountEntity extends CommonEntity
|
||||
class AccountEntity extends CustomerEntity
|
||||
{
|
||||
const PK = AccountModel::PK;
|
||||
const PK = AccountModel::PK;
|
||||
const TITLE = AccountModel::TITLE;
|
||||
|
||||
public function getClient()
|
||||
public function getAmount()
|
||||
{
|
||||
return $this->attributes['clientinfo_uid'];
|
||||
}
|
||||
public function getCoupon()
|
||||
{
|
||||
return $this->attributes['coupon_balance'];
|
||||
}
|
||||
public function getPoint()
|
||||
{
|
||||
return $this->attributes['point_balance'];
|
||||
return $this->attributes['amount'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,28 +2,31 @@
|
||||
|
||||
namespace App\Entities\Customer;
|
||||
|
||||
use App\Entities\CommonEntity;
|
||||
use App\Models\Customer\ClientModel;
|
||||
|
||||
class ClientEntity extends CommonEntity
|
||||
class ClientEntity extends CustomerEntity
|
||||
{
|
||||
const PK = ClientModel::PK;
|
||||
const TITLE = ClientModel::TITLE;
|
||||
|
||||
|
||||
public function getClient()
|
||||
{
|
||||
return $this->attributes[self::PK];
|
||||
}
|
||||
public function getRole(): string
|
||||
{
|
||||
return $this->attributes['role'];
|
||||
}
|
||||
|
||||
public function getAccount()
|
||||
public function getAccount(): int
|
||||
{
|
||||
return $this->attributes['account_balance'];
|
||||
}
|
||||
public function getCoupon()
|
||||
public function getCoupon(): int
|
||||
{
|
||||
return $this->attributes['coupon_balance'];
|
||||
}
|
||||
public function getPoint()
|
||||
public function getPoint(): int
|
||||
{
|
||||
return $this->attributes['point_balance'];
|
||||
}
|
||||
|
||||
16
app/Entities/Customer/CouponEntity.php
Normal file
16
app/Entities/Customer/CouponEntity.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Customer;
|
||||
|
||||
use App\Models\Customer\CouponModel;
|
||||
|
||||
class CouponEntity extends CustomerEntity
|
||||
{
|
||||
const PK = CouponModel::PK;
|
||||
const TITLE = CouponModel::TITLE;
|
||||
|
||||
public function getAmount()
|
||||
{
|
||||
return $this->attributes['amount'];
|
||||
}
|
||||
}
|
||||
@ -10,4 +10,9 @@ abstract class CustomerEntity extends CommonEntity
|
||||
{
|
||||
parent::__construct($data);
|
||||
}
|
||||
|
||||
public function getClient()
|
||||
{
|
||||
return $this->attributes['clientinfo_uid'];
|
||||
}
|
||||
}
|
||||
|
||||
16
app/Entities/Customer/PointEntity.php
Normal file
16
app/Entities/Customer/PointEntity.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Customer;
|
||||
|
||||
use App\Models\Customer\PointModel;
|
||||
|
||||
class PointEntity extends CustomerEntity
|
||||
{
|
||||
const PK = PointModel::PK;
|
||||
const TITLE = PointModel::TITLE;
|
||||
|
||||
public function getAmount()
|
||||
{
|
||||
return $this->attributes['amount'];
|
||||
}
|
||||
}
|
||||
@ -3,7 +3,7 @@
|
||||
namespace App\Helpers;
|
||||
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
use App\Models\UserModel as Model;
|
||||
use App\Models\UserModel;
|
||||
|
||||
class AuthHelper extends CommonHelper
|
||||
{
|
||||
@ -11,6 +11,7 @@ class AuthHelper extends CommonHelper
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
{
|
||||
parent::__construct($request);
|
||||
$this->setTitleField(UserModel::TITLE);
|
||||
}
|
||||
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
@ -20,9 +21,6 @@ class AuthHelper extends CommonHelper
|
||||
$value = $value ?: DEFAULTS['EMPTY'];
|
||||
switch ($field) {
|
||||
case 'id':
|
||||
case Model::TITLE:
|
||||
$form = form_input($field, $value, $extras);
|
||||
break;
|
||||
case 'passwd':
|
||||
$form = form_password($field, "", ["autocomplete" => $field, ...$extras]);
|
||||
break;
|
||||
|
||||
@ -6,12 +6,24 @@ use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
class CommonHelper
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
private $_viewDatas = [];
|
||||
private $_titleField = "";
|
||||
protected ?IncomingRequest $request = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
{
|
||||
$this->request = $request;
|
||||
}
|
||||
final public function setTitleField(string $field): void
|
||||
{
|
||||
$this->_titleField = $field;
|
||||
}
|
||||
final public function getTitleField(): string
|
||||
{
|
||||
if (!$this->_titleField) {
|
||||
throw new \Exception("titleField가 지정되지 않았습니다.");
|
||||
}
|
||||
return $this->_titleField;
|
||||
}
|
||||
final public function setViewDatas(array $viewDatas): void
|
||||
{
|
||||
$this->_viewDatas = $viewDatas;
|
||||
@ -174,10 +186,43 @@ class CommonHelper
|
||||
}
|
||||
$value = $value ?: DEFAULTS['EMPTY'];
|
||||
switch ($field) {
|
||||
case 'email':
|
||||
$form = form_input($field, $value, ["placeholder" => "예)test@example.com", ...$extras]);
|
||||
break;
|
||||
case 'mobile':
|
||||
case 'phone':
|
||||
$form = form_input($field, $value, ["placeholder" => "예)010-0010-0010", ...$extras]);
|
||||
break;
|
||||
case 'role':
|
||||
if (!is_array($viewDatas['field_options'][$field])) {
|
||||
echo var_dump($viewDatas['field_options']);
|
||||
exit;
|
||||
}
|
||||
if (in_array($viewDatas['action'], ['create_form', 'modify_form'])) {
|
||||
$forms = [];
|
||||
foreach ($viewDatas['field_options'][$field] as $key => $label) {
|
||||
$values = is_array($value) ? $value : explode(DEFAULTS["DELIMITER_ROLE"], $value);
|
||||
$forms[] = form_checkbox("{$field}[]", $key, in_array($key, $values)) . $label;
|
||||
}
|
||||
$form = implode(" ", $forms);
|
||||
} else {
|
||||
$formOptions = array_merge(
|
||||
["" => lang($viewDatas['class_path'] . '.label.' . $field) . ' 선택'],
|
||||
$viewDatas['field_options'][$field]
|
||||
);
|
||||
$form = form_dropdown($field, $formOptions, $value, $extras);
|
||||
}
|
||||
break;
|
||||
case 'status':
|
||||
$form = form_dropdown($field, [
|
||||
"" => lang($viewDatas['class_path'] . '.label.' . $field) . ' 선택',
|
||||
] + $viewDatas['field_options'][$field], $value, $extras);
|
||||
if (!is_array($viewDatas['field_options'][$field])) {
|
||||
echo var_dump($viewDatas['field_options']);
|
||||
exit;
|
||||
}
|
||||
$formOptions = array_merge(
|
||||
["" => lang($viewDatas['class_path'] . '.label.' . $field) . ' 선택'],
|
||||
$viewDatas['field_options'][$field]
|
||||
);
|
||||
$form = form_dropdown($field, $formOptions, $value, $extras);
|
||||
break;
|
||||
case 'updated_at':
|
||||
case 'created_at':
|
||||
@ -195,6 +240,19 @@ class CommonHelper
|
||||
{
|
||||
$value = $viewDatas['entity']->$field ?: DEFAULTS['EMPTY'];
|
||||
switch ($field) {
|
||||
case $this->getTitleField():
|
||||
$value = form_label(
|
||||
$value,
|
||||
'view',
|
||||
[
|
||||
"data-src" => current_url() . '/view/' . $viewDatas['entity']->getPK(),
|
||||
"data-bs-toggle" => "modal",
|
||||
"data-bs-target" => "#index_action_form",
|
||||
"style" => "color: blue; cursor: pointer; font-weight:bold;",
|
||||
...$extras,
|
||||
]
|
||||
);
|
||||
break;
|
||||
case 'category_uid':
|
||||
foreach (array_values($viewDatas['field_options'][$field]) as $category_2depths) {
|
||||
foreach ($category_2depths as $key => $depth) {
|
||||
@ -204,6 +262,20 @@ class CommonHelper
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'user_uid':
|
||||
$user_uids = [];
|
||||
foreach (explode(DEFAULTS["DELIMITER_ROLE"], $value) as $key) {
|
||||
$user_uids[] = $viewDatas['field_options'][$field][$key];
|
||||
}
|
||||
$value = implode(" , ", array: $user_uids);
|
||||
break;
|
||||
case 'role':
|
||||
$roles = [];
|
||||
foreach (explode(DEFAULTS["DELIMITER_ROLE"], $value) as $key) {
|
||||
$roles[] = $viewDatas['field_options'][$field][$key];
|
||||
}
|
||||
$value = implode(" , ", $roles);
|
||||
break;
|
||||
case 'updated_at':
|
||||
case 'created_at':
|
||||
$value = $value ? date("Y-m-d", strtotime($value)) : "";
|
||||
@ -224,9 +296,9 @@ class CommonHelper
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function getListRowColor($entity): string
|
||||
public function getListRowColor(mixed $entity, string $field = 'status', string $value = 'use'): string
|
||||
{
|
||||
return $entity->status != DEFAULTS['STATUS'] ? 'class="table-danger"' : "";
|
||||
return $entity->isMatched($field, $value) ? "" : 'class="table-danger"';
|
||||
}
|
||||
|
||||
public function getListLabel(string $field, array $viewDatas, array $extras = []): string
|
||||
|
||||
@ -2,95 +2,15 @@
|
||||
|
||||
namespace App\Helpers\Customer;
|
||||
|
||||
use App\Helpers\CommonHelper;
|
||||
use App\Models\UserModel as Model;
|
||||
use App\Models\Customer\AccountModel;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
class AccountHelper extends CommonHelper
|
||||
class AccountHelper extends CustomerHelper
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
{
|
||||
parent::__construct($request);
|
||||
$this->setTitleField(AccountModel::TITLE);
|
||||
}
|
||||
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
if (in_array($viewDatas['action'], ['create', 'modify'])) {
|
||||
$extras = (strpos($viewDatas['field_rules'][$field], 'required') !== false) ? ["class" => "form-control", "required" => "", ...$extras] : ["class" => "form-control", ...$extras];
|
||||
}
|
||||
$value = $value ?: DEFAULTS['EMPTY'];
|
||||
switch ($field) {
|
||||
case 'id':
|
||||
case Model::TITLE:
|
||||
$form = form_input($field, $value, $extras);
|
||||
break;
|
||||
case 'passwd':
|
||||
case 'confirmpassword':
|
||||
$form = form_password($field, "", ["autocomplete" => $field, ...$extras]);
|
||||
break;
|
||||
case 'email':
|
||||
$form = form_input($field, $value, ["placeholder" => "예)test@example.com", ...$extras]);
|
||||
break;
|
||||
case 'mobile':
|
||||
$form = form_input($field, $value, ["placeholder" => "예)010-0010-0010", ...$extras]);
|
||||
break;
|
||||
case 'role':
|
||||
if (in_array($viewDatas['action'], ['create_form', 'modify_form'])) {
|
||||
$forms = [];
|
||||
foreach ($viewDatas['field_options'][$field] as $key => $label) {
|
||||
$values = is_array($value) ? $value : explode(DEFAULTS["DELIMITER_ROLE"], $value);
|
||||
$forms[] = form_checkbox(
|
||||
"{$field}[]",
|
||||
$key,
|
||||
in_array($key, $values)
|
||||
) . $label;
|
||||
}
|
||||
$form = implode(" ", $forms);
|
||||
} else {
|
||||
$form = form_dropdown(
|
||||
$field,
|
||||
[
|
||||
"" => lang($viewDatas['class_path'] . '.label.' . $field) . ' 선택',
|
||||
] + $viewDatas['field_options'][$field],
|
||||
$value,
|
||||
$extras
|
||||
);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
|
||||
break;
|
||||
}
|
||||
return $form;
|
||||
} //
|
||||
public function getFieldView(string $field, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
$value = $viewDatas['entity']->$field ?: DEFAULTS['EMPTY'];
|
||||
switch ($field) {
|
||||
case Model::TITLE:
|
||||
$value = form_label(
|
||||
$value,
|
||||
'view',
|
||||
[
|
||||
"data-src" => current_url() . '/view/' . $viewDatas['entity']->getPK(),
|
||||
"data-bs-toggle" => "modal",
|
||||
"data-bs-target" => "#index_action_form",
|
||||
"style" => "color: blue; cursor: pointer; font-weight:bold;",
|
||||
...$extras,
|
||||
]
|
||||
);
|
||||
break;
|
||||
case 'role':
|
||||
$roles = [];
|
||||
foreach (explode(DEFAULTS["DELIMITER_ROLE"], $value) as $key) {
|
||||
$roles[] = $viewDatas['field_options'][$field][$key];
|
||||
}
|
||||
$value = implode(" , ", $roles);
|
||||
break;
|
||||
default:
|
||||
$value = parent::getFieldView($field, $viewDatas, $extras);
|
||||
break;
|
||||
}
|
||||
return $value;
|
||||
} //
|
||||
}
|
||||
|
||||
@ -2,16 +2,16 @@
|
||||
|
||||
namespace App\Helpers\Customer;
|
||||
|
||||
use App\Helpers\CommonHelper;
|
||||
use App\Models\Customer\ClientModel;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
class ClientHelper extends CommonHelper
|
||||
class ClientHelper extends CustomerHelper
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
{
|
||||
parent::__construct($request);
|
||||
$this->setTitleField(ClientModel::TITLE);
|
||||
}
|
||||
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
@ -20,10 +20,6 @@ class ClientHelper extends CommonHelper
|
||||
}
|
||||
$value = $value ?: DEFAULTS['EMPTY'];
|
||||
switch ($field) {
|
||||
case 'id':
|
||||
case ClientModel::TITLE:
|
||||
$form = form_input($field, $value, $extras);
|
||||
break;
|
||||
case 'email':
|
||||
$form = form_input($field, $value, ["placeholder" => "예)test@example.com", ...$extras]);
|
||||
break;
|
||||
@ -31,26 +27,23 @@ class ClientHelper extends CommonHelper
|
||||
$form = form_input($field, $value, ["placeholder" => "예)010-0010-0010", ...$extras]);
|
||||
break;
|
||||
case 'role':
|
||||
if (!is_array($viewDatas['field_options'][$field])) {
|
||||
echo var_dump($viewDatas['field_options']);
|
||||
exit;
|
||||
}
|
||||
if (in_array($viewDatas['action'], ['create_form', 'modify_form'])) {
|
||||
$forms = [];
|
||||
foreach ($viewDatas['field_options'][$field] as $key => $label) {
|
||||
$values = is_array($value) ? $value : explode(DEFAULTS["DELIMITER_ROLE"], $value);
|
||||
$forms[] = form_checkbox(
|
||||
"{$field}[]",
|
||||
$key,
|
||||
in_array($key, $values)
|
||||
) . $label;
|
||||
$forms[] = form_checkbox("{$field}[]", $key, in_array($key, $values)) . $label;
|
||||
}
|
||||
$form = implode(" ", $forms);
|
||||
} else {
|
||||
$form = form_dropdown(
|
||||
$field,
|
||||
[
|
||||
"" => lang($viewDatas['class_path'] . '.label.' . $field) . ' 선택',
|
||||
] + $viewDatas['field_options'][$field],
|
||||
$value,
|
||||
$extras
|
||||
$formOptions = array_merge(
|
||||
["" => lang($viewDatas['class_path'] . '.label.' . $field) . ' 선택'],
|
||||
$viewDatas['field_options'][$field]
|
||||
);
|
||||
$form = form_dropdown($field, $formOptions, $value, $extras);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -63,19 +56,6 @@ class ClientHelper extends CommonHelper
|
||||
{
|
||||
$value = $viewDatas['entity']->$field ?: DEFAULTS['EMPTY'];
|
||||
switch ($field) {
|
||||
case ClientModel::TITLE:
|
||||
$value = form_label(
|
||||
$value,
|
||||
'view',
|
||||
[
|
||||
"data-src" => current_url() . '/view/' . $viewDatas['entity']->getPK(),
|
||||
"data-bs-toggle" => "modal",
|
||||
"data-bs-target" => "#index_action_form",
|
||||
"style" => "color: blue; cursor: pointer; font-weight:bold;",
|
||||
...$extras,
|
||||
]
|
||||
);
|
||||
break;
|
||||
case 'role':
|
||||
$roles = [];
|
||||
foreach (explode(DEFAULTS["DELIMITER_ROLE"], $value) as $key) {
|
||||
@ -83,6 +63,11 @@ class ClientHelper extends CommonHelper
|
||||
}
|
||||
$value = implode(" , ", $roles);
|
||||
break;
|
||||
case 'account_balance':
|
||||
case 'coupon_balance':
|
||||
case 'point_balance':
|
||||
$value = number_format($value);
|
||||
break;
|
||||
default:
|
||||
$value = parent::getFieldView($field, $viewDatas, $extras);
|
||||
break;
|
||||
|
||||
16
app/Helpers/Customer/CouponHelper.php
Normal file
16
app/Helpers/Customer/CouponHelper.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Helpers\Customer;
|
||||
|
||||
use App\Models\Customer\CouponModel;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
class CouponHelper extends CustomerHelper
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
{
|
||||
parent::__construct($request);
|
||||
$this->setTitleField(CouponModel::TITLE);
|
||||
}
|
||||
}
|
||||
@ -11,4 +11,32 @@ class CustomerHelper extends CommonHelper
|
||||
{
|
||||
parent::__construct($request);
|
||||
}
|
||||
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
if (in_array($viewDatas['action'], ['create', 'modify'])) {
|
||||
$extras = (strpos($viewDatas['field_rules'][$field], 'required') !== false) ? ["class" => "form-control", "required" => "", ...$extras] : ["class" => "form-control", ...$extras];
|
||||
}
|
||||
$value = $value ?: DEFAULTS['EMPTY'];
|
||||
switch ($field) {
|
||||
case "clientinfo_uid":
|
||||
if (!is_array($viewDatas['field_options'][$field])) {
|
||||
echo var_dump($viewDatas['field_options']);
|
||||
exit;
|
||||
}
|
||||
$formOptions = array_merge(
|
||||
["" => lang($viewDatas['class_path'] . '.label.' . $field) . ' 선택'],
|
||||
$viewDatas['field_options'][$field]
|
||||
);
|
||||
$form = form_dropdown($field, $formOptions, $value, $extras);
|
||||
break;
|
||||
default:
|
||||
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
|
||||
break;
|
||||
}
|
||||
return $form;
|
||||
} //
|
||||
public function getListRowColor(mixed $entity, string $field = 'status', string $value = 'in'): string
|
||||
{
|
||||
return $entity->isMatched($field, $value) ? "" : 'class="table-danger"';
|
||||
}
|
||||
}
|
||||
|
||||
16
app/Helpers/Customer/PointHelper.php
Normal file
16
app/Helpers/Customer/PointHelper.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Helpers\Customer;
|
||||
|
||||
use App\Models\Customer\PointModel;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
class PointHelper extends CustomerHelper
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
{
|
||||
parent::__construct($request);
|
||||
$this->setTitleField(field: PointModel::TITLE);
|
||||
}
|
||||
}
|
||||
@ -3,7 +3,7 @@
|
||||
namespace App\Helpers;
|
||||
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
use App\Models\MyLogModel as Model;
|
||||
use App\Models\MyLogModel;
|
||||
|
||||
class MyLogHelper extends CommonHelper
|
||||
{
|
||||
@ -11,38 +11,16 @@ class MyLogHelper extends CommonHelper
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
{
|
||||
parent::__construct($request);
|
||||
$this->setTitleField(MyLogModel::TITLE);
|
||||
}
|
||||
|
||||
public function getFieldView(string $field, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
$value = $viewDatas['entity']->$field ?: DEFAULTS['EMPTY'];
|
||||
switch ($field) {
|
||||
case Model::TITLE:
|
||||
$value = form_label(
|
||||
$value,
|
||||
'view',
|
||||
[
|
||||
"data-src" => current_url() . '/view/' . $viewDatas['entity']->getPK(),
|
||||
"data-bs-toggle" => "modal",
|
||||
"data-bs-target" => "#index_action_form",
|
||||
"style" => "color: blue; cursor: pointer; font-weight:bold;",
|
||||
...$extras,
|
||||
]
|
||||
);
|
||||
break;
|
||||
case 'user_uid':
|
||||
$user_uids = [];
|
||||
foreach (explode(DEFAULTS["DELIMITER_ROLE"], $value) as $key) {
|
||||
$user_uids[] = $viewDatas['field_options'][$field][$key];
|
||||
}
|
||||
$value = implode(" , ", array: $user_uids);
|
||||
break;
|
||||
case 'content':
|
||||
$value = nl2br($value);
|
||||
break;
|
||||
case 'status':
|
||||
$value = $viewDatas['field_options'][$field][$value];
|
||||
break;
|
||||
default:
|
||||
$value = parent::getFieldView($field, $viewDatas, $extras);
|
||||
break;
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
namespace App\Helpers;
|
||||
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
use App\Models\UserModel as Model;
|
||||
use App\Models\UserModel;
|
||||
|
||||
class UserHelper extends CommonHelper
|
||||
{
|
||||
@ -11,6 +11,7 @@ class UserHelper extends CommonHelper
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
{
|
||||
parent::__construct($request);
|
||||
$this->setTitleField(UserModel::TITLE);
|
||||
}
|
||||
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
@ -19,77 +20,14 @@ class UserHelper extends CommonHelper
|
||||
}
|
||||
$value = $value ?: DEFAULTS['EMPTY'];
|
||||
switch ($field) {
|
||||
case 'id':
|
||||
case Model::TITLE:
|
||||
$form = form_input($field, $value, $extras);
|
||||
break;
|
||||
case 'passwd':
|
||||
case 'confirmpassword':
|
||||
$form = form_password($field, "", ["autocomplete" => $field, ...$extras]);
|
||||
break;
|
||||
case 'email':
|
||||
$form = form_input($field, $value, ["placeholder" => "예)test@example.com", ...$extras]);
|
||||
break;
|
||||
case 'mobile':
|
||||
$form = form_input($field, $value, ["placeholder" => "예)010-0010-0010", ...$extras]);
|
||||
break;
|
||||
case 'role':
|
||||
if (in_array($viewDatas['action'], ['create_form', 'modify_form'])) {
|
||||
$forms = [];
|
||||
foreach ($viewDatas['field_options'][$field] as $key => $label) {
|
||||
$values = is_array($value) ? $value : explode(DEFAULTS["DELIMITER_ROLE"], $value);
|
||||
$forms[] = form_checkbox(
|
||||
"{$field}[]",
|
||||
$key,
|
||||
in_array($key, $values)
|
||||
) . $label;
|
||||
}
|
||||
$form = implode(" ", $forms);
|
||||
} else {
|
||||
$form = form_dropdown(
|
||||
$field,
|
||||
[
|
||||
"" => lang($viewDatas['class_path'] . '.label.' . $field) . ' 선택',
|
||||
] + $viewDatas['field_options'][$field],
|
||||
$value,
|
||||
$extras
|
||||
);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
|
||||
break;
|
||||
}
|
||||
return $form;
|
||||
} //
|
||||
public function getFieldView(string $field, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
$value = $viewDatas['entity']->$field ?: DEFAULTS['EMPTY'];
|
||||
switch ($field) {
|
||||
case Model::TITLE:
|
||||
$value = form_label(
|
||||
$value,
|
||||
'view',
|
||||
[
|
||||
"data-src" => current_url() . '/view/' . $viewDatas['entity']->getPK(),
|
||||
"data-bs-toggle" => "modal",
|
||||
"data-bs-target" => "#index_action_form",
|
||||
"style" => "color: blue; cursor: pointer; font-weight:bold;",
|
||||
...$extras,
|
||||
]
|
||||
);
|
||||
break;
|
||||
case 'role':
|
||||
$roles = [];
|
||||
foreach (explode(DEFAULTS["DELIMITER_ROLE"], $value) as $key) {
|
||||
$roles[] = $viewDatas['field_options'][$field][$key];
|
||||
}
|
||||
$value = implode(" , ", $roles);
|
||||
break;
|
||||
default:
|
||||
$value = parent::getFieldView($field, $viewDatas, $extras);
|
||||
break;
|
||||
}
|
||||
return $value;
|
||||
} //
|
||||
}
|
||||
|
||||
17
app/Language/en/Customer/Account.php
Normal file
17
app/Language/en/Customer/Account.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
return [
|
||||
'title' => "고객예치금",
|
||||
'label' => [
|
||||
'clientinfo_uid' => "고객명",
|
||||
'title' => "제목",
|
||||
'alias' => "입/출금자명",
|
||||
'amount' => "금액",
|
||||
'status' => "입/출금",
|
||||
'updated_at' => "수정일",
|
||||
'created_at' => "작성일",
|
||||
],
|
||||
"STATUS" => [
|
||||
"in" => "입금",
|
||||
"out" => "출금",
|
||||
],
|
||||
];
|
||||
@ -6,6 +6,9 @@ return [
|
||||
'phone' => "연락처",
|
||||
'role' => "권한",
|
||||
'name' => "이름",
|
||||
'account_balance' => "예치금",
|
||||
'coupon_balance' => "쿠폰",
|
||||
'point_balance' => "포인트",
|
||||
'status' => "상태",
|
||||
'updated_at' => "수정일",
|
||||
'created_at' => "작성일",
|
||||
|
||||
16
app/Language/en/Customer/Coupon.php
Normal file
16
app/Language/en/Customer/Coupon.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
return [
|
||||
'title' => "고객쿠폰",
|
||||
'label' => [
|
||||
'clientinfo_uid' => "고객명",
|
||||
'title' => "제목",
|
||||
'amount' => "갯수",
|
||||
'status' => "추가/사용",
|
||||
'updated_at' => "수정일",
|
||||
'created_at' => "작성일",
|
||||
],
|
||||
"STATUS" => [
|
||||
"in" => "추가",
|
||||
"out" => "사용",
|
||||
],
|
||||
];
|
||||
16
app/Language/en/Customer/Point.php
Normal file
16
app/Language/en/Customer/Point.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
return [
|
||||
'title' => "고객포인트",
|
||||
'label' => [
|
||||
'clientinfo_uid' => "고객명",
|
||||
'title' => "제목",
|
||||
'amount' => "금액",
|
||||
'status' => "입/출금",
|
||||
'updated_at' => "수정일",
|
||||
'created_at' => "작성일",
|
||||
],
|
||||
"STATUS" => [
|
||||
"in" => "입금",
|
||||
"out" => "출금",
|
||||
],
|
||||
];
|
||||
@ -15,8 +15,6 @@ return [
|
||||
'created_at' => "작성일",
|
||||
],
|
||||
"ROLE" => [
|
||||
"user" => "일반회원",
|
||||
"vip" => "VIP회원",
|
||||
"manager" => "관리자",
|
||||
"cloudflare" => "Cloudflare관리자",
|
||||
"firewall" => "firewall관리자",
|
||||
|
||||
@ -71,7 +71,7 @@ abstract class GoogleSocket extends MySocket
|
||||
}
|
||||
}
|
||||
//상태가 use(승인완료)가 아니라면
|
||||
if ($entity->status !== DEFAULTS['STATUS']) {
|
||||
if ($entity->getStatus() !== DEFAULTS['STATUS']) {
|
||||
throw new PageNotFoundException("{$entity->getSite()}의{$entity->getEmail()}:{$entity->getTitle()}님은 {$entity->status}입니다 ");
|
||||
}
|
||||
return $entity;
|
||||
|
||||
@ -50,8 +50,9 @@ abstract class CommonModel extends Model
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
abstract public function getFilterFields(): array;
|
||||
abstract public function getBatchJobFields(): array;
|
||||
abstract public function setList_WordFilter(string $word): void;
|
||||
|
||||
final public function getTable(): string
|
||||
{
|
||||
return constant("static::TABLE");
|
||||
@ -64,6 +65,11 @@ abstract class CommonModel extends Model
|
||||
{
|
||||
return constant("static::TITLE");
|
||||
}
|
||||
final public function getFields(): array
|
||||
{
|
||||
return $this->allowedFields;
|
||||
}
|
||||
|
||||
//Primary Key로 uuid를 사용시 해당 모델에 아래 변수 반드시 추가 필요
|
||||
// protected $useAutoIncrement = false;
|
||||
// protected $beforeInsert = ['generateUUID'];
|
||||
|
||||
@ -3,11 +3,10 @@
|
||||
namespace App\Models\Customer;
|
||||
|
||||
use App\Entities\Customer\AccountEntity;
|
||||
use App\Models\CommonModel;
|
||||
|
||||
class AccountModel extends CustomerModel
|
||||
{
|
||||
const TABLE = "acountinfo";
|
||||
const TABLE = "accountinfo";
|
||||
const PK = "uid";
|
||||
const TITLE = "title";
|
||||
protected $table = self::TABLE;
|
||||
@ -15,15 +14,23 @@ class AccountModel extends CustomerModel
|
||||
protected $returnType = AccountEntity::class;
|
||||
protected $allowedFields = [
|
||||
"clientinfo_uid",
|
||||
"title",
|
||||
"alias",
|
||||
"amount",
|
||||
"status",
|
||||
"alias",
|
||||
"title",
|
||||
"amount",
|
||||
];
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ["clientinfo_uid", 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
public function getFieldRule(string $action, string $field): string
|
||||
{
|
||||
if (is_array($field)) {
|
||||
@ -39,7 +46,7 @@ class AccountModel extends CustomerModel
|
||||
$rule = "required|trim|string";
|
||||
break;
|
||||
case "status":
|
||||
$rule = "if_exist|in_list[in,out]";
|
||||
$rule = "required|in_list[in,out]";
|
||||
break;
|
||||
default:
|
||||
$rule = parent::getFieldRule($action, $field);
|
||||
|
||||
@ -13,10 +13,10 @@ class ClientModel extends CustomerModel
|
||||
protected $primaryKey = self::PK;
|
||||
protected $returnType = ClientEntity::class;
|
||||
protected $allowedFields = [
|
||||
"role",
|
||||
"name",
|
||||
"email",
|
||||
"phone",
|
||||
"role",
|
||||
"account_balance",
|
||||
"coupon_balance",
|
||||
"point_balance",
|
||||
@ -26,6 +26,14 @@ class ClientModel extends CustomerModel
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ['role', 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
public function getFieldRule(string $action, string $field): string
|
||||
{
|
||||
if (is_array($field)) {
|
||||
@ -45,7 +53,10 @@ class ClientModel extends CustomerModel
|
||||
case "account_balance":
|
||||
case "coupon_balance":
|
||||
case "point_balance":
|
||||
$rule = "if_exist|trim|number";
|
||||
$rule = "if_exist|trim|numeric";
|
||||
break;
|
||||
case "status":
|
||||
$rule = "if_exist|in_list[use,pause]";
|
||||
break;
|
||||
default:
|
||||
$rule = parent::getFieldRule($action, $field);
|
||||
|
||||
62
app/Models/Customer/CouponModel.php
Normal file
62
app/Models/Customer/CouponModel.php
Normal file
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Customer;
|
||||
|
||||
use App\Entities\Customer\CouponEntity;
|
||||
|
||||
class CouponModel extends CustomerModel
|
||||
{
|
||||
const TABLE = "couponinfo";
|
||||
const PK = "uid";
|
||||
const TITLE = "title";
|
||||
protected $table = self::TABLE;
|
||||
protected $primaryKey = self::PK;
|
||||
protected $returnType = CouponEntity::class;
|
||||
protected $allowedFields = [
|
||||
"clientinfo_uid",
|
||||
"status",
|
||||
"title",
|
||||
"amount",
|
||||
];
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ["clientinfo_uid", 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
public function getFieldRule(string $action, string $field): string
|
||||
{
|
||||
if (is_array($field)) {
|
||||
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
|
||||
}
|
||||
switch ($field) {
|
||||
case "clientinfo_uid":
|
||||
case "amount":
|
||||
$rule = "required|number";
|
||||
break;
|
||||
case "title":
|
||||
$rule = "required|trim|string";
|
||||
break;
|
||||
case "status":
|
||||
$rule = "required|in_list[in,out]";
|
||||
break;
|
||||
default:
|
||||
$rule = parent::getFieldRule($action, $field);
|
||||
break;
|
||||
}
|
||||
return $rule;
|
||||
}
|
||||
|
||||
//List 검색용
|
||||
public function setList_WordFilter(string $word): void
|
||||
{
|
||||
$this->orLike(self::TABLE . "." . self::TITLE, $word, 'both');
|
||||
$this->orLike(self::TABLE . '.alias', $word, 'both');
|
||||
}
|
||||
}
|
||||
62
app/Models/Customer/PointModel.php
Normal file
62
app/Models/Customer/PointModel.php
Normal file
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Customer;
|
||||
|
||||
use App\Entities\Customer\PointEntity;
|
||||
|
||||
class PointModel extends CustomerModel
|
||||
{
|
||||
const TABLE = "pointinfo";
|
||||
const PK = "uid";
|
||||
const TITLE = "title";
|
||||
protected $table = self::TABLE;
|
||||
protected $primaryKey = self::PK;
|
||||
protected $returnType = PointEntity::class;
|
||||
protected $allowedFields = [
|
||||
"clientinfo_uid",
|
||||
"status",
|
||||
"title",
|
||||
"amount",
|
||||
];
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ["clientinfo_uid", 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
public function getFieldRule(string $action, string $field): string
|
||||
{
|
||||
if (is_array($field)) {
|
||||
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
|
||||
}
|
||||
switch ($field) {
|
||||
case "clientinfo_uid":
|
||||
case "amount":
|
||||
$rule = "required|number";
|
||||
break;
|
||||
case "title":
|
||||
$rule = "required|trim|string";
|
||||
break;
|
||||
case "status":
|
||||
$rule = "required|in_list[in,out]";
|
||||
break;
|
||||
default:
|
||||
$rule = parent::getFieldRule($action, $field);
|
||||
break;
|
||||
}
|
||||
return $rule;
|
||||
}
|
||||
|
||||
//List 검색용
|
||||
public function setList_WordFilter(string $word): void
|
||||
{
|
||||
$this->orLike(self::TABLE . "." . self::TITLE, $word, 'both');
|
||||
$this->orLike(self::TABLE . '.alias', $word, 'both');
|
||||
}
|
||||
}
|
||||
@ -25,6 +25,14 @@ class MyLogModel extends CommonModel
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ['user_uid', 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
public function getFieldRule(string $action, string $field): string
|
||||
{
|
||||
if (is_array($field)) {
|
||||
|
||||
@ -26,6 +26,14 @@ class UserModel extends CommonModel
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ['role', 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
public function getFieldRule(string $action, string $field): string
|
||||
{
|
||||
if (is_array($field)) {
|
||||
|
||||
@ -28,6 +28,14 @@ class UserSNSModel extends CommonModel
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
public function getFieldRule(string $action, string $field): string
|
||||
{
|
||||
switch ($field) {
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
namespace App\Services\Auth;
|
||||
|
||||
use App\Entities\UserEntity;
|
||||
use App\Models\UserModel;
|
||||
use App\Services\CommonService;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
use CodeIgniter\Session\Session;
|
||||
@ -21,14 +20,12 @@ abstract class AuthService extends CommonService
|
||||
{
|
||||
return "Auth" . DIRECTORY_SEPARATOR;
|
||||
}
|
||||
final public function getModelClass(): UserModel
|
||||
//Index,FieldForm관련
|
||||
final public function getFields(): array
|
||||
{
|
||||
return new UserModel();
|
||||
}
|
||||
final public function getEntityClass(): UserEntity
|
||||
{
|
||||
return new UserEntity();
|
||||
return ['id', 'passwd'];
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
|
||||
final public function getSession(): Session
|
||||
{
|
||||
@ -78,9 +75,8 @@ abstract class AuthService extends CommonService
|
||||
if ($role === "") {
|
||||
return false;
|
||||
}
|
||||
$myRoles = explode(DEFAULTS['DELIMITER_ROLE'], $role);
|
||||
// 교집합이 없으면 false
|
||||
return !empty(array_intersect($myRoles, $roles));
|
||||
return !empty(array_intersect(explode(DEFAULTS['DELIMITER_ROLE'], $role), $roles));
|
||||
}
|
||||
|
||||
final public function pushCurrentUrl(string $url): void
|
||||
|
||||
@ -3,7 +3,8 @@
|
||||
namespace App\Services\Auth;
|
||||
|
||||
use App\Entities\UserEntity;
|
||||
// use App\Libraries\MySocket\GoogleSocket\CURL;
|
||||
use App\Models\UserModel;
|
||||
use App\Libraries\MySocket\GoogleSocket\CURL;
|
||||
use CodeIgniter\Exceptions\PageNotFoundException;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
@ -15,18 +16,31 @@ class GoogleService extends AuthService
|
||||
$this->_mySocket = $mySocket;
|
||||
parent::__construct($request);
|
||||
}
|
||||
public function getMySocket(): mixed
|
||||
{
|
||||
if (!$this->_mySocket) {
|
||||
throw new \Exception("Socket이 지정되지 않았습니다.");
|
||||
}
|
||||
return $this->_mySOcket;
|
||||
}
|
||||
public function getClassName(): string
|
||||
{
|
||||
return parent::getClassName() . DIRECTORY_SEPARATOR . "Google";
|
||||
}
|
||||
final public function getModelClass(): UserModel
|
||||
{
|
||||
return new UserModel();
|
||||
}
|
||||
final public function getEntityClass(): UserEntity
|
||||
{
|
||||
return new UserEntity();
|
||||
}
|
||||
|
||||
public function checkUser(string $access_code): UserEntity
|
||||
{
|
||||
try {
|
||||
// Google 서비스 설정
|
||||
if (!$this->_mySocket) {
|
||||
throw new \Exception("Socket 방식이 지정되지 않았습니다.");
|
||||
}
|
||||
$this->_mySocket->setToken($access_code);
|
||||
$this->this->getMySocket()->setToken($access_code);
|
||||
$sns_entity = $this->_mySocket->signup();
|
||||
// local db 사용와의 연결 확인
|
||||
$entity = $this->getEntity($sns_entity->getParent());
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
namespace App\Services\Auth;
|
||||
|
||||
use App\Entities\UserEntity;
|
||||
use App\Models\UserModel;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
class LocalService extends AuthService
|
||||
@ -15,6 +16,14 @@ class LocalService extends AuthService
|
||||
{
|
||||
return parent::getClassName() . DIRECTORY_SEPARATOR . "Local";
|
||||
}
|
||||
final public function getModelClass(): UserModel
|
||||
{
|
||||
return new UserModel();
|
||||
}
|
||||
final public function getEntityClass(): UserEntity
|
||||
{
|
||||
return new UserEntity();
|
||||
}
|
||||
public function checkUser(array $formDatas): UserEntity
|
||||
{
|
||||
$entity = $this->getEntity(['id' => $formDatas['id']]);
|
||||
|
||||
@ -44,6 +44,18 @@ abstract class CommonService
|
||||
}
|
||||
return $this->_model;
|
||||
}
|
||||
public function getFields(): array
|
||||
{
|
||||
return $this->getModel()->getFields();
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return $this->getModel()->getFilterFields();
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return $this->getModel()->getBatchJobFields();
|
||||
}
|
||||
final public function getEntity(mixed $where, $isThrow = true): mixed
|
||||
{
|
||||
$entity = is_array($where) ? $this->getModel()->where($where)->first() : $this->getModel()->find($where);
|
||||
|
||||
@ -13,9 +13,9 @@ class AccountService extends CustomerService
|
||||
{
|
||||
parent::__construct($request);
|
||||
}
|
||||
final public function getClassName(): string
|
||||
public function getClassName(): string
|
||||
{
|
||||
return "Account";
|
||||
return parent::getClassName() . DIRECTORY_SEPARATOR . "Account";
|
||||
}
|
||||
public function getModelClass(): AccountModel
|
||||
{
|
||||
@ -25,29 +25,4 @@ class AccountService extends CustomerService
|
||||
{
|
||||
return new AccountEntity();
|
||||
}
|
||||
public function getFormFieldOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
default:
|
||||
$this->getModel()->orderBy($this->getModel()::TITLE, 'ASC');
|
||||
$options = parent::getFormFieldOption($field, $options);
|
||||
break;
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
public function create(array $formDatas, mixed $entity = null): AccountEntity
|
||||
{
|
||||
$formDatas['role'] = implode(DEFAULTS["DELIMITER_ROLE"], $formDatas['role']);
|
||||
return parent::create($formDatas, $entity ?? new AccountEntity());
|
||||
}
|
||||
public function modify(mixed $entity, array $formDatas): AccountEntity
|
||||
{
|
||||
// die(var_export($formDatas, true));
|
||||
//Role을 지정이 있을경우에만 , toggle이나 batcjhjob에서는 없을수도 있으므로
|
||||
if (isset($formDatas['role'])) {
|
||||
$formDatas['role'] = implode(DEFAULTS["DELIMITER_ROLE"], $formDatas['role']);
|
||||
}
|
||||
// die(var_export($formDatas, true));
|
||||
return parent::modify($entity, $formDatas);
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,14 +8,15 @@ use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
class ClientService extends CustomerService
|
||||
{
|
||||
|
||||
protected ?IncomingRequest $request = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
{
|
||||
parent::__construct($request);
|
||||
}
|
||||
final public function getClassName(): string
|
||||
public function getClassName(): string
|
||||
{
|
||||
return "Client";
|
||||
return parent::getClassName() . DIRECTORY_SEPARATOR . "Client";
|
||||
}
|
||||
public function getModelClass(): ClientModel
|
||||
{
|
||||
@ -25,16 +26,6 @@ class ClientService extends CustomerService
|
||||
{
|
||||
return new ClientEntity();
|
||||
}
|
||||
public function getFormFieldOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
default:
|
||||
$this->getModel()->orderBy($this->getModel()::TITLE, 'ASC');
|
||||
$options = parent::getFormFieldOption($field, $options);
|
||||
break;
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
public function create(array $formDatas, mixed $entity = null): ClientEntity
|
||||
{
|
||||
$formDatas['role'] = implode(DEFAULTS["DELIMITER_ROLE"], $formDatas['role']);
|
||||
|
||||
28
app/Services/Customer/CouponService.php
Normal file
28
app/Services/Customer/CouponService.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Customer;
|
||||
|
||||
use App\Entities\Customer\CouponEntity;
|
||||
use App\Models\Customer\CouponModel;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
class CouponService extends CustomerService
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
{
|
||||
parent::__construct($request);
|
||||
}
|
||||
public function getClassName(): string
|
||||
{
|
||||
return parent::getClassName() . DIRECTORY_SEPARATOR . "Coupon";
|
||||
}
|
||||
public function getModelClass(): CouponModel
|
||||
{
|
||||
return new CouponModel();
|
||||
}
|
||||
public function getEntityClass(): CouponEntity
|
||||
{
|
||||
return new CouponEntity();
|
||||
}
|
||||
}
|
||||
@ -5,8 +5,15 @@ namespace App\Services\Customer;
|
||||
use App\Services\CommonService;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
use App\Services\Customer\AccountService;
|
||||
use App\Services\Customer\CouponService;
|
||||
use App\Services\Customer\PointService;
|
||||
|
||||
abstract class CustomerService extends CommonService
|
||||
{
|
||||
private ?AccountService $_accountService = null;
|
||||
private ?CouponService $_couponService = null;
|
||||
private ?PointService $_pointService = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
{
|
||||
parent::__construct($request);
|
||||
@ -15,4 +22,26 @@ abstract class CustomerService extends CommonService
|
||||
{
|
||||
return "Customer" . DIRECTORY_SEPARATOR;
|
||||
}
|
||||
|
||||
final public function getAccountService(): AccountService
|
||||
{
|
||||
if (!$this->_accountService) {
|
||||
$this->_accountService = new AccountService($this->getRequest());
|
||||
}
|
||||
return $this->_accountService;
|
||||
}
|
||||
final public function getCouponService(): CouponService
|
||||
{
|
||||
if (!$this->_couponService) {
|
||||
$this->_couponService = new CouponService($this->getRequest());
|
||||
}
|
||||
return $this->_couponService;
|
||||
}
|
||||
final public function getPointService(): PointService
|
||||
{
|
||||
if (!$this->_pointService) {
|
||||
$this->_pointService = new PointService($this->getRequest());
|
||||
}
|
||||
return $this->_pointService;
|
||||
}
|
||||
}
|
||||
|
||||
28
app/Services/Customer/PointService.php
Normal file
28
app/Services/Customer/PointService.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Customer;
|
||||
|
||||
use App\Entities\Customer\PointEntity;
|
||||
use App\Models\Customer\PointModel;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
class PointService extends CustomerService
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
{
|
||||
parent::__construct($request);
|
||||
}
|
||||
public function getClassName(): string
|
||||
{
|
||||
return parent::getClassName() . DIRECTORY_SEPARATOR . "Point";
|
||||
}
|
||||
public function getModelClass(): PointModel
|
||||
{
|
||||
return new PointModel();
|
||||
}
|
||||
public function getEntityClass(): PointEntity
|
||||
{
|
||||
return new PointEntity();
|
||||
}
|
||||
}
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Models\UserSNSModel as Model;
|
||||
use App\Entities\UserSNSEntity as Entity;
|
||||
use App\Models\UserSNSModel;
|
||||
use App\Entities\UserSNSEntity;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
// use Google\Service\AndroidEnterprise\Resource\Users;
|
||||
|
||||
@ -18,29 +18,12 @@ class UserSNSService extends CommonService
|
||||
{
|
||||
return "UserSNS";
|
||||
}
|
||||
final public function getClassPath(): string
|
||||
public function getModelClass(): UserSNSModel
|
||||
{
|
||||
return $this->getClassName();
|
||||
return new UserSNSModel();
|
||||
}
|
||||
public function getModelClass(): string
|
||||
public function getEntityClass(): UserSNSEntity
|
||||
{
|
||||
return Model::class;
|
||||
}
|
||||
public function getEntityClass(): string
|
||||
{
|
||||
return Entity::class;
|
||||
}
|
||||
|
||||
public function getFields(): array
|
||||
{
|
||||
return [$this->getModel()::PARENT, 'site', 'id', $this->getModel()::TITLE, 'email'];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return [$this->getModel()::PARENT, 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return [];
|
||||
return new UserSNSEntity();
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,15 +25,9 @@ class UserService extends CommonService
|
||||
{
|
||||
return new UserEntity();
|
||||
}
|
||||
public function getFormFieldOption(string $field, array $options = []): array
|
||||
public function getFields(): array
|
||||
{
|
||||
switch ($field) {
|
||||
default:
|
||||
$this->getModel()->orderBy($this->getModel()::TITLE, 'ASC');
|
||||
$options = parent::getFormFieldOption($field, $options);
|
||||
break;
|
||||
}
|
||||
return $options;
|
||||
return ['id', 'passwd', 'confirmpassword', $this->getModel()::TITLE, 'email', 'mobile', 'role'];
|
||||
}
|
||||
public function create(array $formDatas, mixed $entity = null): UserEntity
|
||||
{
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<div class="text-center"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></div>
|
||||
<?= form_close(); ?>
|
||||
</div>
|
||||
<?php if (session()->has('error')): ?><div class="alert alert-info"><?= session('error') ?></div><?php endif; ?>
|
||||
<?php if (session()->has('error')): ?><div class="alert alert-info"><?= nl2br(session('error')) ?></div><?php endif; ?>
|
||||
</div>
|
||||
<script src="/assets/tinymce/tinymce.js" referrerpolicy="origin"></script>
|
||||
<?= $this->endSection() ?>
|
||||
@ -55,6 +55,7 @@
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php if ($error = session('error')): ?><?= $viewDatas['helper']->alert($error) ?><?php endif ?>
|
||||
<!-- Layout Middle End -->
|
||||
<div class="layout_bottom">
|
||||
<?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/bottom'); ?>
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<div class="text-center"><?= form_submit("", '수정', ["class" => "btn btn-outline btn-primary"]) ?></div>
|
||||
<?= form_close(); ?>
|
||||
</div>
|
||||
<?php if (session()->has('error')): ?><div class="alert alert-info"><?= session('error') ?></div><?php endif; ?>
|
||||
<?php if (session()->has('error')): ?><div class="alert alert-info"><?= nl2br(session('error')) ?></div><?php endif; ?>
|
||||
</div>
|
||||
<script src="/assets/tinymce/tinymce.js" referrerpolicy="origin"></script>
|
||||
<?= $this->endSection() ?>
|
||||
@ -7,7 +7,7 @@
|
||||
<a href="/admin"><?= ICONS["HOME"] ?> Main</a>
|
||||
</div>
|
||||
<?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/left_menu/base'); ?>
|
||||
<?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/left_menu/client'); ?>
|
||||
<?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/left_menu/customer'); ?>
|
||||
<?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/left_menu/device'); ?>
|
||||
</div>
|
||||
<div id="menu_button">메뉴열기</div>
|
||||
|
||||
@ -6,21 +6,18 @@
|
||||
</h2>
|
||||
<div id="flush-client" class="accordion-collapse collapse show" aria-labelledby="flush-client">
|
||||
<div class="accordion-item">
|
||||
<a href="/admin/client"><?= ICONS['SIGNPOST'] ?>고객정보</a>
|
||||
<a href="/admin/customer/client"><?= ICONS['SIGNPOST'] ?>고객정보</a>
|
||||
</div>
|
||||
<div class="accordion-item">
|
||||
<a href="/admin/client/account"><?= ICONS['DEPOSIT'] ?>입출금내역</a>
|
||||
<a href="/admin/customer/account"><?= ICONS['DEPOSIT'] ?>입출금내역</a>
|
||||
</div>
|
||||
<div class="accordion-item">
|
||||
<a href="/admin/client/coupon"><?= ICONS['CLOUD'] ?> 쿠폰내역</a>
|
||||
<a href="/admin/customer/coupon"><?= ICONS['CLOUD'] ?> 쿠폰내역</a>
|
||||
</div>
|
||||
<div class="accordion-item">
|
||||
<a href="/admin/client/point"><?= ICONS['FLAG'] ?> Point내역</a>
|
||||
<a href="/admin/customer/point"><?= ICONS['FLAG'] ?> Point내역</a>
|
||||
</div>
|
||||
<div class="accordion-item">
|
||||
<a href="/admin/client/service"><?= ICONS['CART'] ?> Service내역</a>
|
||||
</div>
|
||||
<div class="accordion-item">
|
||||
<a href="/admin/client/invoice"><?= ICONS['CARD'] ?> 청구내역</a>
|
||||
<a href="/admin/customer/invoice"><?= ICONS['CARD'] ?> 청구내역</a>
|
||||
</div>
|
||||
</div>
|
||||
@ -1 +0,0 @@
|
||||
<?php if ($error = session('error')): ?><?= $viewDatas['helper']->alert($error) ?><?php endif ?>
|
||||
Loading…
Reference in New Issue
Block a user