dbmsv2_init...1
This commit is contained in:
parent
d5a43012d3
commit
c441649421
@ -53,6 +53,7 @@ class ServerPartCell extends EquipmentCell
|
||||
'control' => $this->getService()->getControlDatas(),
|
||||
'service' => $this->getService(),
|
||||
'serverinfo_uid' => $params['serverinfo_uid'],
|
||||
'serviceinfo_serverinfo_uid' => $params['serviceinfo_serverinfo_uid'] ?? 0,
|
||||
'types' => $params['types'],
|
||||
'serverEntity' => $serverEntity,
|
||||
'entities' => $entities,
|
||||
|
||||
@ -125,6 +125,7 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
|
||||
$routes->get('download/(:alpha)', 'ServiceController::download/$1');
|
||||
$routes->get('alternative/(:num)', 'ServiceController::alternative_form/$1');
|
||||
$routes->post('alternative/(:num)', 'ServiceController::alternative/$1');
|
||||
$routes->get('main/(:num)', 'ServiceController::main/$1');
|
||||
$routes->post('history/(:num)', 'ServiceController::history/$1');
|
||||
});
|
||||
$routes->group('payment', ['namespace' => 'App\Controllers\Admin\Customer'], function ($routes) {
|
||||
|
||||
@ -120,7 +120,7 @@ class ClientController extends CustomerController
|
||||
$this->doValidations();
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
if (!$entity instanceof ClientEntity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->entity = $this->getService()->modify($entity, $this->getService()->getFormDatas());
|
||||
|
||||
@ -71,7 +71,7 @@ class PaymentController extends CustomerController
|
||||
foreach ($uids as $uid) {
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
if (!$entity instanceof PaymentEntity) {
|
||||
throw new \Exception(__METHOD__ . "에서 {$uid}에 대한 결제정보를 찾을수 없습니다.");
|
||||
}
|
||||
//entities에 고객 설정
|
||||
@ -87,9 +87,9 @@ class PaymentController extends CustomerController
|
||||
];
|
||||
}
|
||||
//entities에 서비스 설정
|
||||
$serviceEntity = $this->getService()->getServiceService()->getEntity($entity->getServiceUid());
|
||||
$serviceEntity = $this->getService()->getServiceService()->getEntity($entity->getServiceInfoUid());
|
||||
if (!$serviceEntity instanceof ServiceEntity) {
|
||||
throw new \Exception(__METHOD__ . "에서 {$entity->getServiceUid()}에 대한 서비스정보를 찾을수 없습니다.");
|
||||
throw new \Exception(__METHOD__ . "에서 {$entity->getServiceInfoUid()}에 대한 서비스정보를 찾을수 없습니다.");
|
||||
}
|
||||
if (!array_key_exists($serviceEntity->getPK(), $entities[$clientEntity->getPK()]['services'])) {
|
||||
$entities[$clientEntity->getPK()]['services'][$serviceEntity->getPK()] = [
|
||||
|
||||
@ -131,7 +131,7 @@ class ServiceController extends CustomerController
|
||||
$this->getService()->setFormOptions();
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
if (!$entity instanceof ServiceEntity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->entity = $entity;
|
||||
@ -169,7 +169,7 @@ class ServiceController extends CustomerController
|
||||
$this->doValidations();
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
if (!$entity instanceof ServiceEntity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->entity = $this->alternative_process($entity, $this->getService()->getFormDatas());
|
||||
@ -181,7 +181,42 @@ class ServiceController extends CustomerController
|
||||
}
|
||||
}
|
||||
//MAIN서버선정
|
||||
public function main(mixed $uid): RedirectResponse|string
|
||||
{
|
||||
//Transaction Start
|
||||
$db = \Config\Database::connect();
|
||||
$db->transStart();
|
||||
try {
|
||||
$this->getService()->setAction(__FUNCTION__);
|
||||
$this->getService()->setFormFields(['serverinfo_uid']);
|
||||
//전달값정의
|
||||
$this->getService()->setFormDatas($this->request->getGet());
|
||||
$this->getService()->setFormFilters();
|
||||
$this->getService()->setFormRules();
|
||||
$this->doValidations();
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity instanceof ServiceEntity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
|
||||
$formDatas = $this->getService()->getFormDatas();
|
||||
if (!array_key_exists('serverinfo_uid', $formDatas)) {
|
||||
throw new \Exception("서비스의 메인서버로 설정할 서버정보가 없습니다.");
|
||||
}
|
||||
$serverEntity = $this->getServerService()->getEntity($formDatas['serverinfo_uid']);
|
||||
if (!$serverEntity instanceof ServerEntity) {
|
||||
throw new \Exception("{$formDatas['serverinfo_uid']}에 대한 서버정보를 찾을수 없습니다.");
|
||||
}
|
||||
//서버정보설정
|
||||
$this->getService()->setMainServer($entity, $serverEntity);
|
||||
$db->transCommit();
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
$db->transRollback();
|
||||
return $this->getResultFail($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function history(int $uid): RedirectResponse|string
|
||||
{
|
||||
@ -198,7 +233,7 @@ class ServiceController extends CustomerController
|
||||
$this->doValidations();
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
if (!$entity instanceof ServiceEntity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->entity = $this->getService()->modify($entity, $this->getService()->getFormDatas());
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Controllers\Admin;
|
||||
|
||||
use App\Entities\UserEntity;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
|
||||
@ -83,7 +84,7 @@ class UserController extends AdminController
|
||||
$this->getService()->setFormDatas($this->request->getGet());
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
if (!$entity instanceof UserEntity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->entity = $entity;
|
||||
@ -109,7 +110,7 @@ class UserController extends AdminController
|
||||
$this->doValidations();
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
if (!$entity instanceof UserEntity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->entity = $this->modify_process($entity, $this->getService()->getFormDatas());
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -76,7 +76,7 @@ class ServerPartHelper extends EquipmentHelper
|
||||
switch ($field) {
|
||||
case 'SERVER':
|
||||
if (array_key_exists('serverEntity', $viewDatas)) {
|
||||
$value = $viewDatas['serviceinfo_serverinfo_uid'] == $viewDatas['serverEntity']->getPK() ? "📌" : "";
|
||||
$value = $viewDatas['serviceinfo_serverinfo_uid'] == $viewDatas['serverEntity']->getPK() ? "📌" : "<a href=\"/admin/customer/service/main/{$viewDatas['serverEntity']->getServiceInfoUID()}?serverinfo_uid={$viewDatas['serverEntity']->getPK()}\">✔️</a>";
|
||||
$value .= form_label(
|
||||
"[" . lang("Equipment/Server.TYPE")[$viewDatas['serverEntity']->getType()] . "] " . $viewDatas['serverEntity']->getCode(),
|
||||
$field,
|
||||
|
||||
@ -45,7 +45,7 @@ class GoogleService extends AuthService
|
||||
$sns_entity = $this->_mySocket->signup();
|
||||
// local db 사용와의 연결 확인
|
||||
$entity = $this->getEntity($sns_entity->getParent());
|
||||
if (!$entity) {
|
||||
if (!$entity instanceof UserEntity) {
|
||||
throw new PageNotFoundException("회원[{$sns_entity->getTitle()}]님은 아직 로컬사용자 연결이 이루어지지 않았습니다.");
|
||||
}
|
||||
return $this->login_process($entity);;
|
||||
|
||||
@ -32,7 +32,7 @@ class LocalService extends AuthService
|
||||
'id' => $formDatas['id'],
|
||||
'status' => UserEntity::DEFAULT_STATUS
|
||||
], false);
|
||||
if (!$entity) {
|
||||
if (!$entity instanceof UserEntity) {
|
||||
throw new \Exception("{$formDatas['id']}에 대한 로그인 정보를 찾을수 없습니다.");
|
||||
}
|
||||
if (!password_verify($formDatas['passwd'], $entity->getPassword())) {
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
namespace App\Services\Customer;
|
||||
|
||||
use App\Entities\Customer\AccountEntity;
|
||||
use App\Entities\Customer\ClientEntity;
|
||||
use App\Helpers\Customer\AccountHelper;
|
||||
use App\Models\Customer\AccountModel;
|
||||
|
||||
@ -52,7 +53,7 @@ class AccountService extends CustomerService
|
||||
{
|
||||
//account_balance 체크
|
||||
$entity = $this->getClientService()->getEntity($formDatas['clientinfo_uid']);
|
||||
if (!$entity) {
|
||||
if (!$entity instanceof ClientEntity) {
|
||||
throw new \Exception("{$formDatas['clientinfo_uid']}에 대한 고객정보를 찾을수 없습니다.");
|
||||
}
|
||||
$amount = intval($formDatas['amount']);
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Services\Customer;
|
||||
|
||||
use App\Entities\Customer\ClientEntity;
|
||||
use App\Entities\Customer\CouponEntity;
|
||||
use App\Helpers\Customer\CouponHelper;
|
||||
use App\Models\Customer\CouponModel;
|
||||
@ -40,7 +41,7 @@ class CouponService extends CustomerService
|
||||
{
|
||||
//coupon_balance 체크
|
||||
$entity = $this->getClientService()->getEntity($formDatas['clientinfo_uid']);
|
||||
if (!$entity) {
|
||||
if (!$entity instanceof ClientEntity) {
|
||||
throw new \Exception("{$formDatas['clientinfo_uid']}에 대한 고객정보를 찾을수 없습니다.");
|
||||
}
|
||||
$cnt = intval($formDatas['cnt']);
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Services\Customer;
|
||||
|
||||
use App\Entities\Customer\ClientEntity;
|
||||
use App\Entities\Customer\PointEntity;
|
||||
use App\Helpers\Customer\PointHelper;
|
||||
use App\Models\Customer\PointModel;
|
||||
@ -46,7 +47,7 @@ class PointService extends CustomerService
|
||||
{
|
||||
//point_balance 체크
|
||||
$entity = $this->getClientService()->getEntity($formDatas['clientinfo_uid']);
|
||||
if (!$entity) {
|
||||
if (!$entity instanceof ClientEntity) {
|
||||
throw new \Exception("{$formDatas['clientinfo_uid']}에 대한 고객정보를 찾을수 없습니다.");
|
||||
}
|
||||
$amount = intval($formDatas['amount']);
|
||||
|
||||
@ -186,6 +186,12 @@ class ServiceService extends CustomerService
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
//서비스 메인서버 설정
|
||||
final public function setMainServer(ServiceEntity $entity, ServerEntity $serverEntity): ServiceEntity
|
||||
{
|
||||
$entity = parent::modify($entity, ['serverinfo_uid' => $serverEntity->getPK()]);
|
||||
return $this->setAmount($entity);
|
||||
}
|
||||
//기본 기능부분
|
||||
//FieldForm관련용
|
||||
public function getFormOption(string $field, array $options = []): array
|
||||
|
||||
@ -23,6 +23,6 @@
|
||||
<?= implode(" / ", $view_htmls) ?>
|
||||
<span class="serverparts float-start" style="cursor:pointer;" onClick="copyServerPartToClipboard('<?= $text ?>')" text-data="<?= $text ?>">📋</span>
|
||||
<?php if ($serverPartCellDatas['serverEntity']): ?>
|
||||
<a href="/admin/customer/service/main/<?= $viewDatas['serverEntity']->getServiceInfoUID() ?>?serverinfo_uid=<?= $viewDatas['serverEntity']->getPK() ?>" class="float-e">❌</a>
|
||||
<a href="/admin/customer/service/terminate/<?= $serverPartCellDatas['serverEntity']->getServiceInfoUID() ?>?serverinfo_uid=<?= $serverPartCellDatas['serverEntity']->getPK() ?>">❌</a>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
Loading…
Reference in New Issue
Block a user