dbmsv2 init...1
This commit is contained in:
parent
189fc3da7f
commit
dec5d81824
@ -3,13 +3,14 @@
|
||||
namespace App\Controllers\Admin\Customer;
|
||||
|
||||
use App\Entities\Customer\ClientEntity;
|
||||
use App\Entities\Customer\PaymentEntity;
|
||||
use App\Entities\Customer\ServiceEntity;
|
||||
use App\Helpers\Customer\PaymentHelper;
|
||||
use App\Libraries\LogCollector;
|
||||
|
||||
use App\Services\Customer\PaymentService;
|
||||
use App\Libraries\LogCollector;
|
||||
use App\Services\Customer\ClientService;
|
||||
|
||||
use App\Services\Customer\PaymentService;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
@ -69,18 +70,18 @@ class PaymentController extends CustomerController
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
//생성관련
|
||||
protected function create_process(array $formDatas): void
|
||||
protected function create_process(array $formDatas): PaymentEntity
|
||||
{
|
||||
// 관리자 UID는 현재 인증된 사용자로 설정
|
||||
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
||||
parent::create_process($formDatas);
|
||||
return parent::create_process($formDatas);
|
||||
}
|
||||
//수정관련
|
||||
protected function modify_process(mixed $entity, array $formDatas): void
|
||||
protected function modify_process(mixed $entity, array $formDatas): PaymentEntity
|
||||
{
|
||||
// 관리자 UID는 현재 인증된 사용자로 설정
|
||||
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
||||
parent::modify_process($entity, $formDatas);
|
||||
return parent::modify_process($entity, $formDatas);
|
||||
}
|
||||
//Invoice 관련
|
||||
private function getOwnersForInvoice(ClientEntity $clientEntity): array
|
||||
|
||||
@ -2,9 +2,10 @@
|
||||
|
||||
namespace App\Controllers\Admin\Customer;
|
||||
|
||||
use App\Entities\Customer\ServiceEntity;
|
||||
use App\Helpers\Customer\ServiceHelper;
|
||||
use App\Services\Customer\PaymentService;
|
||||
|
||||
use App\Services\Customer\PaymentService;
|
||||
use App\Services\Customer\ServiceService;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
@ -45,18 +46,18 @@ class ServiceController extends CustomerController
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
//생성관련
|
||||
protected function create_process(array $formDatas): void
|
||||
protected function create_process(array $formDatas): ServiceEntity
|
||||
{
|
||||
// 관리자 UID는 현재 인증된 사용자로 설정
|
||||
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
||||
parent::create_process($formDatas);
|
||||
return parent::create_process($formDatas);
|
||||
}
|
||||
//수정관련
|
||||
protected function modify_process(mixed $entity, array $formDatas): void
|
||||
protected function modify_process(mixed $entity, array $formDatas): ServiceEntity
|
||||
{
|
||||
// 관리자 UID는 현재 인증된 사용자로 설정
|
||||
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
||||
parent::modify_process($entity, $formDatas);
|
||||
return parent::modify_process($entity, $formDatas);
|
||||
}
|
||||
//List 관련
|
||||
protected function index_process(array $entities = []): array
|
||||
|
||||
@ -2,10 +2,11 @@
|
||||
|
||||
namespace App\Controllers\Admin\Equipment;
|
||||
|
||||
use App\Entities\Equipment\ServerEntity;
|
||||
use App\Helpers\Equipment\ServerHelper;
|
||||
use App\Services\Equipment\ServerService;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
@ -62,7 +63,7 @@ class ServerController extends EquipmentController
|
||||
$this->setFieldDefaultValue('code', $this->getService()->getLastestCode($format, (int)env("Server.Default.code", 0)));
|
||||
parent::create_form_process();
|
||||
}
|
||||
protected function create_process(array $formDatas): void
|
||||
protected function create_process(array $formDatas): ServerEntity
|
||||
{
|
||||
//코드 패턴체크
|
||||
$pattern = env("Server.Prefix.code.pattern", false);
|
||||
@ -75,7 +76,7 @@ class ServerController extends EquipmentController
|
||||
if (!preg_match($pattern, $formDatas['code'])) {
|
||||
throw new \Exception("Server코드[{$formDatas['code']}의 형식이 맞지않습니다");
|
||||
}
|
||||
parent::create_process($formDatas);
|
||||
$entity = parent::create_process($formDatas);
|
||||
|
||||
//추가 파트정보 생성
|
||||
$partDatas = [];
|
||||
@ -86,6 +87,7 @@ class ServerController extends EquipmentController
|
||||
"extgra" => $this->request->getPost("partinfo_{$basePart}_uid_extra") ?? ""
|
||||
];
|
||||
}
|
||||
$this->serverPartEntities = $this->getService()->createServerParts($this->entity, $partDatas);
|
||||
$this->serverPartEntities = $this->getService()->createServerParts($entity, $partDatas);
|
||||
return $entity;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,13 +2,14 @@
|
||||
|
||||
namespace App\Controllers\Admin\Equipment;
|
||||
|
||||
use App\Entities\Equipment\SwitchEntity;
|
||||
use App\Helpers\Equipment\SwitchHelper;
|
||||
use App\Services\Equipment\SwitchService;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Helpers\Equipment\SwitchHelper;
|
||||
use App\Services\Equipment\SwitchService;
|
||||
|
||||
class SwitchController extends EquipmentController
|
||||
{
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
@ -35,7 +36,7 @@ class SwitchController extends EquipmentController
|
||||
return $this->_helper;
|
||||
}
|
||||
//Index,FieldForm관
|
||||
protected function create_process(array $formDatas): void
|
||||
protected function create_process(array $formDatas): SwitchEntity
|
||||
{
|
||||
//코드 패턴체크
|
||||
$pattern = env("Switch.Prefix.code.pattern", false);
|
||||
@ -48,6 +49,6 @@ class SwitchController extends EquipmentController
|
||||
if (!preg_match($pattern, $formDatas['code'])) {
|
||||
throw new \Exception("Switch코드[{$formDatas['code']}의 형식이 맞지않습니다");
|
||||
}
|
||||
parent::create_process($formDatas);
|
||||
return parent::create_process($formDatas);
|
||||
}
|
||||
}
|
||||
|
||||
@ -111,7 +111,7 @@ class UserController extends AdminController
|
||||
'fields' => ['id', 'passwd', 'confirmpassword', 'name', 'email', 'mobile'],
|
||||
]);
|
||||
//전달값받기
|
||||
$formDatas = $this->getFormDatas($this->getControlDatas('actionFields'));
|
||||
$formDatas = $this->getFormDatas($this->getControlDatas('actionFields'), $this->request->getPost());
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
|
||||
@ -103,11 +103,7 @@ abstract class CommonController extends BaseController
|
||||
foreach ($this->getControlDatas('actionFields') as $field) {
|
||||
$temps[$field] = $this->getFormFieldRule_process($this->getAction(), $field);
|
||||
}
|
||||
// echo var_dump($temps);
|
||||
// echo "TEST3";
|
||||
// exit;
|
||||
$this->setControlDatas('field_rules', $temps);
|
||||
|
||||
//Form용 Options정의
|
||||
$temps = [];
|
||||
foreach ($this->getControlDatas('actionFilters') as $field) {
|
||||
@ -117,38 +113,25 @@ abstract class CommonController extends BaseController
|
||||
}
|
||||
}
|
||||
$this->setControlDatas('filter_optons', $temps);
|
||||
}
|
||||
//입력 데이터 검증
|
||||
private function doValidate(array $rules, array $formDatas, ?Validation $validation = null): array
|
||||
{
|
||||
//변경할 값 확인 : Upload된 파일 검증시 $this->request->getPOST()보다 먼처 체크필요
|
||||
if (!$validation) {
|
||||
$validation = service('validation');
|
||||
}
|
||||
// dd($rules);
|
||||
foreach ($rules as $field => $rule) {
|
||||
$validation = $this->doValidation_process($validation, $field, $rule);
|
||||
}
|
||||
// dd($formDatas);
|
||||
if (!$validation->run($formDatas)) {
|
||||
throw new \Exception("{$this->getService()->getClassName()} 작업 데이터 검증 오류발생\n" . implode(
|
||||
"\n",
|
||||
$validation->getErrors()
|
||||
));
|
||||
}
|
||||
return $formDatas;
|
||||
// return $validation->getValidated();
|
||||
$this->setControlDatas(
|
||||
'batchjob_fields',
|
||||
array_key_exists('batchjob_fields', $actionFields) ? $actionFields['batchjob_fields'] : $this->getService()->getBatchjobFields()
|
||||
);
|
||||
$this->setControlDatas(
|
||||
'batchjob_buttions',
|
||||
array_key_exists('batchjob_buttions', $actionFields) ? $actionFields['batchjob_buttions'] : $this->getService()->getBatchjobButtons()
|
||||
);
|
||||
}
|
||||
//전체 FormDatas 전달값받기
|
||||
final protected function getFormDatas(array $fields, array $formDatas = []): array
|
||||
final protected function getFormDatas(array $fields, array $requestDatas, array $formDatas = []): array
|
||||
{
|
||||
foreach ($fields as $field) {
|
||||
//Post값이 null이면 formDatas에서 해당하는 default값이 있는지 확인후 넣고,없으면 최종적으로 null
|
||||
$datas = $this->request->getPost($field);
|
||||
$datas = $requestDatas[$field] ?? null;
|
||||
if ($datas !== null) {
|
||||
$formDatas[$field] = $datas;
|
||||
} else {
|
||||
$formDatas = $this->getFormData_process($field, $formDatas);
|
||||
$formDatas = $this->getFormData_process($field, $requestDatas, $formDatas);
|
||||
}
|
||||
}
|
||||
return $formDatas;
|
||||
@ -161,12 +144,28 @@ abstract class CommonController extends BaseController
|
||||
$this->_control['field_default_values'][$field] = $default;
|
||||
}
|
||||
//FormDatas 검증
|
||||
final protected function doValidation(array $formDatas): void
|
||||
{
|
||||
//변경할 값 확인 : Upload된 파일 검증시 $this->request->getPOST()보다 먼처 체크필요
|
||||
$validation = service('validation');
|
||||
foreach ($this->getControlDatas('field_rules') as $field => $rule) {
|
||||
$validation = $this->doValidation_process($validation, $field, $rule);
|
||||
}
|
||||
if (!$validation->run($formDatas)) {
|
||||
throw new \Exception("{$this->getService()->getClassName()} 작업 데이터 검증 오류발생\n" . implode(
|
||||
"\n",
|
||||
$validation->getErrors()
|
||||
));
|
||||
}
|
||||
// return $validation->getValidated();
|
||||
}
|
||||
//생성 기본기능
|
||||
final public function create_form(): RedirectResponse|string
|
||||
{
|
||||
try {
|
||||
//각 Field 초기화
|
||||
$this->setAction(__FUNCTION__);
|
||||
//각 Field 초기화
|
||||
$this->initAction();
|
||||
$this->create_form_process();
|
||||
//actionFilters에 해당하는 값이 있을 경우 정의
|
||||
@ -183,10 +182,12 @@ abstract class CommonController extends BaseController
|
||||
try {
|
||||
//각 Field 초기화
|
||||
$this->setAction(__FUNCTION__);
|
||||
//각 Field 초기화
|
||||
$this->initAction();
|
||||
//전달값받기
|
||||
$formDatas = $this->getFormDatas($this->getControlDatas('actionFields'));
|
||||
$this->create_process($formDatas);
|
||||
$formDatas = $this->getFormDatas($this->getControlDatas('actionFields'), $this->request->getPost());
|
||||
$formDatas = $this->create_validate_process($formDatas);
|
||||
$this->entity = $this->create_process($formDatas);
|
||||
$this->_db->transCommit();
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
@ -200,13 +201,14 @@ abstract class CommonController extends BaseController
|
||||
try {
|
||||
//각 Field 초기화
|
||||
$this->setAction(__FUNCTION__);
|
||||
$this->initAction();
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->modify_form_process($entity);
|
||||
//각 Field 초기화
|
||||
$this->initAction();
|
||||
$this->entity = $this->modify_form_process($entity);
|
||||
helper(['form']);
|
||||
$this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
|
||||
return $this->getResultSuccess();
|
||||
@ -219,17 +221,19 @@ abstract class CommonController extends BaseController
|
||||
//Transaction Start
|
||||
$this->_db->transStart();
|
||||
try {
|
||||
//각 Field 초기화
|
||||
//Action 정의
|
||||
$this->setAction(__FUNCTION__);
|
||||
$this->initAction();
|
||||
//전달값받기
|
||||
$formDatas = $this->getFormDatas($this->getControlDatas('actionFields'));
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->modify_process($entity, $formDatas);
|
||||
//각 Field 초기화
|
||||
$this->initAction();
|
||||
//전달값받기
|
||||
$formDatas = $this->getFormDatas($this->getControlDatas('actionFields'), $this->request->getPost());
|
||||
$formDatas = $this->modify_validate_process($formDatas);
|
||||
$this->entity = $this->modify_process($entity, $formDatas);
|
||||
$this->_db->transCommit();
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
@ -243,17 +247,20 @@ abstract class CommonController extends BaseController
|
||||
//Transaction Start
|
||||
$this->_db->transStart();
|
||||
try {
|
||||
//각 Field 초기화:조건항목 Field는 한개만 존재하므로 Field와 Rule을 정의
|
||||
$this->setAction(__FUNCTION__);
|
||||
$this->initAction(['fields' => [$field], 'filters' => [$field]]);
|
||||
//입력값정의
|
||||
$formDatas = [$field => $this->request->getVar($field)];
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->toggle_process($entity, $formDatas);
|
||||
//각 Field 초기화:조건항목 Field는 한개만 존재하므로 Field와 Rule을 정의
|
||||
$this->initAction(['fields' => [$field], 'filters' => [$field]]);
|
||||
//전달값받기
|
||||
$formDatas = $this->getFormDatas($this->getControlDatas('actionFields'), $this->request->getVar());
|
||||
$formDatas = $this->toggle_validate_process($formDatas);
|
||||
// echo var_dump($this->getControlDatas());
|
||||
// dd($formDatas);
|
||||
$this->entity = $this->toggle_process($entity, $formDatas);
|
||||
$this->_db->transCommit();
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
@ -262,16 +269,15 @@ abstract class CommonController extends BaseController
|
||||
}
|
||||
}
|
||||
//일괄처리작업기능
|
||||
final public function batchjob(): RedirectResponse|string
|
||||
protected function batchjob_pre_process(): array
|
||||
{
|
||||
//Transaction Start
|
||||
$this->_db->transStart();
|
||||
try {
|
||||
$selectedFields = [];
|
||||
//getBatchJobFields를 이용해서 선택된 Field 와 값정의
|
||||
$formDatas = [];
|
||||
foreach ($this->getService()->getBatchJobFields() as $field) {
|
||||
foreach ($this->getControlDatas('batchjob_fields') as $field) {
|
||||
$value = $this->request->getPost($field);
|
||||
echo "TEST:" . $value;
|
||||
exit;
|
||||
if ($value) {
|
||||
$selectedFields[] = $field;
|
||||
$formDatas[$field] = $value;
|
||||
@ -285,12 +291,29 @@ abstract class CommonController extends BaseController
|
||||
if (!is_array($uids) || !count($uids)) {
|
||||
throw new \Exception("적용할 리스트을 선택하셔야합니다.");
|
||||
}
|
||||
//각 Field 초기화: 일괄작업은 선택된 조건항목 Field만 존재하므로 Field와 Rule을 정의
|
||||
return [$selectedFields, $formDatas, $uids];
|
||||
}
|
||||
final public function batchjob(): RedirectResponse|string
|
||||
{
|
||||
//Transaction Start
|
||||
$this->_db->transStart();
|
||||
try {
|
||||
//Action 정의
|
||||
$this->setAction(__FUNCTION__);
|
||||
list($selectedFields, $formDatas, $uids) = $this->batchjob_pre_process();
|
||||
//각 Field 초기화: 일괄작업은 선택된 조건항목 Field만 존재하므로 Field와 Rule을 정의
|
||||
$this->initAction(['fields' => [$selectedFields], 'filters' => [$selectedFields]]);
|
||||
//전달값받기
|
||||
$formDatas = $this->getFormDatas($this->getControlDatas('actionFields'), $this->request->getPost());
|
||||
$formDatas = $this->batchjob_validate_process($formDatas);
|
||||
$entities = [];
|
||||
foreach ($uids as $uid) {
|
||||
$entities = $this->batchjob_process($uid, $formDatas, $entities);
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$entities[] = $this->batchjob_process($entity, $formDatas);
|
||||
}
|
||||
$this->entities = $entities;
|
||||
$this->_db->transCommit();
|
||||
@ -306,7 +329,7 @@ abstract class CommonController extends BaseController
|
||||
//Transaction Start
|
||||
$this->_db->transStart();
|
||||
try {
|
||||
//각 Field 초기화:삭제는 다른 초기화 필요없음
|
||||
//Action 정의:삭제는 다른 초기화 필요없음
|
||||
$this->setAction(__FUNCTION__);
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
@ -327,16 +350,21 @@ abstract class CommonController extends BaseController
|
||||
//Transaction Start
|
||||
$this->_db->transStart();
|
||||
try {
|
||||
//Action 정의:삭제는 다른 초기화 필요없음
|
||||
$this->setAction(__FUNCTION__);
|
||||
//변경할 UIDS
|
||||
$uids = $this->request->getPost('batchjob_uids[]');
|
||||
if (!is_array($uids) || !count($uids)) {
|
||||
throw new \Exception("적용할 리스트를 선택하셔야합니다.");
|
||||
}
|
||||
//각 Field 초기화:삭제는 다른 초기화 필요없음
|
||||
$this->setAction(__FUNCTION__);
|
||||
$entities = [];
|
||||
foreach ($uids as $uid) {
|
||||
$entities = $this->batchjob_delete_process($uid, $entities);
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$entities[] = $this->batchjob_delete_process($entity);
|
||||
}
|
||||
$this->entities = $entities;
|
||||
$this->_db->transCommit();
|
||||
@ -350,15 +378,16 @@ abstract class CommonController extends BaseController
|
||||
final public function view(string $uid): RedirectResponse|string
|
||||
{
|
||||
try {
|
||||
//각 Field 초기화
|
||||
//Action 정의
|
||||
$this->setAction(__FUNCTION__);
|
||||
$this->initAction();
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->view_process($entity);
|
||||
//각 Field 초기화
|
||||
$this->initAction();
|
||||
$this->entity = $this->view_process($entity);
|
||||
helper(['form']);
|
||||
$this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
|
||||
return $this->getResultSuccess();
|
||||
@ -388,8 +417,9 @@ abstract class CommonController extends BaseController
|
||||
final public function download(string $output_type, mixed $uid = false): DownloadResponse|RedirectResponse|string
|
||||
{
|
||||
try {
|
||||
//각 Field 초기화
|
||||
//Action 정의
|
||||
$this->setAction(__FUNCTION__);
|
||||
//각 Field 초기화
|
||||
$this->initAction();
|
||||
//URL처리
|
||||
// $this->uri = $this->request->getUri();
|
||||
@ -439,8 +469,6 @@ abstract class CommonController extends BaseController
|
||||
$temps = is_array($actionFields) && array_key_exists('fields', $actionFields) ? $actionFields : $this->getService()->getIndexFields();
|
||||
$this->setControlDatas('actionFields', is_array($temps) && array_key_exists('fields', $temps) ? $temps['fields'] : []);
|
||||
$this->setControlDatas('actionFilters', is_array($temps) && array_key_exists('filters', $temps) ? $temps['filters'] : []);
|
||||
$this->setControlDatas('batchjob_fields', array_key_exists('batchjob_fields', $temps) ? $temps['batchjob_fields'] : []);
|
||||
$this->setControlDatas('batchjob_buttions', array_key_exists('batchjob_buttions', $temps) ? $temps['batchjob_buttions'] : []);
|
||||
break;
|
||||
default:
|
||||
$temps = is_array($actionFields) && array_key_exists('fields', $actionFields) ? $actionFields : $this->getService()->getFormFields();
|
||||
@ -475,7 +503,7 @@ abstract class CommonController extends BaseController
|
||||
return $rule;
|
||||
}
|
||||
//FormData Field별 전달값 처리
|
||||
protected function getFormData_process(string $field, array $formDatas): array
|
||||
protected function getFormData_process(string $field, array $requestDatas, array $formDatas): array
|
||||
{
|
||||
return $formDatas;
|
||||
}
|
||||
@ -532,65 +560,63 @@ abstract class CommonController extends BaseController
|
||||
//Index,FieldForm관련
|
||||
//생성관련
|
||||
protected function create_form_process(): void {}
|
||||
protected function create_process(array $formDatas): void
|
||||
protected function create_validate_process(array $formDatas): array
|
||||
{
|
||||
//데이터 검증
|
||||
$validDatas = $this->doValidate($this->getControlDatas('field_rules'), $formDatas);
|
||||
$this->entity = $this->getService()->create($validDatas);
|
||||
$this->doValidation($formDatas);
|
||||
return $formDatas;
|
||||
}
|
||||
protected function create_process(array $formDatas): mixed
|
||||
{
|
||||
return $this->getService()->create($formDatas);
|
||||
}
|
||||
//수정관련
|
||||
protected function modify_form_process(mixed $entity): void
|
||||
protected function modify_form_process(mixed $entity): mixed
|
||||
{
|
||||
$this->entity = $entity;
|
||||
return $entity;
|
||||
}
|
||||
protected function modify_process(mixed $entity, array $formDatas): void
|
||||
protected function modify_validate_process(array $formDatas): array
|
||||
{
|
||||
//데이터 검증
|
||||
$validDatas = $this->doValidate($this->getControlDatas('field_rules'), $formDatas);
|
||||
$this->entity = $this->getService()->modify($entity, $validDatas);
|
||||
$this->doValidation($formDatas);
|
||||
return $formDatas;
|
||||
}
|
||||
protected function modify_process(mixed $entity, array $formDatas): mixed
|
||||
{
|
||||
return $this->getService()->modify($entity, $formDatas);
|
||||
}
|
||||
//단일필드작업기능
|
||||
protected function toggle_process(mixed $entity, array $formDatas): void
|
||||
protected function toggle_validate_process(array $formDatas): array
|
||||
{
|
||||
//데이터 검증
|
||||
$validDatas = $this->doValidate($this->getControlDatas('field_rules'), $formDatas);
|
||||
$this->entity = $this->getService()->modify($entity, $validDatas);
|
||||
$this->doValidation($formDatas);
|
||||
return $formDatas;
|
||||
}
|
||||
protected function toggle_process(mixed $entity, array $formDatas): mixed
|
||||
{
|
||||
return $this->getService()->modify($entity, $formDatas);
|
||||
}
|
||||
//일괄처리작업기능
|
||||
protected function batchjob_process(string|int $uid, array $formDatas, array $entities = []): array
|
||||
protected function batchjob_validate_process(array $formDatas): array
|
||||
{
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
LogCollector::debug(__METHOD__ . "에서 {$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
} else {
|
||||
//데이터 검증
|
||||
$validDatas = $this->doValidate($this->getControlDatas('field_rules'), $formDatas);
|
||||
$entities[] = $this->getService()->modify($entity, $validDatas);
|
||||
$this->doValidation($formDatas);
|
||||
return $formDatas;
|
||||
}
|
||||
return $entities;
|
||||
protected function batchjob_process($entity, array $formDatas): mixed
|
||||
{
|
||||
return $this->getService()->modify($entity, $formDatas);
|
||||
}
|
||||
//삭제관련
|
||||
protected function delete_process(mixed $entity): void
|
||||
protected function delete_process(mixed $entity): mixed
|
||||
{
|
||||
$this->entity = $this->getService()->delete($entity);
|
||||
return $this->getService()->delete($entity);
|
||||
}
|
||||
//일괄삭제관련
|
||||
protected function batchjob_delete_process(string|int $uid, array $entities = []): array
|
||||
protected function batchjob_delete_process(mixed $entity, array $entities = []): mixed
|
||||
{
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
LogCollector::debug(__METHOD__ . "에서 {$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
} else {
|
||||
$entities[] = $this->getService()->delete($entity);
|
||||
}
|
||||
return $entities;
|
||||
return $this->getService()->delete($entity);
|
||||
}
|
||||
//View 관련
|
||||
protected function view_process(mixed $entity): void
|
||||
protected function view_process(mixed $entity): mixed
|
||||
{
|
||||
$this->entity = $entity;
|
||||
return $entity;
|
||||
}
|
||||
//리스트관련
|
||||
//조건절 처리
|
||||
@ -612,10 +638,10 @@ abstract class CommonController extends BaseController
|
||||
{
|
||||
//Paramter로 전달된 Filter값을 정의용
|
||||
$filter_values = [];
|
||||
foreach ($this->_control['actionFilters'] as $field) {
|
||||
foreach ($this->getControlDatas('actionFilters') as $field) {
|
||||
$filter_values = $this->index_condition_filterfield_process($field, $filter_values);
|
||||
}
|
||||
$this->_control['filter_values'] = $filter_values;
|
||||
$this->setControlDatas('filter_values', $filter_values);
|
||||
//검색어조건절 처리
|
||||
$this->word = $this->request->getVar('word');
|
||||
if ($this->word !== null && $this->word !== '') {
|
||||
@ -664,8 +690,9 @@ abstract class CommonController extends BaseController
|
||||
public function index(): RedirectResponse|string
|
||||
{
|
||||
try {
|
||||
//각 Field 초기화
|
||||
//Action 정의
|
||||
$this->setAction(__FUNCTION__);
|
||||
//각 Field 초기화
|
||||
$this->initAction();
|
||||
helper(['form']);
|
||||
//Return Url정의
|
||||
|
||||
@ -37,6 +37,11 @@ class GoogleService extends AuthService
|
||||
'filters' => [],
|
||||
];
|
||||
}
|
||||
public function getBatchjobButtons(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
//기본기능
|
||||
public function login(array $formDatas): UserEntity
|
||||
{
|
||||
try {
|
||||
|
||||
@ -31,11 +31,17 @@ class LocalService extends AuthService
|
||||
"status",
|
||||
],
|
||||
'filters' => [],
|
||||
'batchjob_fields' => ['status'],
|
||||
'batchjob_buttions' => []
|
||||
];
|
||||
}
|
||||
|
||||
public function getBatchjobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
public function getBatchjobButtons(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
//기본기능
|
||||
public function login(array $formDatas): UserEntity
|
||||
{
|
||||
$entity = $this->getEntity(['id' => $formDatas['id'], 'status' => UserEntity::DEFAULT_STATUS], false);
|
||||
|
||||
@ -17,10 +17,6 @@ abstract class CommonService
|
||||
}
|
||||
abstract public function getFormFields(): array;
|
||||
abstract public function getIndexFields(): array;
|
||||
public function getViewFields(): array
|
||||
{
|
||||
return $this->getFormFields();
|
||||
}
|
||||
//기본 기능부분
|
||||
final public function __get($name)
|
||||
{
|
||||
@ -120,6 +116,21 @@ abstract class CommonService
|
||||
//기본 기능부분
|
||||
|
||||
//FieldForm관련용
|
||||
public function getViewFields(): array
|
||||
{
|
||||
return $this->getFormFields();
|
||||
}
|
||||
public function getBatchjobFields(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
public function getBatchjobButtons(): array
|
||||
{
|
||||
return [
|
||||
'batchjob' => '일괄 처리',
|
||||
'batchjob_delete' => '일괄 삭제',
|
||||
];
|
||||
}
|
||||
public function getFormFieldOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
|
||||
@ -49,13 +49,12 @@ class AccountService extends CustomerService
|
||||
"bank",
|
||||
"status",
|
||||
],
|
||||
'batchjob_fields' => ['status'],
|
||||
'batchjob_buttions' => [
|
||||
'batchjob' => '일괄 처리',
|
||||
'batchjob_delete' => '일괄 삭제',
|
||||
]
|
||||
];
|
||||
}
|
||||
public function getBatchjobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
//기본 기능부분
|
||||
|
||||
//고객예치금처리
|
||||
|
||||
@ -50,17 +50,12 @@ class ClientService extends CustomerService
|
||||
'role',
|
||||
'status',
|
||||
],
|
||||
'batchjob_fields' => [
|
||||
'site',
|
||||
'role',
|
||||
'status',
|
||||
],
|
||||
'batchjob_buttions' => [
|
||||
'batchjob' => '일괄 처리',
|
||||
'batchjob_delete' => '일괄 삭제',
|
||||
]
|
||||
];
|
||||
}
|
||||
public function getBatchjobFields(): array
|
||||
{
|
||||
return ['site', 'role', 'status'];
|
||||
}
|
||||
//기본 기능부분
|
||||
|
||||
//압금(쿠폰:추가)처리
|
||||
|
||||
@ -41,13 +41,12 @@ class CouponService extends CustomerService
|
||||
"clientinfo_uid",
|
||||
"status",
|
||||
],
|
||||
'batchjob_fields' => ['status'],
|
||||
'batchjob_buttions' => [
|
||||
'batchjob' => '일괄 처리',
|
||||
'batchjob_delete' => '일괄 삭제',
|
||||
]
|
||||
];
|
||||
}
|
||||
public function getBatchjobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
//기본 기능부분
|
||||
|
||||
//고객예치금처리
|
||||
|
||||
@ -66,10 +66,16 @@ class PaymentService extends CustomerService
|
||||
'status',
|
||||
'user_uid'
|
||||
],
|
||||
'batchjob_fields' => ['clientinfo_uid', 'billing', 'pay', 'status'],
|
||||
'batchjob_buttions' => [
|
||||
];
|
||||
}
|
||||
public function getBatchjobFields(): array
|
||||
{
|
||||
return ['clientinfo_uid', 'billing', 'pay', 'status'];
|
||||
}
|
||||
public function getBatchjobButtons(): array
|
||||
{
|
||||
return [
|
||||
'invoice' => '청구서 발행',
|
||||
],
|
||||
];
|
||||
}
|
||||
//기본 기능부분
|
||||
|
||||
@ -41,13 +41,12 @@ class PointService extends CustomerService
|
||||
"clientinfo_uid",
|
||||
"status",
|
||||
],
|
||||
'batchjob_fields' => ['status'],
|
||||
'batchjob_buttions' => [
|
||||
'batchjob' => '일괄 처리',
|
||||
'batchjob_delete' => '일괄 삭제',
|
||||
]
|
||||
];
|
||||
}
|
||||
public function getBatchjobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
//기본 기능부분
|
||||
|
||||
private function setBalance(array $formDatas): void
|
||||
|
||||
@ -64,13 +64,12 @@ class ServiceService extends CustomerService
|
||||
'location',
|
||||
'status'
|
||||
],
|
||||
'batchjob_fields' => ['site', 'clientinfo_uid', 'status'],
|
||||
'batchjob_buttions' => [
|
||||
'batchjob' => '일괄 처리',
|
||||
'batchjob_delete' => '일괄 삭제',
|
||||
]
|
||||
];
|
||||
}
|
||||
public function getBatchjobFields(): array
|
||||
{
|
||||
return ['site', 'clientinfo_uid', 'status'];
|
||||
}
|
||||
//기본 기능부분
|
||||
//검색용
|
||||
public function setSearchIp(string $ip): void
|
||||
|
||||
@ -53,13 +53,12 @@ class CSService extends EquipmentService
|
||||
'type',
|
||||
'status'
|
||||
],
|
||||
'batchjob_fields' => ["type", 'status'],
|
||||
'batchjob_buttions' => [
|
||||
'batchjob' => '일괄 처리',
|
||||
'batchjob_delete' => '일괄 삭제',
|
||||
]
|
||||
];
|
||||
}
|
||||
public function getBatchjobFields(): array
|
||||
{
|
||||
return ['type', 'status'];
|
||||
}
|
||||
//기본 기능부분
|
||||
//List 검색용
|
||||
//OrderBy 처리
|
||||
|
||||
@ -57,12 +57,12 @@ class IPService extends EquipmentService
|
||||
'status'
|
||||
],
|
||||
'batchjob_fields' => ['status'],
|
||||
'batchjob_buttions' => [
|
||||
'batchjob' => '일괄 처리',
|
||||
'batchjob_delete' => '일괄 삭제',
|
||||
]
|
||||
];
|
||||
}
|
||||
public function getBatchjobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
final public function getLineService(): LineService
|
||||
{
|
||||
if (!$this->_lineService) {
|
||||
|
||||
@ -43,12 +43,11 @@ class LineService extends EquipmentService
|
||||
"type",
|
||||
'status',
|
||||
],
|
||||
'batchjob_fields' => ['status'],
|
||||
'batchjob_buttions' => [
|
||||
'batchjob' => '일괄 처리',
|
||||
'batchjob_delete' => '일괄 삭제',
|
||||
],
|
||||
];
|
||||
}
|
||||
public function getBatchjobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
//기본 기능부분}
|
||||
}
|
||||
|
||||
@ -40,13 +40,12 @@ class PartService extends EquipmentService
|
||||
"type",
|
||||
'status',
|
||||
],
|
||||
'batchjob_fields' => ['status'],
|
||||
'batchjob_buttions' => [
|
||||
'batchjob' => '일괄 처리',
|
||||
'batchjob_delete' => '일괄 삭제',
|
||||
]
|
||||
];
|
||||
}
|
||||
public function getBatchjobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
//기본 기능부분
|
||||
//FieldForm관련용
|
||||
//List 검색용
|
||||
|
||||
@ -64,13 +64,12 @@ class ServerService extends EquipmentService
|
||||
'status'
|
||||
],
|
||||
'filters' => ['clientinfo_uid', 'serviceinfo_uid', 'type', 'partinfo_uid', 'status'],
|
||||
'batchjob_fields' => ['clientinfo_uid', 'partinfo_uid', 'status'],
|
||||
'batchjob_buttions' => [
|
||||
'batchjob' => '일괄 처리',
|
||||
'batchjob_delete' => '일괄 삭제',
|
||||
]
|
||||
];
|
||||
}
|
||||
public function getBatchjobFields(): array
|
||||
{
|
||||
return ['clientinfo_uid', 'partinfo_uid', 'status'];
|
||||
}
|
||||
final public function getPartService(): PartService
|
||||
{
|
||||
if (!$this->_partService) {
|
||||
|
||||
@ -45,13 +45,12 @@ class SwitchService extends EquipmentService
|
||||
'serverinfo_uid',
|
||||
'status'
|
||||
],
|
||||
'batchjob_fields' => ['clientinfo_uid', 'serverinfo_uid', 'status'],
|
||||
'batchjob_buttions' => [
|
||||
'batchjob' => '일괄 처리',
|
||||
'batchjob_delete' => '일괄 삭제',
|
||||
]
|
||||
];
|
||||
}
|
||||
public function getBatchjobFields(): array
|
||||
{
|
||||
return ['clientinfo_uid', 'serverinfo_uid', 'status'];
|
||||
}
|
||||
//기본 기능부분
|
||||
//FieldForm관련용
|
||||
//상태변경
|
||||
|
||||
@ -43,13 +43,12 @@ class MyLogService extends CommonService
|
||||
'user_uid',
|
||||
'status'
|
||||
],
|
||||
'batchjob_fields' => ['status'],
|
||||
'batchjob_buttions' => [
|
||||
'batchjob' => '일괄 처리',
|
||||
'batchjob_delete' => '일괄 삭제',
|
||||
]
|
||||
];
|
||||
}
|
||||
public function getBatchjobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
public function getUserService(): UserService
|
||||
{
|
||||
if (!$this->_userService) {
|
||||
|
||||
@ -49,12 +49,11 @@ class UserSNSService extends CommonService
|
||||
"user_uid",
|
||||
"status",
|
||||
],
|
||||
'batchjob_fields' => ['status'],
|
||||
'batchjob_buttions' => [
|
||||
'batchjob' => '일괄 처리',
|
||||
'batchjob_delete' => '일괄 삭제',
|
||||
]
|
||||
];
|
||||
}
|
||||
public function getBatchjobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
//기본 기능부분
|
||||
}
|
||||
|
||||
@ -62,13 +62,12 @@ class UserService extends CommonService
|
||||
'role',
|
||||
'status'
|
||||
],
|
||||
'batchjob_fields' => ['status'],
|
||||
'batchjob_buttions' => [
|
||||
'batchjob' => '일괄 처리',
|
||||
'batchjob_delete' => '일괄 삭제',
|
||||
]
|
||||
];
|
||||
}
|
||||
public function getBatchjobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
//기본 기능부분
|
||||
|
||||
public function create(array $formDatas): UserEntity
|
||||
|
||||
Loading…
Reference in New Issue
Block a user