dbmsv4 init...2
This commit is contained in:
parent
6b40f17e1d
commit
2868dd5d2a
@ -61,7 +61,7 @@ class ServerCell extends EquipmentCell
|
||||
{
|
||||
$this->getService()->action_init_process(__FUNCTION__);
|
||||
if (!array_key_exists('serviceEntity', $params)) {
|
||||
return __METHOD__ . "에서 오류발생: 서비스 정보가 정의되지 않았습니다.";
|
||||
return static::class . '->' . __FUNCTION__ . "에서 오류발생: 서비스 정보가 정의되지 않았습니다.";
|
||||
}
|
||||
$serviceEntity = $params['serviceEntity'];
|
||||
$entities = $this->getService()->getEntities(['serviceinfo_uid' => $params['serviceEntity']->getPK()]);
|
||||
|
||||
@ -64,7 +64,7 @@ abstract class AbstractCRUDController extends AbstractWebController
|
||||
// 💡 동적으로 가져온 Entity 클래스 이름으로 instanceof 검사
|
||||
$entityClass = $this->service->getEntityClass();
|
||||
if (!$entity instanceof $entityClass) {
|
||||
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 {$entityClass}만 가능");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:Return Type은 {$entityClass}만 가능");
|
||||
}
|
||||
return $this->create_result_process($entity);
|
||||
} catch (\Throwable $e) {
|
||||
@ -87,7 +87,7 @@ abstract class AbstractCRUDController extends AbstractWebController
|
||||
{
|
||||
try {
|
||||
if (!$uid) {
|
||||
throw new \Exception("{$this->getTitle()}에 번호가 정의 되지 않았습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()}에 번호가 정의 되지 않았습니다.");
|
||||
}
|
||||
$entity = $this->modify_form_process($uid);
|
||||
$this->addViewDatas('entity', $entity);
|
||||
@ -118,7 +118,7 @@ abstract class AbstractCRUDController extends AbstractWebController
|
||||
{
|
||||
try {
|
||||
if (!$uid) {
|
||||
throw new \Exception("{$this->getTitle()}에 번호가 정의 되지 않았습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()}에 번호가 정의 되지 않았습니다.");
|
||||
}
|
||||
$action = __FUNCTION__;
|
||||
$this->action_init_process($action);
|
||||
@ -143,7 +143,7 @@ abstract class AbstractCRUDController extends AbstractWebController
|
||||
{
|
||||
try {
|
||||
if (!$uid) {
|
||||
throw new \Exception("{$this->getTitle()}에 번호가 정의 되지 않았습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()}에 번호가 정의 되지 않았습니다.");
|
||||
}
|
||||
$entity = $this->service->getEntity($uid);
|
||||
//Delete처리
|
||||
@ -167,7 +167,7 @@ abstract class AbstractCRUDController extends AbstractWebController
|
||||
{
|
||||
try {
|
||||
if (!$uid) {
|
||||
throw new \Exception("{$this->getTitle()}에 번호가 정의 되지 않았습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()}에 번호가 정의 되지 않았습니다.");
|
||||
}
|
||||
//View처리
|
||||
$entity = $this->view_process($uid);
|
||||
|
||||
@ -7,6 +7,7 @@ use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use RuntimeException;
|
||||
|
||||
class ClientController extends CustomerController
|
||||
{
|
||||
@ -31,7 +32,7 @@ class ClientController extends CustomerController
|
||||
//일괄작업용 Fields정의
|
||||
$entity = $this->service->getEntity($uid);
|
||||
if (!$entity instanceof ClientEntity) {
|
||||
throw new \Exception("{$uid}에 해당하는 고객정보를 찾을수 없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$uid}에 해당하는 고객정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->addViewDatas('totalCounts', service('equipment_serverservice')->getTotalServiceCount(['serviceinfo.clientinfo_uid' => $entity->getPK()]));
|
||||
$this->addViewDatas('totalAmounts', service('customer_serviceservice')->getTotalAmounts([
|
||||
|
||||
@ -7,6 +7,7 @@ use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use RuntimeException;
|
||||
|
||||
class ServiceController extends CustomerController
|
||||
{
|
||||
@ -96,7 +97,7 @@ class ServiceController extends CustomerController
|
||||
//서버 타이틀을 서비스 타이틀로 변경하기 위함
|
||||
$serverEntity = service('equipment_serverservice')->getEntity($formDatas['serverinfo_uid']);
|
||||
if (!$serverEntity instanceof ServerEntity) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: 해당하는 서버정보을 찾을수 없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: 해당하는 서버정보을 찾을수 없습니다.");
|
||||
}
|
||||
$formDatas['title'] = $serverEntity->getCustomTitle();
|
||||
//대체서버를 메인서버로 설정
|
||||
|
||||
@ -5,6 +5,7 @@ namespace App\Controllers\Admin\Equipment;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use RuntimeException;
|
||||
|
||||
class ServerPartController extends EquipmentController
|
||||
{
|
||||
@ -22,8 +23,8 @@ class ServerPartController extends EquipmentController
|
||||
{
|
||||
// Form Default값 설정 (오버라이드 포인트)
|
||||
$formDatas = parent::create_form_process($formDatas);
|
||||
$formDatas['serverinfo_uid'] = $this->request->getVar('serverinfo_uid') ?? throw new \Exception("ServerPart는 반드시 서버정보가 필요합니다.");
|
||||
$formDatas['type'] = $this->request->getVar('type') ?? throw new \Exception("ServerPart는 반드시 파트형식 필요합니다.");
|
||||
$formDatas['serverinfo_uid'] = $this->request->getVar('serverinfo_uid') ?? throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 ServerPart는 반드시 서버정보가 필요합니다.");
|
||||
$formDatas['type'] = $this->request->getVar('type') ?? throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 ServerPart는 반드시 파트형식 필요합니다.");
|
||||
$formDatas['cnt'] = 1;
|
||||
//type : CS,IP이면 월비용 기본처리
|
||||
switch ($formDatas['type']) {
|
||||
|
||||
@ -9,6 +9,7 @@ use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use RuntimeException;
|
||||
|
||||
class PaymentController extends AdminController
|
||||
{
|
||||
@ -39,7 +40,7 @@ class PaymentController extends AdminController
|
||||
$postDatas = $this->request->getPost();
|
||||
$uids = $postDatas['batchjob_uids'] ?? [];
|
||||
if (empty($uids)) {
|
||||
throw new \Exception("청구서에 적용될 리스트를 선택하셔야합니다");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 청구서에 적용될 리스트를 선택하셔야합니다");
|
||||
}
|
||||
return $uids;
|
||||
}
|
||||
@ -61,7 +62,7 @@ class PaymentController extends AdminController
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->service->getEntity($uid);
|
||||
if (!$entity instanceof PaymentEntity) {
|
||||
throw new \Exception(__METHOD__ . "에서 {$uid}에 대한 결제정보를 찾을수 없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$uid}에 대한 결제정보를 찾을수 없습니다.");
|
||||
}
|
||||
//지급기한일이 오늘보다 작거나 같고 미지급인경우
|
||||
if ($entity->getBillingAt() <= date("Y-m-d") && $entity->getStatus() === STATUS['UNPAID']) {
|
||||
@ -71,7 +72,7 @@ class PaymentController extends AdminController
|
||||
} else {
|
||||
$clientEntity = service('customer_clientservice')->getEntity($entity->getClientInfoUID());
|
||||
if (!$clientEntity instanceof ClientEntity) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생:{$entity->getClientInfoUID()}에 대한 고객정보를 찾을수 없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:{$entity->getClientInfoUID()}에 대한 고객정보를 찾을수 없습니다.");
|
||||
}
|
||||
$clientEntities[$entity->getClientInfoUID()] = $clientEntity;
|
||||
}
|
||||
@ -81,7 +82,7 @@ class PaymentController extends AdminController
|
||||
} else {
|
||||
$serviceEntity = service('customer_serviceservice')->getEntity($entity->getServiceInfoUid());
|
||||
if (!$serviceEntity instanceof ServiceEntity) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생:{$entity->getServiceInfoUid()}에 대한 서비스정보를 찾을수 없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:{$entity->getServiceInfoUid()}에 대한 서비스정보를 찾을수 없습니다.");
|
||||
}
|
||||
$serviceEntities[$entity->getServiceInfoUid()] = $serviceEntity;
|
||||
}
|
||||
@ -100,12 +101,9 @@ class PaymentController extends AdminController
|
||||
{
|
||||
try {
|
||||
$entity = $this->service->paid($uid);
|
||||
$action = __FUNCTION__;
|
||||
//FormService에서 필요한 기존 데이터를 $entity에서 추출해서 넘김
|
||||
$this->action_init_process($action, $entity->toArray());
|
||||
return $this->modify_form_result_process($action);
|
||||
return $this->action_redirect_process('info', "{$this->getTitle()}에서 {$entity->getTitle()} 결체처리가 완료되었습니다.");
|
||||
} catch (\Throwable $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 수정폼 오류:" . $e->getMessage());
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 결제 오류:" . $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@ use App\Entities\Customer\ServiceEntity;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use RuntimeException;
|
||||
|
||||
class SearchController extends AdminController
|
||||
{
|
||||
@ -24,7 +25,7 @@ class SearchController extends AdminController
|
||||
{
|
||||
$keyword = $this->request->getGet('keyword'); // 검색어
|
||||
if (!$keyword) {
|
||||
throw new \Exception("[{$keyword}] 검색어가 지정되지 않았습니다. ");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 [{$keyword}] 검색어가 지정되지 않았습니다. ");
|
||||
}
|
||||
//검색어에 따른 서버정보를 검색 후 해당하는 서비스리스트를 가져온다.
|
||||
$rows = service('equipment_serverservice')->getSearchServices($keyword);
|
||||
|
||||
@ -7,6 +7,7 @@ use CodeIgniter\HTTP\RedirectResponse;
|
||||
use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||
use PhpOffice\PhpSpreadsheet\Reader\Html;
|
||||
use PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf;
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* CommonController
|
||||
@ -22,13 +23,13 @@ abstract class CommonController extends AbstractCRUDController
|
||||
// 1. postDatas에서 선택된 uids 정보 추출
|
||||
$uids = $postDatas['batchjob_uids'] ?? [];
|
||||
if (empty($uids)) {
|
||||
throw new \Exception("적용할 리스트을 선택하셔야합니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 적용할 리스트을 선택하셔야합니다.");
|
||||
}
|
||||
// 2. 변경할 데이터 추출 및 정리
|
||||
unset($postDatas['batchjob_uids'], $postDatas['batchjob_submit']); //formDatas에 포함되지 않게하기위함
|
||||
$formDatas = array_filter($postDatas, fn($value) => $value !== "" && $value !== null);
|
||||
if (empty($formDatas)) {
|
||||
throw new \Exception("변경할 조건항목을 선택하셔야합니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 변경할 조건항목을 선택하셔야합니다.");
|
||||
}
|
||||
// 3. 데이터가 있는 필드 추출
|
||||
$selectedFields = array_keys($formDatas);
|
||||
@ -73,7 +74,7 @@ abstract class CommonController extends AbstractCRUDController
|
||||
$postDatas = $this->request->getPost();
|
||||
$uids = $postDatas['batchjob_uids'] ?? [];
|
||||
if (empty($uids)) {
|
||||
throw new \Exception("삭제할 리스트을 선택하셔야합니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 삭제할 리스트을 선택하셔야합니다.");
|
||||
}
|
||||
return $uids;
|
||||
}
|
||||
@ -244,7 +245,7 @@ abstract class CommonController extends AbstractCRUDController
|
||||
$writer->save($full_path . DIRECTORY_SEPARATOR . $file_name);
|
||||
break;
|
||||
default:
|
||||
throw new \Exception("지원하지 않는 다운로드 타입입니다: {$document_type}");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 지원하지 않는 다운로드 타입입니다: {$document_type}");
|
||||
}
|
||||
return array($full_path, $file_name);
|
||||
}
|
||||
@ -273,11 +274,11 @@ abstract class CommonController extends AbstractCRUDController
|
||||
default:
|
||||
// 개별 파일 다운로드 로직
|
||||
if (!$uid) {
|
||||
throw new \Exception("{$output_type}은 반드시 uid의 값이 필요합니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$output_type}은 반드시 uid의 값이 필요합니다.");
|
||||
}
|
||||
$entity = $this->service->getEntity($uid);
|
||||
if (!$entity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->addViewDatas('entity', $entity);
|
||||
list($file_name, $uploaded_filename) = $entity->getDownlaodFile();
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -24,7 +24,7 @@ abstract class CommonForm
|
||||
final public function getAttribute(string $key): string
|
||||
{
|
||||
if (!array_key_exists($key, $this->_attributes)) {
|
||||
throw new RuntimeException(__METHOD__ . "에서 오류발생: {$key}에 해당하는 속성이 정의되지 않았습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$key}에 해당하는 속성이 정의되지 않았습니다.");
|
||||
}
|
||||
return $this->_attributes[$key];
|
||||
}
|
||||
@ -130,7 +130,9 @@ abstract class CommonForm
|
||||
$validation = service('validation');
|
||||
$dynamicRules = [];
|
||||
$dynamicLabels = []; // 레이블 배열 추가
|
||||
|
||||
if (!count($this->getFormRules())) {
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: 지정된 Form RULE이 없습니다.");
|
||||
}
|
||||
foreach ($this->getFormRules() as $field => $rule) {
|
||||
list($field, $rule) = $this->getValidationRule($field, $rule);
|
||||
$dynamicRules[$field] = $rule; // 규칙만 저장
|
||||
@ -144,8 +146,9 @@ abstract class CommonForm
|
||||
// run()에는 데이터만 전달 (setRules에서 이미 설정됨)
|
||||
$result = $validation->run($formDatas);
|
||||
if ($result === false) {
|
||||
// run()이 false를 반환했다면, 이 시점에서 getErrors()에는 메시지가 있어야 합니다.
|
||||
log_message('debug', 'Validate Run Failed. Errors: ' . var_export($validation->getErrors(), true));
|
||||
$message = __METHOD__ . "에서 데이터 검증 오류발생: " . var_export($validation->getErrors(), true);
|
||||
log_message('debug', $message);
|
||||
throw new RuntimeException($message);
|
||||
} else {
|
||||
log_message('debug', 'Validate Run Succeeded.');
|
||||
}
|
||||
@ -249,7 +252,7 @@ abstract class CommonForm
|
||||
default:
|
||||
$optionDatas = lang($this->getAttribute('class_path') . "." . strtoupper($field));
|
||||
if (!is_array($optionDatas)) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생:{$field}가 배열값이 아닙니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:{$field}가 배열값이 아닙니다.");
|
||||
}
|
||||
foreach ($optionDatas as $key => $label) {
|
||||
$tempOptions[$key] = $label;
|
||||
|
||||
@ -22,7 +22,7 @@ abstract class CommonHelper
|
||||
final public function getAttribute(string $key): string
|
||||
{
|
||||
if (!array_key_exists($key, $this->_attributes)) {
|
||||
throw new RuntimeException(__METHOD__ . "에서 오류발생: {$key}에 해당하는 속성이 정의되지 않았습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$key}에 해당하는 속성이 정의되지 않았습니다.");
|
||||
}
|
||||
return $this->_attributes[$key];
|
||||
}
|
||||
@ -166,7 +166,7 @@ abstract class CommonHelper
|
||||
case 'clientinfo_uid':
|
||||
if (array_key_exists($value, $viewDatas['formOptions'][$field]['options'])) {
|
||||
if (!array_key_exists($value, $viewDatas['formOptions'][$field]['options'])) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: {$field}에서 {$value}에 해당하는 값이 존재하지 않습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$field}에서 {$value}에 해당하는 값이 존재하지 않습니다.");
|
||||
}
|
||||
$value = !$value ? "" : "<a href=\"/admin/customer/client/detail/{$value}\">{$viewDatas['formOptions'][$field]['options'][$value]}</a>";
|
||||
}
|
||||
@ -201,7 +201,7 @@ abstract class CommonHelper
|
||||
if (in_array($field, $viewDatas['formFilters'])) {
|
||||
if ($value) {
|
||||
if (!array_key_exists($value, $viewDatas['formOptions'][$field]['options'])) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: {$field}에서 {$value}에 해당하는 값이 존재하지 않습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$field}에서 {$value}에 해당하는 값이 존재하지 않습니다.");
|
||||
}
|
||||
$value = $viewDatas['formOptions'][$field]['options'][$value];
|
||||
}
|
||||
|
||||
@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Helpers\Equipment;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
class ServerHelper extends EquipmentHelper
|
||||
{
|
||||
public function __construct()
|
||||
@ -42,7 +44,7 @@ class ServerHelper extends EquipmentHelper
|
||||
switch ($field) {
|
||||
case 'chassisinfo_uid':
|
||||
if (!array_key_exists($value, $viewDatas['formOptions'][$field]['options'])) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: {$field}에서 {$value}에 해당하는 값이 존재하지 않습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$field}에서 {$value}에 해당하는 값이 존재하지 않습니다.");
|
||||
}
|
||||
$value = $viewDatas['formOptions'][$field]['options'][$value]['text'];
|
||||
break;
|
||||
|
||||
@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Helpers\Equipment;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
class ServerPartHelper extends EquipmentHelper
|
||||
{
|
||||
public function __construct()
|
||||
@ -39,7 +41,7 @@ class ServerPartHelper extends EquipmentHelper
|
||||
switch ($field) {
|
||||
case 'part_uid':
|
||||
if (!array_key_exists($value, $viewDatas['formOptions'][$field]['options'][$viewDatas['entity']->getType()])) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: {$field}에서 {$value}에 해당하는 값이 존재하지 않습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$field}에서 {$value}에 해당하는 값이 존재하지 않습니다.");
|
||||
}
|
||||
$value = $viewDatas['formOptions'][$field]['options'][$viewDatas['entity']->getType()][$value];
|
||||
break;
|
||||
|
||||
@ -105,7 +105,7 @@ class CURL extends GoogleSocket
|
||||
$this->getSession()->set($this->_token_name, $this->_access_token);
|
||||
}
|
||||
|
||||
// throw new \Exception(__METHOD__ . "에서 데이터 처리 필요");
|
||||
// throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 데이터 처리 필요");
|
||||
// DEBUG - 2023-07-13 12:54:51 --> \Google\Service\Oauth2\Userinfo::__set_state(array(
|
||||
// 'internal_gapi_mappings' =>
|
||||
// 'familyName' => 'family_name',
|
||||
|
||||
@ -2,8 +2,9 @@
|
||||
|
||||
namespace App\Libraries\MySocket;
|
||||
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use GuzzleHttp\Client;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use RuntimeException;
|
||||
|
||||
class WebSocket extends MySocket
|
||||
{
|
||||
@ -33,9 +34,7 @@ class WebSocket extends MySocket
|
||||
{
|
||||
$response = $this->get($this->getURL($uri), $options);
|
||||
if ($response->getStatusCode() != 200) {
|
||||
throw new \Exception("error", __FUNCTION__ .
|
||||
"=> {$uri} 접속실패: " .
|
||||
$response->getStatusCode());
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 error {$uri} 접속실패: " . $response->getStatusCode());
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ namespace App\Libraries;
|
||||
|
||||
use App\Libraries\OperationContext;
|
||||
use App\Services\MylogService;
|
||||
use RuntimeException;
|
||||
|
||||
class PipelineStep
|
||||
{
|
||||
@ -31,7 +32,7 @@ class PipelineStep
|
||||
// 2. 단계(Steps) 순차 실행
|
||||
foreach ($steps as $step) {
|
||||
if (!($step instanceof PipelineStepInterface)) {
|
||||
throw new \Exception("파이프라인 단계는 PipelineStep 인터페이스를 구현해야 합니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 파이프라인 단계는 PipelineStep 인터페이스를 구현해야 합니다.");
|
||||
}
|
||||
$context = $step->handle($context);
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@ use App\Entities\UserEntity;
|
||||
use App\Forms\Auth\LocalForm;
|
||||
use App\Models\UserModel;
|
||||
use CodeIgniter\Validation\Exceptions\ValidationException;
|
||||
use RuntimeException;
|
||||
|
||||
class LocalService extends AuthService
|
||||
{
|
||||
@ -66,10 +67,10 @@ class LocalService extends AuthService
|
||||
//로그인 정보확인
|
||||
$entity = $this->getEntity(['id' => $formDatas['id'], 'status' => 'AVAILABLE']);
|
||||
if (!$entity instanceof UserEntity) {
|
||||
throw new \Exception("{$formDatas['id']}에 대한 로그인 정보를 찾을수 없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$formDatas['id']}에 대한 로그인 정보를 찾을수 없습니다.");
|
||||
}
|
||||
if (!password_verify($formDatas['passwd'], $entity->getPassword())) {
|
||||
throw new \Exception("암호가 맞지 않습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 암호가 맞지 않습니다.");
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ abstract class CommonService
|
||||
// 💡 동적으로 가져온 Entity 클래스 이름으로 instanceof 검사
|
||||
$entityClass = $this->getEntityClass();
|
||||
if (!$entity instanceof $entityClass) {
|
||||
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 {$entityClass}만 가능:\n" . var_export($entity, true));
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:Return Type은 {$entityClass}만 가능:\n" . var_export($entity, true));
|
||||
}
|
||||
return $this->getEntity_process($entity);
|
||||
} catch (DatabaseException $e) {
|
||||
@ -130,7 +130,7 @@ abstract class CommonService
|
||||
if ($result === false) {
|
||||
$errors = $this->model->errors();
|
||||
$errorMsg = is_array($errors) ? implode(", ", $errors) : "DB 저장 작업이 실패했습니다.";
|
||||
throw new RuntimeException(__METHOD__ . "에서 오류발생: " . $errorMsg);
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: " . $errorMsg);
|
||||
}
|
||||
$pk = $uid; // 기본적으로 기존 $uid (업데이트의 경우)
|
||||
// AUTO_INCREMENT 필드를 사용하는 경우, INSERT 작업이라면 새로 생성된 ID를 가져옵니다.
|
||||
@ -149,7 +149,7 @@ abstract class CommonService
|
||||
if (empty($pk)) {
|
||||
$errors = $this->model->errors();
|
||||
$errorMsg = is_array($errors) && !empty($errors) ? implode(", ", $errors) : "DB 작업 성공 후 PK를 확인할 수 없거나 모델 오류 발생:{$pk}";
|
||||
throw new RuntimeException(__METHOD__ . "에서 오류발생: " . $errorMsg);
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: " . $errorMsg);
|
||||
}
|
||||
return $pk;
|
||||
}
|
||||
@ -182,7 +182,7 @@ abstract class CommonService
|
||||
$entityClass = $this->getEntityClass();
|
||||
$entity = new $entityClass($formDatas);
|
||||
if (!$entity instanceof $entityClass) {
|
||||
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 {$entityClass}만 가능");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:Return Type은 {$entityClass}만 가능");
|
||||
}
|
||||
$entity = $this->save_process($entity);
|
||||
if ($entity instanceof PaymentEntity) {
|
||||
@ -199,7 +199,7 @@ abstract class CommonService
|
||||
//DTO 타입 체크 로직을 일반화
|
||||
$dtoClass = $this->getDTOClass();
|
||||
if (!$dto instanceof $dtoClass) {
|
||||
throw new RuntimeException(__METHOD__ . "에서 오류발생: " . get_class($dto) . "는 사용할 수 없습니다. ({$dtoClass} 필요)");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: " . get_class($dto) . "는 사용할 수 없습니다. ({$dtoClass} 필요)");
|
||||
}
|
||||
$entity = $this->create_process($dto->toArray());
|
||||
$db->transComplete();
|
||||
@ -253,16 +253,16 @@ abstract class CommonService
|
||||
//DTO 타입 체크 로직을 일반화
|
||||
$dtoClass = $this->getDTOClass();
|
||||
if (!$dto instanceof $dtoClass) {
|
||||
throw new RuntimeException(__METHOD__ . "에서 오류발생: " . get_class($dto) . "는 사용할 수 없습니다. ({$dtoClass} 필요)");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: " . get_class($dto) . "는 사용할 수 없습니다. ({$dtoClass} 필요)");
|
||||
}
|
||||
$entity = $this->getEntity($uid);
|
||||
if (!$entity) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: {$uid}에 해당하는 정보을 찾을수 없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$uid}에 해당하는 정보을 찾을수 없습니다.");
|
||||
}
|
||||
// 💡 동적으로 가져온 Entity 클래스 이름으로 instanceof 검사
|
||||
$entityClass = $this->getEntityClass();
|
||||
if (!$entity instanceof $entityClass) {
|
||||
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 {$entityClass}만 가능");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:Return Type은 {$entityClass}만 가능");
|
||||
}
|
||||
$entity = $this->modify_process($entity, $dto->toArray());
|
||||
// 트랜잭션 완료 및 커밋
|
||||
@ -297,19 +297,19 @@ abstract class CommonService
|
||||
//DTO 타입 체크 로직을 일반화
|
||||
$dtoClass = $this->getDTOClass();
|
||||
if (!$dto instanceof $dtoClass) {
|
||||
throw new RuntimeException(__METHOD__ . "에서 오류발생: " . get_class($dto) . "는 사용할 수 없습니다. ({$dtoClass} 필요)");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: " . get_class($dto) . "는 사용할 수 없습니다. ({$dtoClass} 필요)");
|
||||
}
|
||||
//일괄작업처리
|
||||
$entities = [];
|
||||
foreach ($uids as $uid) {
|
||||
$entity = $this->getEntity($uid);
|
||||
if (!$entity) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: {$uid}에 해당하는 정보을 찾을수 없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$uid}에 해당하는 정보을 찾을수 없습니다.");
|
||||
}
|
||||
// 💡 동적으로 가져온 Entity 클래스 이름으로 instanceof 검사
|
||||
$entityClass = $this->getEntityClass();
|
||||
if (!$entity instanceof $entityClass) {
|
||||
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 {$entityClass}만 가능");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:Return Type은 {$entityClass}만 가능");
|
||||
}
|
||||
$entities[] = $this->batchjob_process($entity, $dto->toArray());
|
||||
}
|
||||
@ -339,7 +339,7 @@ abstract class CommonService
|
||||
if ($result === false) {
|
||||
$errors = $this->model->errors();
|
||||
$errorMsg = is_array($errors) ? implode(", ", $errors) : "삭제 작업이 실패했습니다.";
|
||||
throw new RuntimeException(__METHOD__ . "에서 오류발생: " . $errorMsg);
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: " . $errorMsg);
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
@ -348,16 +348,16 @@ abstract class CommonService
|
||||
$db = \Config\Database::connect();
|
||||
try {
|
||||
if (!$uid) {
|
||||
throw new \Exception("삭제에 필요한 PrimaryKey 가 정의 되지 않았습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 삭제에 필요한 PrimaryKey 가 정의 되지 않았습니다.");
|
||||
}
|
||||
$entity = $this->getEntity($uid);
|
||||
if (!$entity) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: {$uid}에 해당하는 정보을 찾을수 없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$uid}에 해당하는 정보을 찾을수 없습니다.");
|
||||
}
|
||||
// 💡 동적으로 가져온 Entity 클래스 이름으로 instanceof 검사
|
||||
$entityClass = $this->getEntityClass();
|
||||
if (!$entity instanceof $entityClass) {
|
||||
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 {$entityClass}만 가능");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:Return Type은 {$entityClass}만 가능");
|
||||
}
|
||||
$db->transException(true)->transStart();
|
||||
$entity = $this->delete_process($entity);
|
||||
@ -396,12 +396,12 @@ abstract class CommonService
|
||||
foreach ($uids as $uid) {
|
||||
$entity = $this->getEntity($uid);
|
||||
if (!$entity) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: {$uid}에 해당하는 정보을 찾을수 없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$uid}에 해당하는 정보을 찾을수 없습니다.");
|
||||
}
|
||||
// 💡 동적으로 가져온 Entity 클래스 이름으로 instanceof 검사
|
||||
$entityClass = $this->getEntityClass();
|
||||
if (!$entity instanceof $entityClass) {
|
||||
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 {$entityClass}만 가능");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:Return Type은 {$entityClass}만 가능");
|
||||
}
|
||||
$entities[] = $this->batchjob_delete_process($entity);
|
||||
}
|
||||
|
||||
@ -114,7 +114,7 @@ class ClientService extends CustomerService
|
||||
{
|
||||
$entity = is_int($uid) ? $this->getEntity($uid) : $uid;
|
||||
if (!$entity instanceof ClientEntity) {
|
||||
throw new RuntimeException(__METHOD__ . "에서 오류발생: {$uid}에 해당하는 서비스정보를 찾을수 없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$uid}에 해당하는 서비스정보를 찾을수 없습니다.");
|
||||
}
|
||||
|
||||
$calculatedValue = null;
|
||||
@ -152,7 +152,7 @@ class ClientService extends CustomerService
|
||||
$calculatedValue = $balance - $value;
|
||||
}
|
||||
if (!is_int($calculatedValue) || $calculatedValue < 0) {
|
||||
throw new RuntimeException(__METHOD__ . "에서 {$title}의 계산결과 값이 NULL이거나 0보다 작은 값입니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$title}의 계산결과 값이 NULL이거나 0보다 작은 값입니다.");
|
||||
}
|
||||
//balance 수정
|
||||
$formDatas = ["{$key}_balance" => $calculatedValue, 'status' => $status];
|
||||
|
||||
@ -180,7 +180,7 @@ class ServiceService extends CustomerService
|
||||
{
|
||||
$entity = is_int($uid) ? $this->getEntity($uid) : $uid;
|
||||
if (!$entity instanceof ServiceEntity) {
|
||||
throw new RuntimeException(__METHOD__ . "에서 오류발생: {$uid}에 해당하는 서비스정보를 찾을수 없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$uid}에 해당하는 서비스정보를 찾을수 없습니다.");
|
||||
}
|
||||
//총 서비스금액 설정
|
||||
$formDatas = ['billing_at' => $billing_at];
|
||||
@ -194,7 +194,7 @@ class ServiceService extends CustomerService
|
||||
{
|
||||
$entity = is_int($uid) ? $this->getEntity($uid) : $uid;
|
||||
if (!$entity instanceof ServiceEntity) {
|
||||
throw new RuntimeException(__METHOD__ . "에서 오류발생: {$uid}에 해당하는 서비스정보를 찾을수 없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$uid}에 해당하는 서비스정보를 찾을수 없습니다.");
|
||||
}
|
||||
//총 서비스금액 구하기
|
||||
$server_amount = service('equipment_serverservice')->getCalculatedAmount($entity->getServerInfoUID());
|
||||
@ -224,7 +224,7 @@ class ServiceService extends CustomerService
|
||||
//서비스 생성
|
||||
$entity = parent::create_process($formDatas);
|
||||
if (!$entity instanceof ServiceEntity) {
|
||||
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 ServiceEntity만 가능");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:Return Type은 ServiceEntity만 가능");
|
||||
}
|
||||
//서버정보 연결
|
||||
service('equipment_serverservice')->attachToService($entity, $entity->getServerInfoUID());
|
||||
@ -245,7 +245,7 @@ class ServiceService extends CustomerService
|
||||
//서비스 수정
|
||||
$entity = parent::modify_process($entity, $formDatas);
|
||||
if (!$entity instanceof ServiceEntity) {
|
||||
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 ServiceEntity만 가능");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:Return Type은 ServiceEntity만 가능");
|
||||
}
|
||||
//서버정보 연결 신규서버로 변경되었으면 신규서버 추가
|
||||
if ($oldEntity->getServerInfoUID() !== $entity->getServerInfoUID()) {
|
||||
|
||||
@ -3,11 +3,12 @@
|
||||
namespace App\Services\Equipment;
|
||||
|
||||
use App\DTOs\Equipment\CHASSISDTO;
|
||||
use App\Entities\Equipment\ServerEntity;
|
||||
use App\Entities\Equipment\CHASSISEntity;
|
||||
use App\Entities\Equipment\ServerEntity;
|
||||
use App\Forms\Equipment\CHASSISForm;
|
||||
use App\Helpers\Equipment\CHASSISHelper;
|
||||
use App\Models\Equipment\CHASSISModel;
|
||||
use RuntimeException;
|
||||
|
||||
class CHASSISService extends EquipmentService
|
||||
{
|
||||
@ -121,7 +122,7 @@ class CHASSISService extends EquipmentService
|
||||
//IP정보에서 해당하는 IP가 있으면 가져와서 사용중인지 체크 후 수정
|
||||
$entity = $this->getEntity($serverEntity->getChassisInfoUID());
|
||||
if (!$entity instanceof CHASSISEntity) {
|
||||
throw new \Exception("{$serverEntity->getChassisInfoUID()}에 해당하는 샷시정보를 찾을수없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$serverEntity->getChassisInfoUID()}에 해당하는 샷시정보를 찾을수없습니다.");
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
@ -132,7 +133,7 @@ class CHASSISService extends EquipmentService
|
||||
$entity = $this->getEntity($serverEntity->getChassisInfoUID());
|
||||
//파트정보의 사용가능한 갯수 , 사용갯수 비교
|
||||
if ($entity->getAvailable() < 1) {
|
||||
throw new \Exception("현재 사용가능한 {$serverEntity->getTitle()} 샷시가 없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 현재 사용가능한 {$serverEntity->getTitle()} 샷시가 없습니다.");
|
||||
}
|
||||
$formDatas['used'] = $entity->getUsed() + 1;
|
||||
return parent::modify_process($entity, $formDatas);
|
||||
@ -145,7 +146,7 @@ class CHASSISService extends EquipmentService
|
||||
$entity = $this->getEntity($serverEntity->getChassisInfoUID());
|
||||
//파트정보의 사용된 갯수 , 회수용 갯수 비교
|
||||
if ($entity->getUsed() < 1) {
|
||||
throw new \Exception("현재 사용한 {$serverEntity->getTitle()} 샷시가 없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 현재 사용한 {$serverEntity->getTitle()} 샷시가 없습니다.");
|
||||
}
|
||||
$formDatas['used'] = $entity->getUsed() - 1;
|
||||
return parent::modify_process($entity, $formDatas);
|
||||
|
||||
@ -118,7 +118,7 @@ class ServerPartService extends EquipmentService
|
||||
protected function create_process(array $formDatas): ServerPartEntity
|
||||
{
|
||||
if (!array_key_exists('type', $formDatas)) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생:부품형식이 지정되지 않았습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:부품형식이 지정되지 않았습니다.");
|
||||
}
|
||||
//각 파트정보 가져오기
|
||||
$partEntity = $this->getPartService($formDatas['type'])->getEntity($formDatas['part_uid']);
|
||||
@ -127,7 +127,7 @@ class ServerPartService extends EquipmentService
|
||||
//서버파트 생성
|
||||
$entity = parent::create_process($formDatas);
|
||||
if (!$entity instanceof ServerPartEntity) {
|
||||
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 ServerPartEntity만 가능");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:Return Type은 ServerPartEntity만 가능");
|
||||
}
|
||||
//해당 파트별 설정 수정
|
||||
$this->getPartService($entity->getType())->attachToServerPart($entity);
|
||||
@ -144,7 +144,7 @@ class ServerPartService extends EquipmentService
|
||||
protected function modify_process($entity, array $formDatas): ServerPartEntity
|
||||
{
|
||||
if (!array_key_exists('type', $formDatas)) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생:부품형식이 지정되지 않았습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:부품형식이 지정되지 않았습니다.");
|
||||
}
|
||||
//각 파트정보 가져오기
|
||||
$partEntity = $this->getPartService($formDatas['type'])->getEntity($formDatas['part_uid']);
|
||||
@ -182,7 +182,7 @@ class ServerPartService extends EquipmentService
|
||||
//해당 파트정보 가져오기
|
||||
$partEntity = $this->getPartService($parttype)->getEntity($part['UID']);
|
||||
if (!$partEntity instanceof PartEntity) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: {$part['UID']} 파트정보를 찾을수 없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$part['UID']} 파트정보를 찾을수 없습니다.");
|
||||
}
|
||||
//서버파트정보 생성
|
||||
$formDatas = [];
|
||||
|
||||
@ -192,7 +192,7 @@ class ServerService extends EquipmentService
|
||||
{
|
||||
$entity = $this->getEntity($uid);
|
||||
if (!$entity instanceof ServerEntity) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: {$uid} 서버 정보를 찾을수 없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$uid} 서버 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$serverPartService = service('equipment_serverpartservice');
|
||||
$caculatedAmount = $entity->getPrice();
|
||||
@ -211,7 +211,7 @@ class ServerService extends EquipmentService
|
||||
{
|
||||
$entity = parent::create_process($formDatas);
|
||||
if (!$entity instanceof ServerEntity) {
|
||||
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 ServerEntity만 가능");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:Return Type은 ServerEntity만 가능");
|
||||
}
|
||||
//서버추가시 서버파트 자동추가용
|
||||
service('part_ipservice')->attachToServer($entity);
|
||||
@ -230,7 +230,7 @@ class ServerService extends EquipmentService
|
||||
$oldEntity = clone $entity;
|
||||
$entity = parent::modify_process($entity, $formDatas);
|
||||
if (!$entity instanceof ServerEntity) {
|
||||
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 ServerEntity만 가능");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:Return Type은 ServerEntity만 가능");
|
||||
}
|
||||
//서버정보변경시 서버파트 정보변경용
|
||||
//IP변경
|
||||
@ -269,7 +269,7 @@ class ServerService extends EquipmentService
|
||||
{
|
||||
$entity = $this->getEntity($uid);
|
||||
if (!$entity instanceof ServerEntity) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: 해당하는 서버정보을 찾을수 없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: 해당하는 서버정보을 찾을수 없습니다.");
|
||||
}
|
||||
$formDatas['serviceinfo_uid'] = $serviceEntity->getPK();
|
||||
$formDatas["clientinfo_uid"] = $serviceEntity->getClientInfoUID();
|
||||
@ -283,7 +283,7 @@ class ServerService extends EquipmentService
|
||||
{
|
||||
$entity = $this->getEntity($uid);
|
||||
if (!$entity instanceof ServerEntity) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: 해당하는 서버정보을 찾을수 없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: 해당하는 서버정보을 찾을수 없습니다.");
|
||||
}
|
||||
$formDatas['serviceinfo_uid'] = NULL;
|
||||
$formDatas["clientinfo_uid"] = NULL;
|
||||
|
||||
@ -2,12 +2,13 @@
|
||||
|
||||
namespace App\Services\Part;
|
||||
|
||||
use App\Models\Part\CPUModel;
|
||||
use App\Helpers\Part\CPUHelper;
|
||||
use App\Forms\Part\CPUForm;
|
||||
use App\Entities\Part\CPUEntity;
|
||||
use App\Entities\Equipment\ServerPartEntity;
|
||||
use App\DTOs\Part\CPUDTO;
|
||||
use App\Entities\Equipment\ServerPartEntity;
|
||||
use App\Entities\Part\CPUEntity;
|
||||
use App\Forms\Part\CPUForm;
|
||||
use App\Helpers\Part\CPUHelper;
|
||||
use App\Models\Part\CPUModel;
|
||||
use RuntimeException;
|
||||
|
||||
class CPUService extends PartType1Service
|
||||
{
|
||||
@ -121,7 +122,7 @@ class CPUService extends PartType1Service
|
||||
//IP정보에서 해당하는 IP가 있으면 가져와서 사용중인지 체크 후 수정
|
||||
$entity = $this->getEntity($serverPartEntity->getPartUID());
|
||||
if (!$entity instanceof CPUEntity) {
|
||||
throw new \Exception(message: "{$serverPartEntity->getPartUID()}에 해당하는 CPUEntity정보를 찾을수없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$serverPartEntity->getPartUID()}에 해당하는 CPUEntity정보를 찾을수없습니다.");
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
|
||||
@ -151,7 +151,7 @@ class CSService extends PartType2Service
|
||||
//IP정보에서 해당하는 IP가 있으면 가져와서 사용중인지 체크 후 수정
|
||||
$entity = $this->getEntity($serverPartEntity->getPartUID());
|
||||
if (!$entity instanceof CSEntity) {
|
||||
throw new \Exception(message: "{$serverPartEntity->getPartUID()}에 해당하는 CS정보를 찾을수없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$serverPartEntity->getPartUID()}에 해당하는 CS정보를 찾을수없습니다.");
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
|
||||
@ -126,7 +126,7 @@ class DISKService extends PartType1Service
|
||||
//IP정보에서 해당하는 IP가 있으면 가져와서 사용중인지 체크 후 수정
|
||||
$entity = $this->getEntity($serverPartEntity->getPartUID());
|
||||
if (!$entity instanceof DISKEntity) {
|
||||
throw new \Exception(message: "{$serverPartEntity->getPartUID()}에 해당하는 DISKEntity정보를 찾을수없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$serverPartEntity->getPartUID()}에 해당하는 DISKEntity정보를 찾을수없습니다.");
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
|
||||
@ -2,13 +2,14 @@
|
||||
|
||||
namespace App\Services\Part;
|
||||
|
||||
use App\Models\Part\IPModel;
|
||||
use App\Helpers\Part\IPHelper;
|
||||
use App\Forms\Part\IPForm;
|
||||
use App\Entities\Part\IPEntity;
|
||||
use App\Entities\Equipment\ServerPartEntity;
|
||||
use App\Entities\Equipment\ServerEntity;
|
||||
use App\DTOs\Part\IPDTO;
|
||||
use App\Entities\Equipment\ServerEntity;
|
||||
use App\Entities\Equipment\ServerPartEntity;
|
||||
use App\Entities\Part\IPEntity;
|
||||
use App\Forms\Part\IPForm;
|
||||
use App\Helpers\Part\IPHelper;
|
||||
use App\Models\Part\IPModel;
|
||||
use RuntimeException;
|
||||
|
||||
class IPService extends PartType3Service
|
||||
{
|
||||
@ -141,7 +142,7 @@ class IPService extends PartType3Service
|
||||
//IP정보에서 해당하는 IP가 있으면 가져와서 사용중인지 체크 후 수정
|
||||
$entity = $this->getEntity(['ip' => $serverEntity->getIP()]);
|
||||
if (!$entity instanceof IPEntity) {
|
||||
throw new \Exception("{$serverEntity->getIP()}에 해당하는 IP정보를 찾을수없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$serverEntity->getIP()}에 해당하는 IP정보를 찾을수없습니다.");
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
@ -166,7 +167,7 @@ class IPService extends PartType3Service
|
||||
//IP정보에서 해당하는 IP가 있으면 가져와서 사용중인지 체크 후 수정
|
||||
$entity = $this->getEntity($serverPartEntity->getPartUID());
|
||||
if (!$entity instanceof IPEntity) {
|
||||
throw new \Exception(message: "{$serverPartEntity->getPartUID()}에 해당하는 IP정보를 찾을수없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$serverPartEntity->getPartUID()}에 해당하는 IP정보를 찾을수없습니다.");
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ namespace App\Services\Part;
|
||||
use App\Entities\Equipment\ServerPartEntity;
|
||||
use App\Entities\Part\PartEntity;
|
||||
use App\Models\CommonModel;
|
||||
use RuntimeException;
|
||||
|
||||
|
||||
abstract class PartType1Service extends PartService
|
||||
@ -22,7 +23,7 @@ abstract class PartType1Service extends PartService
|
||||
$entity = $this->getPartEntityByServerPart($serverPartEntity);
|
||||
//파트정보의 사용가능한 갯수 , 사용갯수 비교
|
||||
if ($entity->getAvailable() < $serverPartEntity->getCnt()) {
|
||||
throw new \Exception("현재 사용가능 갯수[{$entity->getAvailable()}]보다 지정하신 갯수({$serverPartEntity->getCnt()})가 더 많습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 현재 사용가능 갯수[{$entity->getAvailable()}]보다 지정하신 갯수({$serverPartEntity->getCnt()})가 더 많습니다.");
|
||||
}
|
||||
$formDatas['used'] = $entity->getUsed() + $serverPartEntity->getCnt();
|
||||
return parent::modify_process($entity, $formDatas);
|
||||
@ -34,7 +35,7 @@ abstract class PartType1Service extends PartService
|
||||
$entity = $this->getPartEntityByServerPart($serverPartEntity);
|
||||
//파트정보의 사용된 갯수 , 회수용 갯수 비교
|
||||
if ($entity->getUsed() < $serverPartEntity->getCnt()) {
|
||||
throw new \Exception("현재 사용된 갯수[{$entity->getUsed()}]보다 지정하신 갯수({$serverPartEntity->getCnt()})가 더 많습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 현재 사용된 갯수[{$entity->getUsed()}]보다 지정하신 갯수({$serverPartEntity->getCnt()})가 더 많습니다.");
|
||||
}
|
||||
$formDatas['used'] = $entity->getUsed() - $serverPartEntity->getCnt();
|
||||
return parent::modify_process($entity, $formDatas);
|
||||
|
||||
@ -123,7 +123,7 @@ class RAMService extends PartType1Service
|
||||
//IP정보에서 해당하는 IP가 있으면 가져와서 사용중인지 체크 후 수정
|
||||
$entity = $this->getEntity($serverPartEntity->getPartUID());
|
||||
if (!$entity instanceof RAMEntity) {
|
||||
throw new \Exception(message: "{$serverPartEntity->getPartUID()}에 해당하는 RAMEntity정보를 찾을수없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$serverPartEntity->getPartUID()}에 해당하는 RAMEntity정보를 찾을수없습니다.");
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
|
||||
@ -123,7 +123,7 @@ class SOFTWAREService extends PartType1Service
|
||||
//IP정보에서 해당하는 IP가 있으면 가져와서 사용중인지 체크 후 수정
|
||||
$entity = $this->getEntity($serverPartEntity->getPartUID());
|
||||
if (!$entity instanceof SOFTWAREEntity) {
|
||||
throw new \Exception(message: "{$serverPartEntity->getPartUID()}에 해당하는 SOFTWAREEntity정보를 찾을수없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$serverPartEntity->getPartUID()}에 해당하는 SOFTWAREEntity정보를 찾을수없습니다.");
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
|
||||
@ -144,7 +144,7 @@ class SWITCHService extends PartType3Service
|
||||
//IP정보에서 해당하는 IP가 있으면 가져와서 사용중인지 체크 후 수정
|
||||
$entity = $this->getEntity($serverEntity->getSwitchInfoUID());
|
||||
if (!$entity instanceof SWITCHEntity) {
|
||||
throw new \Exception("{$serverEntity->getSwitchInfoUID()}에 해당하는 IP정보를 찾을수없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$serverEntity->getSwitchInfoUID()}에 해당하는 IP정보를 찾을수없습니다.");
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
@ -167,7 +167,7 @@ class SWITCHService extends PartType3Service
|
||||
//IP정보에서 해당하는 IP가 있으면 가져와서 사용중인지 체크 후 수정
|
||||
$entity = $this->getEntity($serverPartEntity->getPartUID());
|
||||
if (!$entity instanceof SWITCHEntity) {
|
||||
throw new \Exception(message: "{$serverPartEntity->getPartUID()}에 해당하는 Switch정보를 찾을수없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$serverPartEntity->getPartUID()}에 해당하는 Switch정보를 찾을수없습니다.");
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
|
||||
@ -12,6 +12,7 @@ use App\Entities\PaymentEntity;
|
||||
use App\Forms\PaymentForm;
|
||||
use App\Helpers\PaymentHelper;
|
||||
use App\Models\PaymentModel;
|
||||
use CodeIgniter\Database\Exceptions\DatabaseException;
|
||||
use CodeIgniter\Validation\Exceptions\ValidationException;
|
||||
use DateTime;
|
||||
use RuntimeException;
|
||||
@ -180,13 +181,13 @@ class PaymentService extends CommonService
|
||||
protected function create_process(array $formDatas): PaymentEntity
|
||||
{
|
||||
if (!array_key_exists('serviceinfo_uid', $formDatas)) {
|
||||
throw new RuntimeException(__METHOD__ . "에서 오류발생: 서비스가 정의되지 않았습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: 서비스가 정의되지 않았습니다.");
|
||||
}
|
||||
$serviceEntity = service('customer_serviceservice')->getEntity($formDatas['serviceinfo_uid']);
|
||||
$formDatas['clientinfo_uid'] = $serviceEntity->getClientInfoUID();
|
||||
$entity = parent::create_process($formDatas);
|
||||
if (!$entity instanceof PaymentEntity) {
|
||||
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 PaymentEntity만 가능");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:Return Type은 PaymentEntity만 가능");
|
||||
}
|
||||
//선결제인경우 서비스정보에 결제일 변경용
|
||||
if ($formDatas['billing'] === PAYMENT['BILLING']['PREPAYMENT'] && array_key_exists('billing_at', $formDatas)) {
|
||||
@ -199,7 +200,7 @@ class PaymentService extends CommonService
|
||||
{
|
||||
$entity = parent::modify_process($entity, $formDatas);
|
||||
if (!$entity instanceof PaymentEntity) {
|
||||
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 PaymentEntity만 가능");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:Return Type은 PaymentEntity만 가능");
|
||||
}
|
||||
//선결제인경우 서비스정보에 결제일 변경용
|
||||
if ($formDatas['billing'] === PAYMENT['BILLING']['PREPAYMENT'] && array_key_exists('billing_at', $formDatas)) {
|
||||
@ -221,7 +222,7 @@ class PaymentService extends CommonService
|
||||
if (!array_key_exists($serviceEntity->getPK(), $rows[$clientEntity->getPK()]['services'])) {
|
||||
$serverEntity = service('equipment_serverservice')->getEntity($serviceEntity->getServerInfoUID());
|
||||
if (!$serverEntity instanceof ServerEntity) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생:[{$serviceEntity->getServerInfoUID()}]에 대한 서버정보를 찾을 수 없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:[{$serviceEntity->getServerInfoUID()}]에 대한 서버정보를 찾을 수 없습니다.");
|
||||
}
|
||||
$rows[$clientEntity->getPK()]['services'][$serviceEntity->getPK()] = [
|
||||
'ip' => $serverEntity->getIP(),
|
||||
@ -255,30 +256,51 @@ class PaymentService extends CommonService
|
||||
];
|
||||
switch ($entity->getPay()) {
|
||||
case PAYMENT['PAY']['ACCOUNT']:
|
||||
service('customer_accountservice')->create($formDatas);
|
||||
service('customer_accountservice')->create_process($formDatas);
|
||||
break;
|
||||
case PAYMENT['PAY']['COUPON']:
|
||||
service('customer_couponservice')->create($formDatas);
|
||||
service('customer_couponservice')->create_process($formDatas);
|
||||
break;
|
||||
case PAYMENT['PAY']['POINT']:
|
||||
service('customer_pointservice')->create($formDatas);
|
||||
service('customer_pointservice')->create_process($formDatas);
|
||||
break;
|
||||
default:
|
||||
throw new RuntimeException(__METHOD__ . "에서 오류발생: {$entity->getPay()}는 지정되지 않은 지불방식입니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$entity->getPay()}는 지정되지 않은 지불방식입니다.");
|
||||
// break;
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
public function paid($uid): PaymentEntity
|
||||
{
|
||||
$db = \Config\Database::connect();
|
||||
try {
|
||||
//트랜잭션 도중 DB 오류가 발생하면 DatabaseException을 던지도록 설정
|
||||
$db->transException(true)->transStart();
|
||||
$entity = $this->getEntity($uid);
|
||||
if (!$entity instanceof PaymentEntity) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생:[{$uid}]에 대한 결제정보를 찾을 수 없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:[{$uid}]에 대한 결제정보를 찾을 수 없습니다.");
|
||||
}
|
||||
//결제 완료 처리 후 추가정보 처리
|
||||
$formDatas['status'] = STATUS['PAID'];
|
||||
$fields = array_keys($formDatas);
|
||||
$this->getFormService()->setFormFields($fields);
|
||||
$this->getFormService()->setFormRules('modify', $fields);
|
||||
$entity = parent::modify_process($entity, $formDatas);
|
||||
return $this->paid_process($entity);
|
||||
$entity = $this->paid_process($entity);
|
||||
$db->transComplete();
|
||||
return $entity;
|
||||
} catch (DatabaseException $e) {
|
||||
// DatabaseException을 포착하면 자동으로 롤백 처리됨
|
||||
throw new RuntimeException(sprintf(
|
||||
"\n----[%s]에서 트랜잭션 실패: DB 오류----\n%s\n%s\n------------------------------\n",
|
||||
__METHOD__,
|
||||
$this->model->getLastQuery(),
|
||||
$e->getMessage()
|
||||
), $e->getCode(), $e);
|
||||
} catch (\Throwable $e) {
|
||||
$db->transRollback(); // 예외 발생 시 수동으로 롤백
|
||||
throw new RuntimeException($e->getMessage(), 0, $e);
|
||||
}
|
||||
}
|
||||
|
||||
//서비스관련
|
||||
@ -330,7 +352,7 @@ class PaymentService extends CommonService
|
||||
private function getFormDatasByServerPart(ServerPartEntity $serverPartEntity, array $formDatas = []): array
|
||||
{
|
||||
if ($serverPartEntity->getServiceInfoUID() === null) {
|
||||
throw new RuntimeException(__METHOD__ . "에서 오류발생: 서비스정보가 정의되지 않아 일회성 상품을 설정하실수 없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: 서비스정보가 정의되지 않아 일회성 상품을 설정하실수 없습니다.");
|
||||
}
|
||||
$formDatas['serviceinfo_uid'] = $serverPartEntity->getServiceInfoUID();
|
||||
$formDatas["clientinfo_uid"] = $serverPartEntity->getClientInfoUID();
|
||||
@ -353,7 +375,7 @@ class PaymentService extends CommonService
|
||||
public function modifyByServerPart(ServerPartEntity $serverPartEntity): PaymentEntity
|
||||
{
|
||||
if ($serverPartEntity->getServiceInfoUID() === null) {
|
||||
throw new RuntimeException(__METHOD__ . "에서 오류발생: 서비스정보가 정의되지 않아 일회성 상품을 설정하실수 없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: 서비스정보가 정의되지 않아 일회성 상품을 설정하실수 없습니다.");
|
||||
}
|
||||
//서버파트정보의 서비스번호가 같고, 청구방식이 onetime이고 상태가 UNPAID인 결제정보 가져와서 결제정보 수정
|
||||
$entity = $this->getEntity([
|
||||
|
||||
@ -2,13 +2,15 @@
|
||||
|
||||
namespace App\Traits;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
trait FileTrait
|
||||
{
|
||||
final protected function mkdir_FileTrait(string $path)
|
||||
{
|
||||
if (!is_dir($path)) {
|
||||
if (!mkdir($path, 0755, true)) {
|
||||
throw new \Exception("디렉토리 생성 실패:{$path}");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 디렉토리 생성 실패:{$path}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ namespace App\Traits;
|
||||
|
||||
use App\Entities\Mangboard\BoardEntity;
|
||||
use App\Libraries\MyStorage\MangboardStorage;
|
||||
use RuntimeException;
|
||||
|
||||
trait ImageTrait
|
||||
{
|
||||
@ -40,7 +41,7 @@ trait ImageTrait
|
||||
$this->_image = imagecreatefromwebp($file);
|
||||
break;
|
||||
default:
|
||||
throw new \Exception("Unsupported image type: " . $this->_imageType);
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 Unsupported image type: " . $this->_imageType);
|
||||
}
|
||||
}
|
||||
|
||||
@ -102,13 +103,13 @@ trait ImageTrait
|
||||
imagewebp($this->_image, $file, $compression);
|
||||
break;
|
||||
default:
|
||||
throw new \Exception("Unsupported image type: " . $imageType);
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 Unsupported image type: " . $imageType);
|
||||
}
|
||||
}
|
||||
|
||||
// 메모리 해제를 위한 메소드
|
||||
final public function destroy_ImageTrait()
|
||||
{
|
||||
imagedestroy($this->_image);
|
||||
}
|
||||
// final public function destroy_ImageTrait()
|
||||
// {
|
||||
// imagedestroy($this->_image);
|
||||
// }
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user