dbmsv4 init...3
This commit is contained in:
parent
5902b63194
commit
6b000d8cad
@ -110,14 +110,14 @@ class PaymentController extends AdminController
|
||||
//지급기한일이 오늘보다 작거나 같고 미지급인경우
|
||||
if ($entity->getBillingAt() <= date("Y-m-d") && $entity->getStatus() === STATUS['UNPAID']) {
|
||||
//고객 정보가져오기
|
||||
if (array_key_exists($entity->getClientInfoUID(), $clientEntities)) {
|
||||
$clientEntity = $clientEntities[$entity->getClientInfoUID()];
|
||||
if (array_key_exists($entity->getClientInfoUid(), $clientEntities)) {
|
||||
$clientEntity = $clientEntities[$entity->getClientInfoUid()];
|
||||
} else {
|
||||
$clientEntity = service('customer_clientservice')->getEntity($entity->getClientInfoUID());
|
||||
$clientEntity = service('customer_clientservice')->getEntity($entity->getClientInfoUid());
|
||||
if (!$clientEntity instanceof ClientEntity) {
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:{$entity->getClientInfoUID()}에 대한 고객정보를 찾을수 없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:{$entity->getClientInfoUid()}에 대한 고객정보를 찾을수 없습니다.");
|
||||
}
|
||||
$clientEntities[$entity->getClientInfoUID()] = $clientEntity;
|
||||
$clientEntities[$entity->getClientInfoUid()] = $clientEntity;
|
||||
}
|
||||
//서비스 정보가져오기
|
||||
if (array_key_exists($entity->getServiceInfoUid(), $serviceEntities)) {
|
||||
|
||||
@ -7,10 +7,10 @@ class BoardDTO extends CommonDTO
|
||||
public ?int $uid = null;
|
||||
public ?int $user_uid = null;
|
||||
public ?int $worker_uid = null;
|
||||
public ?string $category = null;
|
||||
public ?string $title = null;
|
||||
public ?string $content = null;
|
||||
public ?string $status = null;
|
||||
public string $category = '';
|
||||
public string $title = '';
|
||||
public string $status = STATUS['AVAILABLE'];
|
||||
public string $content = '';
|
||||
|
||||
public function __construct(array $datas = [])
|
||||
{
|
||||
|
||||
@ -9,71 +9,51 @@ abstract class CommonDTO
|
||||
{
|
||||
protected function __construct(array $datas = [])
|
||||
{
|
||||
// 데이터가 없으면 바로 리턴
|
||||
if (empty($datas)) {
|
||||
return;
|
||||
}
|
||||
if (empty($datas)) return;
|
||||
|
||||
// $this는 이 시점에 자식 클래스(AccountDTO)의 인스턴스입니다.
|
||||
$reflection = new ReflectionClass($this);
|
||||
|
||||
foreach ($datas as $key => $value) {
|
||||
// 1. 속성이 존재하는지 확인
|
||||
if (!$reflection->hasProperty($key)) {
|
||||
continue;
|
||||
}
|
||||
if (!$reflection->hasProperty($key)) continue;
|
||||
|
||||
$property = $reflection->getProperty($key);
|
||||
|
||||
// public이 아닌 속성도 접근 가능하게 설정 (필요시)
|
||||
// $property->setAccessible(true);
|
||||
|
||||
// 2. 속성의 타입 정보를 가져옴
|
||||
$type = $property->getType();
|
||||
|
||||
// 값을 할당하기 전 정제된 값을 담을 변수
|
||||
$assignValue = $value;
|
||||
|
||||
// 3. 빈 문자열("") 처리
|
||||
// HTML 폼에서 온 빈 값은 null로 처리해야 ?int 등에 들어갈 수 있음
|
||||
if ($value === '') {
|
||||
$assignValue = null;
|
||||
}
|
||||
// 4. 타입에 따른 강제 형변환 (Casting)
|
||||
elseif ($type instanceof ReflectionNamedType) {
|
||||
} elseif ($type instanceof ReflectionNamedType) {
|
||||
$typeName = $type->getName();
|
||||
|
||||
// int 타입이고 값이 숫자형일 때
|
||||
if ($typeName === 'int' && is_numeric($value)) {
|
||||
// [추가] 타입이 array인 경우 처리
|
||||
if ($typeName === 'array' && is_string($value)) {
|
||||
$assignValue = explode(DEFAULTS["DELIMITER_ROLE"], $value);
|
||||
} elseif ($typeName === 'int' && is_numeric($value)) {
|
||||
$assignValue = (int) $value;
|
||||
}
|
||||
// float 타입이고 값이 숫자형일 때
|
||||
elseif ($typeName === 'float' && is_numeric($value)) {
|
||||
$assignValue = (float) $value;
|
||||
}
|
||||
// 필요하다면 bool 처리 등 추가 가능
|
||||
// ... float 등 기존 로직 ...
|
||||
}
|
||||
|
||||
// 5. 값 할당
|
||||
$this->{$key} = $assignValue;
|
||||
}
|
||||
}
|
||||
|
||||
public function __get(string $name): mixed
|
||||
// [중요] final 해제 또는 로직 변경
|
||||
public function toArray(): array
|
||||
{
|
||||
// 1. 속성이 클래스에 실제로 존재하는지 확인
|
||||
if (property_exists($this, $name)) {
|
||||
// 2. 속성이 존재하면 값을 반환 (PHP 7.4 이상의 타입 속성 덕분에 null 병합 연산자 사용 불필요)
|
||||
return $this->{$name};
|
||||
// get_object_vars는 protected를 가져오지 못하므로
|
||||
// Reflection을 사용하여 모든 프로퍼티를 가져오되,
|
||||
// 값을 가져올 때는 $this->{$name}을 통해 Getter나 매직메서드가 작동하게 합니다.
|
||||
$reflection = new ReflectionClass($this);
|
||||
$properties = $reflection->getProperties();
|
||||
$result = [];
|
||||
|
||||
foreach ($properties as $property) {
|
||||
$name = $property->getName();
|
||||
// $this->$name 처리를 통해 자식의 __get()이 호출되도록 유도
|
||||
$result[$name] = $this->{$name};
|
||||
}
|
||||
// 3. 속성이 존재하지 않으면 오류 발생 (일반적인 Entity/DTO 접근 방식)
|
||||
throw new \BadMethodCallException(
|
||||
"Undefined property or method: " . static::class . "::{$name}"
|
||||
);
|
||||
}
|
||||
final public function toArray(): array
|
||||
{
|
||||
// $this가 가진 모든 public 프로퍼티와 그 값을 배열로 반환합니다.
|
||||
return get_object_vars($this);
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,55 +8,42 @@ class ClientDTO extends CommonDTO
|
||||
{
|
||||
public ?int $uid = null;
|
||||
public ?int $user_uid = null;
|
||||
public ?string $site = null;
|
||||
|
||||
// __get이 동작하려면 public이 아닌 protected여야 합니다.
|
||||
// public으로 선언되어 있으면 $dto->role 접근 시 __get을 거치지 않고 직접 접근합니다.
|
||||
protected ?string $role = null;
|
||||
|
||||
public ?string $name = null;
|
||||
public ?string $phone = null;
|
||||
public ?string $email = null;
|
||||
public ?string $history = null;
|
||||
public ?int $account_balance = null;
|
||||
public ?int $coupon_balance = null;
|
||||
public ?int $point_balance = null;
|
||||
public ?string $status = null;
|
||||
public string $site = SITES['prime'];
|
||||
public string $name = '';
|
||||
public string $phone = '';
|
||||
public string $email = 'test@example.com';
|
||||
public array $role = [];
|
||||
public int $account_balance = 0;
|
||||
public int $coupon_balance = 0;
|
||||
public int $point_balance = 0;
|
||||
public string $status = '';
|
||||
public string $history = '';
|
||||
|
||||
public function __construct(array $datas = [])
|
||||
{
|
||||
// 1. [전처리] role이 배열로 들어왔다면 문자열로 변환하여 $datas 덮어쓰기
|
||||
if (isset($datas['role']) && is_array($datas['role'])) {
|
||||
$datas['role'] = implode(DEFAULTS["DELIMITER_ROLE"], $datas['role']);
|
||||
// 1. role 변환 로직 (기존 유지)
|
||||
if (isset($datas['role']) && is_string($datas['role'])) {
|
||||
$datas['role'] = explode(DEFAULTS["DELIMITER_ROLE"], $datas['role']);
|
||||
}
|
||||
|
||||
if (!isset($datas['role'])) {
|
||||
$datas['role'] = [];
|
||||
}
|
||||
|
||||
// 2. [추가] 잔액 관련 데이터가 null이거나 비어있다면 0으로 보정
|
||||
// CommonDTO의 parent::__construct가 호출되기 전에 데이터를 정제합니다.
|
||||
$balanceFields = ['account_balance', 'coupon_balance', 'point_balance'];
|
||||
foreach ($balanceFields as $field) {
|
||||
if (!isset($datas[$field]) || $datas[$field] === '' || $datas[$field] === null) {
|
||||
$datas[$field] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// 2. 변환된 $datas를 가지고 부모(CommonDTO) 생성자 호출
|
||||
// 이제 'role'은 문자열이므로 부모 클래스의 Reflection 로직이나 타입 검사를 통과합니다.
|
||||
parent::__construct($datas);
|
||||
}
|
||||
|
||||
/**
|
||||
* role 속성을 읽을 때 자동으로 배열로 변환해서 반환
|
||||
*/
|
||||
public function __get(string $name): mixed
|
||||
public function getRoleToString(): string
|
||||
{
|
||||
// role을 요청했고, 실제 데이터가 문자열로 존재한다면 배열로 변환
|
||||
switch ($name) {
|
||||
case 'role':
|
||||
$value = is_string($this->$name) ? explode(DEFAULTS["DELIMITER_ROLE"], $this->role) : [];
|
||||
break;
|
||||
default:
|
||||
// 부모에게 위임 (혹시 CommonDTO에도 __get이 있다면)
|
||||
$value = parent::__get($name);
|
||||
break;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
// role 값을 설정할 때도 배열을 받을 수 있게 하려면 __set도 필요할 수 있습니다.
|
||||
// (선택 사항)
|
||||
public function setRole(array $roles): void
|
||||
{
|
||||
$this->role = implode(DEFAULTS["DELIMITER_ROLE"], $roles);
|
||||
return implode(DEFAULTS["DELIMITER_ROLE"], $this->role);
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,19 +10,19 @@ class ServiceDTO extends CommonDTO
|
||||
public ?int $user_uid = null;
|
||||
public ?int $clientinfo_uid = null;
|
||||
public ?int $serverinfo_uid = null;
|
||||
public ?string $code = null;
|
||||
public ?string $title = null;
|
||||
public ?string $site = null;
|
||||
public ?string $location = null;
|
||||
public ?int $rack = null;
|
||||
public ?int $line = null;
|
||||
public ?string $billing_at = null;
|
||||
public ?int $sale = null;
|
||||
public ?int $amount = null;
|
||||
public ?string $start_at = null;
|
||||
public ?string $end_at = null;
|
||||
public ?string $history = null;
|
||||
public ?string $status = null;
|
||||
public string $code = '';
|
||||
public string $title = '';
|
||||
public string $site = '';
|
||||
public string $location = '';
|
||||
public int $rack = 0;
|
||||
public int $line = 0;
|
||||
public string $billing_at = '';
|
||||
public int $sale = 0;
|
||||
public int $amount = 0;
|
||||
public string $start_at = '';
|
||||
public string $end_at = '';
|
||||
public string $status = '';
|
||||
public string $history = '';
|
||||
|
||||
public function __construct(array $datas = [])
|
||||
{
|
||||
|
||||
@ -2,21 +2,11 @@
|
||||
|
||||
namespace App\DTOs\Customer\Wallet;
|
||||
|
||||
use App\DTOs\CommonDTO;
|
||||
|
||||
class AccountDTO extends CommonDTO
|
||||
class AccountDTO extends WalletDTO
|
||||
{
|
||||
public ?int $uid = null;
|
||||
public ?int $user_uid = null;
|
||||
public ?int $clientinfo_uid = null;
|
||||
public ?string $bank = null;
|
||||
public ?string $title = null;
|
||||
public ?string $alias = null;
|
||||
public ?string $issue_at = null;
|
||||
public ?int $amount = null;
|
||||
public ?int $balance = null;
|
||||
public ?string $status = null;
|
||||
public ?string $content = null;
|
||||
public string $bank = '';
|
||||
public string $alias = '';
|
||||
public string $issue_at = '';
|
||||
|
||||
public function __construct(array $datas = [])
|
||||
{
|
||||
|
||||
@ -2,19 +2,8 @@
|
||||
|
||||
namespace App\DTOs\Customer\Wallet;
|
||||
|
||||
use App\DTOs\CommonDTO;
|
||||
|
||||
class CouponDTO extends CommonDTO
|
||||
class CouponDTO extends WalletDTO
|
||||
{
|
||||
public ?int $uid = null;
|
||||
public ?int $user_uid = null;
|
||||
public ?int $clientinfo_uid = null;
|
||||
public ?string $title = null;
|
||||
public ?int $amount = null;
|
||||
public ?int $balance = null;
|
||||
public ?string $status = null;
|
||||
public ?string $content = null;
|
||||
|
||||
public function __construct(array $datas = [])
|
||||
{
|
||||
parent::__construct($datas);
|
||||
|
||||
@ -2,19 +2,8 @@
|
||||
|
||||
namespace App\DTOs\Customer\Wallet;
|
||||
|
||||
use App\DTOs\CommonDTO;
|
||||
|
||||
class PointDTO extends CommonDTO
|
||||
class PointDTO extends WalletDTO
|
||||
{
|
||||
public ?int $uid = null;
|
||||
public ?int $user_uid = null;
|
||||
public ?int $clientinfo_uid = null;
|
||||
public ?string $title = null;
|
||||
public ?int $amount = null;
|
||||
public ?int $balance = null;
|
||||
public ?string $status = null;
|
||||
public ?string $content = null;
|
||||
|
||||
public function __construct(array $datas = [])
|
||||
{
|
||||
parent::__construct($datas);
|
||||
|
||||
22
app/DTOs/Customer/Wallet/WalletDTO.php
Normal file
22
app/DTOs/Customer/Wallet/WalletDTO.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\DTOs\Customer\Wallet;
|
||||
|
||||
use App\DTOs\CommonDTO;
|
||||
|
||||
class WalletDTO extends CommonDTO
|
||||
{
|
||||
final public ?int $uid = null;
|
||||
final public ?int $user_uid = null;
|
||||
final public ?int $clientinfo_uid = null;
|
||||
final public string $title = '';
|
||||
final public ?int $amount = 0;
|
||||
final public ?int $balance = 0;
|
||||
final public string $status = STATUS['DEPOSIT'];
|
||||
final public string $content = '';
|
||||
|
||||
public function __construct(array $datas = [])
|
||||
{
|
||||
parent::__construct($datas);
|
||||
}
|
||||
}
|
||||
@ -7,11 +7,11 @@ use App\DTOs\CommonDTO;
|
||||
class CHASSISDTO extends CommonDTO
|
||||
{
|
||||
public ?int $uid = null;
|
||||
public ?string $title = null;
|
||||
public ?int $price = null;
|
||||
public ?string $used = null;
|
||||
public ?int $stock = null;
|
||||
public ?string $status = null;
|
||||
public string $title = '';
|
||||
public int $price = 0;
|
||||
public int $used = 0;
|
||||
public int $stock = 0;
|
||||
public string $status = STATUS['AVAILABLE'];
|
||||
|
||||
public function __construct(array $datas = [])
|
||||
{
|
||||
|
||||
@ -7,12 +7,12 @@ use App\DTOs\CommonDTO;
|
||||
class LineDTO extends CommonDTO
|
||||
{
|
||||
public ?int $uid = null;
|
||||
public ?string $title = null;
|
||||
public ?string $bandwith = null;
|
||||
public ?string $start_at = null;
|
||||
public ?string $end_at = null;
|
||||
public ?string $status = null;
|
||||
public ?string $content = null;
|
||||
public string $title = '';
|
||||
public string $bandwith = '';
|
||||
public string $start_at = '';
|
||||
public string $end_at = '';
|
||||
public string $status = STATUS['AVAILABLE'];
|
||||
public string $content = '';
|
||||
|
||||
public function __construct(array $datas = [])
|
||||
{
|
||||
|
||||
@ -7,17 +7,17 @@ use App\DTOs\CommonDTO;
|
||||
class ServerDTO extends CommonDTO
|
||||
{
|
||||
public ?int $uid = null;
|
||||
public ?string $code = null;
|
||||
public ?string $type = null;
|
||||
public ?int $chassisinfo_uid = null;
|
||||
public ?int $switchinfo_uid = null;
|
||||
public ?string $ip = null;
|
||||
public ?string $os = null;
|
||||
public ?string $title = null;
|
||||
public ?int $price = null;
|
||||
public ?string $manufactur_at = null;
|
||||
public ?string $format_at = null;
|
||||
public ?string $status = null;
|
||||
public string $code = '';
|
||||
public string $title = '';
|
||||
public string $type = '';
|
||||
public string $ip = '';
|
||||
public string $os = '';
|
||||
public int $price = 0;
|
||||
public string $manufactur_at = '';
|
||||
public string $format_at = '';
|
||||
public string $status = STATUS['AVAILABLE'];
|
||||
public function __construct(array $datas = [])
|
||||
{
|
||||
parent::__construct($datas);
|
||||
|
||||
@ -7,14 +7,17 @@ use App\DTOs\CommonDTO;
|
||||
class ServerPartDTO extends CommonDTO
|
||||
{
|
||||
public ?int $uid = null;
|
||||
public ?string $clientinfo_uid = null;
|
||||
public ?string $serviceinfo_uid = null;
|
||||
public ?string $serverinfo_uid = null;
|
||||
public ?string $type = null;
|
||||
public ?string $billing = null;
|
||||
public ?int $part_uid = null;
|
||||
public ?string $title = null;
|
||||
public ?int $cnt = null;
|
||||
public ?string $extra = null;
|
||||
public ?string $amount = null;
|
||||
public string $title = '';
|
||||
public string $type = '';
|
||||
public string $billing = '';
|
||||
public string $billing_at = '';
|
||||
public int $cnt = 0;
|
||||
public int $amount = 0;
|
||||
public string $extra = '';
|
||||
public function __construct(array $datas = [])
|
||||
{
|
||||
parent::__construct($datas);
|
||||
|
||||
@ -2,17 +2,10 @@
|
||||
|
||||
namespace App\DTOs\Part;
|
||||
|
||||
use App\DTOs\CommonDTO;
|
||||
|
||||
class CPUDTO extends CommonDTO
|
||||
class CPUDTO extends PartDTO
|
||||
{
|
||||
public ?int $uid = null;
|
||||
public ?string $title = null;
|
||||
public ?int $price = null;
|
||||
public ?string $used = null;
|
||||
public ?int $stock = null;
|
||||
public ?string $status = null;
|
||||
|
||||
public int $used = 0;
|
||||
public int $stock = 0;
|
||||
public function __construct(array $datas = [])
|
||||
{
|
||||
parent::__construct($datas);
|
||||
|
||||
@ -2,21 +2,15 @@
|
||||
|
||||
namespace App\DTOs\Part;
|
||||
|
||||
use App\DTOs\CommonDTO;
|
||||
|
||||
class CSDTO extends CommonDTO
|
||||
class CSDTO extends PartDTO
|
||||
{
|
||||
public ?int $uid = null;
|
||||
public ?int $clientinfo_uid = null;
|
||||
public ?int $serviceinfo_uid = null;
|
||||
public ?int $serverinfo_uid = null;
|
||||
public ?string $type = null;
|
||||
public ?string $ip = null;
|
||||
public ?string $accountid = null;
|
||||
public ?string $domain = null;
|
||||
public ?int $price = null;
|
||||
public ?string $status = null;
|
||||
|
||||
public string $type = '';
|
||||
public string $ip = '';
|
||||
public string $accountid = '';
|
||||
public string $domain = '';
|
||||
public function __construct(array $datas = [])
|
||||
{
|
||||
parent::__construct($datas);
|
||||
|
||||
@ -2,17 +2,12 @@
|
||||
|
||||
namespace App\DTOs\Part;
|
||||
|
||||
use App\DTOs\CommonDTO;
|
||||
|
||||
class DISKDTO extends CommonDTO
|
||||
class DISKDTO extends PartDTO
|
||||
{
|
||||
public ?int $uid = null;
|
||||
public ?string $title = null;
|
||||
public ?int $price = null;
|
||||
public ?string $used = null;
|
||||
public ?int $stock = null;
|
||||
public ?int $format = null;
|
||||
public ?string $status = null;
|
||||
public int $used = 0;
|
||||
public int $stock = 0;
|
||||
public int $format = 0;
|
||||
|
||||
public function __construct(array $datas = [])
|
||||
{
|
||||
|
||||
@ -2,20 +2,14 @@
|
||||
|
||||
namespace App\DTOs\Part;
|
||||
|
||||
use App\DTOs\CommonDTO;
|
||||
|
||||
class IPDTO extends CommonDTO
|
||||
class IPDTO extends PartDTO
|
||||
{
|
||||
public ?int $uid = null;
|
||||
public ?int $lineinfo_uid = null;
|
||||
public ?int $old_clientinfo_uid = null;
|
||||
public ?int $clientinfo_uid = null;
|
||||
public ?int $serviceinfo_uid = null;
|
||||
public ?int $serverinfo_uid = null;
|
||||
public ?string $ip = null;
|
||||
public ?int $price = null;
|
||||
public ?string $status = null;
|
||||
|
||||
public string $ip = '';
|
||||
public function __construct(array $datas = [])
|
||||
{
|
||||
parent::__construct($datas);
|
||||
|
||||
18
app/DTOs/Part/PartDTO.php
Normal file
18
app/DTOs/Part/PartDTO.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\DTOs\Part;
|
||||
|
||||
use App\DTOs\CommonDTO;
|
||||
|
||||
class PartDTO extends CommonDTO
|
||||
{
|
||||
final public ?int $uid = null;
|
||||
final public string $title = '';
|
||||
final public int $price = 0;
|
||||
final public string $status = STATUS['AVAILABLE'];
|
||||
|
||||
public function __construct(array $datas = [])
|
||||
{
|
||||
parent::__construct($datas);
|
||||
}
|
||||
}
|
||||
@ -2,16 +2,11 @@
|
||||
|
||||
namespace App\DTOs\Part;
|
||||
|
||||
use App\DTOs\CommonDTO;
|
||||
|
||||
class RAMDTO extends CommonDTO
|
||||
class RAMDTO extends PartDTO
|
||||
{
|
||||
public ?int $uid = null;
|
||||
public ?string $title = null;
|
||||
public ?int $price = null;
|
||||
public ?string $used = null;
|
||||
public ?int $stock = null;
|
||||
public ?string $status = null;
|
||||
public int $used = 0;
|
||||
public int $stock = 0;
|
||||
|
||||
public function __construct(array $datas = [])
|
||||
{
|
||||
|
||||
@ -2,17 +2,10 @@
|
||||
|
||||
namespace App\DTOs\Part;
|
||||
|
||||
use App\DTOs\CommonDTO;
|
||||
|
||||
class SOFTWAREDTO extends CommonDTO
|
||||
class SOFTWAREDTO extends PartDTO
|
||||
{
|
||||
public ?int $uid = null;
|
||||
public ?string $title = null;
|
||||
public ?int $price = null;
|
||||
public ?string $used = null;
|
||||
public ?int $stock = null;
|
||||
public ?string $status = null;
|
||||
|
||||
public int $used = 0;
|
||||
public int $stock = 0;
|
||||
public function __construct(array $datas = [])
|
||||
{
|
||||
parent::__construct($datas);
|
||||
|
||||
@ -2,18 +2,12 @@
|
||||
|
||||
namespace App\DTOs\Part;
|
||||
|
||||
use App\DTOs\CommonDTO;
|
||||
|
||||
class SWITCHDTO extends CommonDTO
|
||||
class SWITCHDTO extends PartDTO
|
||||
{
|
||||
public ?int $uid = null;
|
||||
public ?int $clientinfo_uid = null;
|
||||
public ?int $serviceinfo_uid = null;
|
||||
public ?int $serverinfo_uid = null;
|
||||
public ?string $code = null;
|
||||
public ?int $price = null;
|
||||
public ?string $status = null;
|
||||
|
||||
public string $code = '';
|
||||
public function __construct(array $datas = [])
|
||||
{
|
||||
parent::__construct($datas);
|
||||
|
||||
@ -11,45 +11,36 @@ class UserDTO extends CommonDTO
|
||||
public ?string $name = null;
|
||||
public ?string $email = null;
|
||||
public ?string $mobile = null;
|
||||
// __get이 동작하려면 public이 아닌 protected여야 합니다.
|
||||
// public으로 선언되어 있으면 $dto->role 접근 시 __get을 거치지 않고 직접 접근합니다.
|
||||
protected ?string $role = null;
|
||||
|
||||
/**
|
||||
* 검증(is_array) 통과를 위해 public array로 선언합니다.
|
||||
* get_object_vars($this) 호출 시 배열 형태로 추출됩니다.
|
||||
*/
|
||||
public array $role = [];
|
||||
|
||||
public ?string $status = null;
|
||||
|
||||
public function __construct(array $datas = [])
|
||||
{
|
||||
// 1. [전처리] role이 배열로 들어왔다면 문자열로 변환하여 $datas 덮어쓰기
|
||||
if (isset($datas['role']) && is_array($datas['role'])) {
|
||||
$datas['role'] = implode(DEFAULTS["DELIMITER_ROLE"], $datas['role']);
|
||||
// 1. [전처리] 입력값이 문자열(CSV)로 들어왔다면 배열로 변환
|
||||
if (isset($datas['role']) && is_string($datas['role'])) {
|
||||
$datas['role'] = explode(DEFAULTS["DELIMITER_ROLE"], $datas['role']);
|
||||
}
|
||||
|
||||
// 2. 변환된 $datas를 가지고 부모(CommonDTO) 생성자 호출
|
||||
// 이제 'role'은 문자열이므로 부모 클래스의 Reflection 로직이나 타입 검사를 통과합니다.
|
||||
// 2. 만약 데이터가 없다면 빈 배열로 초기화
|
||||
if (!isset($datas['role'])) {
|
||||
$datas['role'] = [];
|
||||
}
|
||||
|
||||
// 3. 부모 생성자 호출
|
||||
parent::__construct($datas);
|
||||
}
|
||||
|
||||
/**
|
||||
* role 속성을 읽을 때 자동으로 배열로 변환해서 반환
|
||||
* DB 저장용(Entity 전달용) CSV 문자열이 필요할 때 사용합니다.
|
||||
*/
|
||||
public function __get(string $name): mixed
|
||||
public function getRoleToString(): string
|
||||
{
|
||||
// role을 요청했고, 실제 데이터가 문자열로 존재한다면 배열로 변환
|
||||
switch ($name) {
|
||||
case 'role':
|
||||
$value = is_string($this->name) ? explode(DEFAULTS["DELIMITER_ROLE"], $this->role) : [];
|
||||
break;
|
||||
default:
|
||||
// 부모에게 위임 (혹시 CommonDTO에도 __get이 있다면)
|
||||
$value = parent::__get($name);
|
||||
break;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
// role 값을 설정할 때도 배열을 받을 수 있게 하려면 __set도 필요할 수 있습니다.
|
||||
// (선택 사항)
|
||||
public function setRole(array $roles): void
|
||||
{
|
||||
$this->role = implode(DEFAULTS["DELIMITER_ROLE"], $roles);
|
||||
return implode(DEFAULTS["DELIMITER_ROLE"], $this->role);
|
||||
}
|
||||
}
|
||||
|
||||
@ -139,7 +139,7 @@ CREATE TABLE `clientinfo` (
|
||||
`account_balance` int(11) NOT NULL DEFAULT 0 COMMENT '예치금',
|
||||
`coupon_balance` int(11) NOT NULL DEFAULT 0 COMMENT '쿠폰수',
|
||||
`point_balance` int(11) NOT NULL DEFAULT 0 COMMENT '포인트',
|
||||
`status` varchar(20) NOT NULL DEFAULT 'normal',
|
||||
`status` varchar(20) NOT NULL DEFAULT 'available',
|
||||
`updated_at` timestamp NULL DEFAULT NULL,
|
||||
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
|
||||
`deleted_at` timestamp NULL DEFAULT NULL,
|
||||
@ -648,7 +648,7 @@ CREATE TABLE `serviceinfo` (
|
||||
KEY `FK_serverinfo_TO_serviceinfo` (`serverinfo_uid`),
|
||||
CONSTRAINT `FK_clientinfo_TO_serviceinfo` FOREIGN KEY (`clientinfo_uid`) REFERENCES `clientinfo` (`uid`),
|
||||
CONSTRAINT `FK_serverinfo_TO_serviceinfo` FOREIGN KEY (`serverinfo_uid`) REFERENCES `serverinfo` (`uid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=110 DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci COMMENT='서비스정보';
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=112 DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci COMMENT='서비스정보';
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
@ -776,4 +776,4 @@ UNLOCK TABLES;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2025-12-17 16:41:18
|
||||
-- Dump completed on 2025-12-18 16:54:25
|
||||
|
||||
@ -139,7 +139,7 @@ CREATE TABLE `clientinfo` (
|
||||
`account_balance` int(11) NOT NULL DEFAULT 0 COMMENT '예치금',
|
||||
`coupon_balance` int(11) NOT NULL DEFAULT 0 COMMENT '쿠폰수',
|
||||
`point_balance` int(11) NOT NULL DEFAULT 0 COMMENT '포인트',
|
||||
`status` varchar(20) NOT NULL DEFAULT 'normal',
|
||||
`status` varchar(20) NOT NULL DEFAULT 'available',
|
||||
`updated_at` timestamp NULL DEFAULT NULL,
|
||||
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
|
||||
`deleted_at` timestamp NULL DEFAULT NULL,
|
||||
@ -648,7 +648,7 @@ CREATE TABLE `serviceinfo` (
|
||||
KEY `FK_serverinfo_TO_serviceinfo` (`serverinfo_uid`),
|
||||
CONSTRAINT `FK_clientinfo_TO_serviceinfo` FOREIGN KEY (`clientinfo_uid`) REFERENCES `clientinfo` (`uid`),
|
||||
CONSTRAINT `FK_serverinfo_TO_serviceinfo` FOREIGN KEY (`serverinfo_uid`) REFERENCES `serverinfo` (`uid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=110 DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci COMMENT='서비스정보';
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=112 DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci COMMENT='서비스정보';
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
@ -776,4 +776,4 @@ UNLOCK TABLES;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2025-12-17 16:41:24
|
||||
-- Dump completed on 2025-12-18 16:54:11
|
||||
|
||||
@ -9,7 +9,17 @@ class BoardEntity extends CommonEntity
|
||||
{
|
||||
const PK = Model::PK;
|
||||
const TITLE = Model::TITLE;
|
||||
final public function getUserUID(): int|null
|
||||
protected $attributes = [
|
||||
'category' => '',
|
||||
'title' => '',
|
||||
'status' => STATUS['AVAILABLE'],
|
||||
'content' => ''
|
||||
];
|
||||
public function __construct(array|null $data = null)
|
||||
{
|
||||
parent::__construct($data);
|
||||
}
|
||||
final public function getUserUid(): int|null
|
||||
{
|
||||
return $this->attributes['user_uid'] ?? null;
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@ abstract class CommonEntity extends Entity
|
||||
{
|
||||
return $this->getTitle();
|
||||
}
|
||||
public function getStatus(): string
|
||||
final public function getStatus(): string
|
||||
{
|
||||
return $this->attributes['status'] ?? "";
|
||||
}
|
||||
|
||||
@ -8,7 +8,24 @@ class ClientEntity extends CustomerEntity
|
||||
{
|
||||
const PK = ClientModel::PK;
|
||||
const TITLE = ClientModel::TITLE;
|
||||
final public function getUserUID(): int|null
|
||||
protected $attributes = [
|
||||
'site' => SITES['prime'],
|
||||
'name' => '',
|
||||
'phone' => '',
|
||||
'email' => 'test@example.com',
|
||||
'role' => [],
|
||||
'account_balance' => 0,
|
||||
'coupon_balance' => 0,
|
||||
'point_balance' => 0,
|
||||
'status' => STATUS['AVAILABLE'],
|
||||
'history' => ''
|
||||
];
|
||||
public function __construct(array|null $data = null)
|
||||
{
|
||||
parent::__construct($data);
|
||||
}
|
||||
|
||||
final public function getUserUid(): int|null
|
||||
{
|
||||
return $this->attributes['user_uid'] ?? null;
|
||||
}
|
||||
@ -27,15 +44,15 @@ class ClientEntity extends CustomerEntity
|
||||
}
|
||||
public function getAccountBalance(): int
|
||||
{
|
||||
return $this->attributes['account_balance'];
|
||||
return $this->attributes['account_balance'] ?? 0;
|
||||
}
|
||||
public function getCouponBalance(): int
|
||||
{
|
||||
return $this->attributes['coupon_balance'];
|
||||
return $this->attributes['coupon_balance'] ?? 0;
|
||||
}
|
||||
public function getPointBalance(): int
|
||||
{
|
||||
return $this->attributes['point_balance'];
|
||||
return $this->attributes['point_balance'] ?? 0;
|
||||
}
|
||||
public function getHistory(): string|null
|
||||
{
|
||||
|
||||
@ -8,64 +8,80 @@ class ServiceEntity extends CustomerEntity
|
||||
{
|
||||
const PK = ServiceModel::PK;
|
||||
const TITLE = ServiceModel::TITLE;
|
||||
final public function getUserUID(): int|null
|
||||
protected $attributes = [
|
||||
'code' => '',
|
||||
'title' => '',
|
||||
'site' => '',
|
||||
'location' => '',
|
||||
'rack' => 0,
|
||||
'coupon_balance' => 0,
|
||||
'line' => 0,
|
||||
'billing_at' => '',
|
||||
'sale' => 0,
|
||||
'amount' => 0,
|
||||
'start_at' => '',
|
||||
'end_at' => '',
|
||||
'status' => STATUS['AVAILABLE'],
|
||||
'history' => ''
|
||||
];
|
||||
public function __construct(array|null $data = null)
|
||||
{
|
||||
parent::__construct($data);
|
||||
}
|
||||
final public function getUserUid(): int|null
|
||||
{
|
||||
return $this->attributes['user_uid'] ?? null;
|
||||
}
|
||||
final public function getClientInfoUID(): int|null
|
||||
final public function getClientInfoUid(): int|null
|
||||
{
|
||||
return $this->attributes['clientinfo_uid'] ?? null;
|
||||
}
|
||||
final public function getServerInfoUID(): int|null
|
||||
final public function getServerInfoUid(): int|null
|
||||
{
|
||||
return $this->attributes['serverinfo_uid'] ?? null;
|
||||
}
|
||||
//기본기능용
|
||||
public function getCustomTitle(mixed $title = null): string
|
||||
{
|
||||
return $this->getTitle();
|
||||
}
|
||||
final public function getCode(): string
|
||||
{
|
||||
return $this->attributes['code'];
|
||||
return $this->attributes['code'] ?? '';
|
||||
}
|
||||
final public function getSite(): string
|
||||
{
|
||||
return $this->attributes['site'];
|
||||
return $this->attributes['site'] ?? '';
|
||||
}
|
||||
final public function getLocation(): string
|
||||
{
|
||||
return $this->attributes['location'];
|
||||
return $this->attributes['location'] ?? '';
|
||||
}
|
||||
final public function getBillingAt(): string
|
||||
{
|
||||
return $this->attributes['billing_at'];
|
||||
return $this->attributes['billing_at'] ?? '';
|
||||
}
|
||||
//청구금액->기본:상면비+회선비+서버금액(price)+서버파트연결(월비용)-할인액
|
||||
//상면비
|
||||
final public function getRack(): int
|
||||
{
|
||||
return $this->attributes['rack'] ?? 0;
|
||||
}
|
||||
//회선비
|
||||
final public function getLine(): int
|
||||
{
|
||||
return $this->attributes['line'] ?? 0;
|
||||
}
|
||||
final public function getSale(): int
|
||||
{
|
||||
return $this->attributes['sale'] ?? 0;
|
||||
}
|
||||
final public function getAmount(): int
|
||||
{
|
||||
return $this->attributes['amount'];
|
||||
}
|
||||
//상면비
|
||||
final public function getRack(): int
|
||||
{
|
||||
return $this->attributes['rack'];
|
||||
}
|
||||
//회선비
|
||||
final public function getLine(): int
|
||||
{
|
||||
return $this->attributes['line'];
|
||||
return $this->attributes['amount'] ?? 0;
|
||||
}
|
||||
final public function getStartAt(): string
|
||||
{
|
||||
return $this->attributes['start_at'];
|
||||
return $this->attributes['start_at'] ?? '';
|
||||
}
|
||||
public function getHistory(): string|null
|
||||
public function getHistory(): string
|
||||
{
|
||||
return $this->attributes['history'] ?? null;
|
||||
return $this->attributes['history'] ?? '';
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,21 +8,24 @@ class AccountEntity extends WalletEntity
|
||||
{
|
||||
const PK = AccountModel::PK;
|
||||
const TITLE = AccountModel::TITLE;
|
||||
final public function getUserUID(): int|null
|
||||
public function __construct(array|null $data = null)
|
||||
{
|
||||
return $this->attributes['user_uid'] ?? null;
|
||||
}
|
||||
final public function getClientInfoUID(): int|null
|
||||
{
|
||||
return $this->attributes['clientinfo_uid'] ?? null;
|
||||
parent::__construct($data);
|
||||
$this->attributes['bank'] = '';
|
||||
$this->attributes['alias'] = '';
|
||||
$this->attributes['issue_at'] = '';
|
||||
}
|
||||
//기본기능
|
||||
public function getContent(): string|null
|
||||
public function getBank(): string
|
||||
{
|
||||
return $this->attributes['content'] ?? null;
|
||||
return $this->attributes['bank'] ?? '';
|
||||
}
|
||||
public function getAmount(): int
|
||||
public function getAlias(): string
|
||||
{
|
||||
return $this->attributes['amount'] ?? 0;
|
||||
return $this->attributes['alias'] ?? '';
|
||||
}
|
||||
public function getIssueAt(): string
|
||||
{
|
||||
return $this->attributes['issue_at'] ?? '';
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,21 +8,8 @@ class CouponEntity extends WalletEntity
|
||||
{
|
||||
const PK = CouponModel::PK;
|
||||
const TITLE = CouponModel::TITLE;
|
||||
final public function getUserUID(): int|null
|
||||
public function __construct(array|null $data = null)
|
||||
{
|
||||
return $this->attributes['user_uid'] ?? null;
|
||||
}
|
||||
final public function getClientInfoUID(): int|null
|
||||
{
|
||||
return $this->attributes['clientinfo_uid'] ?? null;
|
||||
}
|
||||
//기본기능
|
||||
public function getContent(): string|null
|
||||
{
|
||||
return $this->attributes['content'] ?? null;
|
||||
}
|
||||
public function getAmount(): int
|
||||
{
|
||||
return $this->attributes['amount'] ?? 0;
|
||||
parent::__construct($data);
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,21 +8,8 @@ class PointEntity extends WalletEntity
|
||||
{
|
||||
const PK = PointModel::PK;
|
||||
const TITLE = PointModel::TITLE;
|
||||
final public function getUserUID(): int|null
|
||||
public function __construct(array|null $data = null)
|
||||
{
|
||||
return $this->attributes['user_uid'];
|
||||
}
|
||||
final public function getClientInfoUID(): int|null
|
||||
{
|
||||
return $this->attributes['clientinfo_uid'] ?? null;
|
||||
}
|
||||
//기본기능
|
||||
public function getContent(): string|null
|
||||
{
|
||||
return $this->attributes['content'] ?? null;
|
||||
}
|
||||
public function getAmount(): int
|
||||
{
|
||||
return $this->attributes['amount'] ?? 0;
|
||||
parent::__construct($data);
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,12 +7,37 @@ use App\Entities\Customer\CustomerEntity;
|
||||
|
||||
abstract class WalletEntity extends CustomerEntity
|
||||
{
|
||||
protected $attributes = [
|
||||
'title' => '',
|
||||
'amount' => 0,
|
||||
'balance' => 0,
|
||||
'status' => STATUS['DEPOSIT'], // 기본 상태
|
||||
'content' => ''
|
||||
];
|
||||
|
||||
public function __construct(array|null $data = null)
|
||||
{
|
||||
parent::__construct($data);
|
||||
}
|
||||
final public function getUserUid(): int|null
|
||||
{
|
||||
return $this->attributes['user_uid'] ?? null;
|
||||
}
|
||||
final public function getClientInfoUid(): int|null
|
||||
{
|
||||
return $this->attributes['clientinfo_uid'] ?? null;
|
||||
}
|
||||
//기본기능
|
||||
final public function getAmount(): int
|
||||
{
|
||||
return $this->attributes['amount'] ?? 0;
|
||||
}
|
||||
final public function getBalance(): int
|
||||
{
|
||||
return $this->attributes['balance'] ?? 0;
|
||||
}
|
||||
final public function getContent(): string
|
||||
{
|
||||
return $this->attributes['content'] ?? '';
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,18 +8,29 @@ class CHASSISEntity extends EquipmentEntity
|
||||
{
|
||||
const PK = CHASSISModel::PK;
|
||||
const TITLE = CHASSISModel::TITLE;
|
||||
protected $attributes = [
|
||||
'title' => '',
|
||||
'price' => 0,
|
||||
'used' => 0,
|
||||
'stock' => 0,
|
||||
'status' => STATUS['AVAILABLE'],
|
||||
];
|
||||
public function __construct(array|null $data = null)
|
||||
{
|
||||
parent::__construct($data);
|
||||
}
|
||||
//기본기능
|
||||
public function getPrice(): int
|
||||
{
|
||||
return $this->attributes['price'];
|
||||
return $this->attributes['price'] ?? 0;
|
||||
}
|
||||
public function getStock(): int
|
||||
{
|
||||
return $this->attributes['stock'];
|
||||
return $this->attributes['stock'] ?? 0;
|
||||
}
|
||||
public function getUsed(): int
|
||||
{
|
||||
return $this->attributes['used'];
|
||||
return $this->attributes['used'] ?? 0;
|
||||
}
|
||||
public function getAvailable(): int
|
||||
{
|
||||
|
||||
@ -7,9 +7,35 @@ use App\Models\Equipment\LineModel;
|
||||
class LineEntity extends EquipmentEntity
|
||||
{
|
||||
const PK = LineModel::PK;
|
||||
protected $attributes = [
|
||||
'title' => '',
|
||||
'bandwith' => '',
|
||||
'start_at' => 0,
|
||||
'end_at' => 0,
|
||||
'status' => STATUS['AVAILABLE'],
|
||||
'content' => '',
|
||||
];
|
||||
public function __construct(array|null $data = null)
|
||||
{
|
||||
parent::__construct($data);
|
||||
}
|
||||
const TITLE = LineModel::TITLE;
|
||||
|
||||
public function getBandwith(): string
|
||||
{
|
||||
return $this->attributes['bandwith'];
|
||||
return $this->attributes['bandwith'] ?? '';
|
||||
}
|
||||
public function getStartAt(): string
|
||||
{
|
||||
return $this->attributes['start_at'] ?? '';
|
||||
}
|
||||
|
||||
public function getEndAt(): string
|
||||
{
|
||||
return $this->attributes['end_at'] ?? '';
|
||||
}
|
||||
public function getContent(): string
|
||||
{
|
||||
return $this->attributes['content'] ?? '';
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,19 +8,34 @@ class ServerEntity extends EquipmentEntity
|
||||
{
|
||||
const PK = ServerModel::PK;
|
||||
const TITLE = ServerModel::TITLE;
|
||||
final public function getClientInfoUID(): int|null
|
||||
protected $attributes = [
|
||||
'code' => '',
|
||||
'title' => '',
|
||||
'type' => '',
|
||||
'ip' => '',
|
||||
'os' => '',
|
||||
'price' => 0,
|
||||
'manufactur_at' => '',
|
||||
'format_at' => '',
|
||||
'status' => STATUS['AVAILABLE'],
|
||||
];
|
||||
public function __construct(array|null $data = null)
|
||||
{
|
||||
parent::__construct($data);
|
||||
}
|
||||
final public function getClientInfoUid(): int|null
|
||||
{
|
||||
return $this->attributes['clientinfo_uid'] ?? null;
|
||||
}
|
||||
final public function getServiceInfoUID(): int|null
|
||||
final public function getServiceInfoUid(): int|null
|
||||
{
|
||||
return $this->attributes['serviceinfo_uid'] ?? null;
|
||||
}
|
||||
final public function getChassisInfoUID(): int|null
|
||||
final public function getChassisInfoUid(): int|null
|
||||
{
|
||||
return $this->attributes['chassisinfo_uid'] ?? null;
|
||||
}
|
||||
final public function getSwitchInfoUID(): int|null
|
||||
final public function getSwitchInfoUid(): int|null
|
||||
{
|
||||
return $this->attributes['switchinfo_uid'] ?? null;
|
||||
}
|
||||
@ -31,22 +46,30 @@ class ServerEntity extends EquipmentEntity
|
||||
}
|
||||
final public function getCode(): string
|
||||
{
|
||||
return $this->attributes['code'];
|
||||
}
|
||||
public function getPrice(): int
|
||||
{
|
||||
return $this->attributes['price'];
|
||||
return $this->attributes['code'] ?? '';
|
||||
}
|
||||
public function getType(): string
|
||||
{
|
||||
return $this->attributes['type'];
|
||||
return $this->attributes['type'] ?? '';
|
||||
}
|
||||
public function getIP(): string|null
|
||||
public function getIP(): string
|
||||
{
|
||||
return $this->attributes['ip'] ?? null;
|
||||
return $this->attributes['ip'] ?? '';
|
||||
}
|
||||
public function getOS(): string|null
|
||||
public function getOS(): string
|
||||
{
|
||||
return $this->attributes['os'] ?? null;
|
||||
return $this->attributes['os'] ?? '';
|
||||
}
|
||||
public function getPrice(): int
|
||||
{
|
||||
return $this->attributes['price'] ?? 0;
|
||||
}
|
||||
public function getManufacturAt(): string
|
||||
{
|
||||
return $this->attributes['manufactur_at'] ?? '';
|
||||
}
|
||||
public function getFormatAt(): string
|
||||
{
|
||||
return $this->attributes['format_at'] ?? '';
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,22 +8,35 @@ class ServerPartEntity extends EquipmentEntity
|
||||
{
|
||||
const PK = ServerPartModel::PK;
|
||||
const TITLE = ServerPartModel::TITLE;
|
||||
final public function getServerInfoUID(): int|null
|
||||
protected $attributes = [
|
||||
'title' => '',
|
||||
'type' => '',
|
||||
'billing' => '',
|
||||
'billing_at' => '',
|
||||
'cnt' => 0,
|
||||
'amount' => 0,
|
||||
'extra' => '',
|
||||
];
|
||||
public function __construct(array|null $data = null)
|
||||
{
|
||||
return $this->attributes['serverinfo_uid'] ?? null;
|
||||
parent::__construct($data);
|
||||
}
|
||||
public function getPartUID(): int|null
|
||||
{
|
||||
return $this->attributes['part_uid'] ?? null;
|
||||
}
|
||||
final public function getClientInfoUID(): int|null
|
||||
final public function getClientInfoUid(): int|null
|
||||
{
|
||||
return $this->attributes['clientinfo_uid'] ?? null;
|
||||
}
|
||||
final public function getServiceInfoUID(): int|null
|
||||
final public function getServiceInfoUid(): int|null
|
||||
{
|
||||
return $this->attributes['serviceinfo_uid'] ?? null;
|
||||
}
|
||||
final public function getServerInfoUid(): int|null
|
||||
{
|
||||
return $this->attributes['serverinfo_uid'] ?? null;
|
||||
}
|
||||
public function getPartUid(): int|null
|
||||
{
|
||||
return $this->attributes['part_uid'] ?? null;
|
||||
}
|
||||
//기본기능용
|
||||
public function getCustomTitle(): string
|
||||
{
|
||||
@ -45,14 +58,14 @@ class ServerPartEntity extends EquipmentEntity
|
||||
{
|
||||
return $this->attributes['billing_at'];
|
||||
}
|
||||
public function getAmount(): int
|
||||
{
|
||||
return $this->attributes['amount'];
|
||||
}
|
||||
public function getCnt(): int
|
||||
{
|
||||
return $this->attributes['cnt'];
|
||||
}
|
||||
public function getAmount(): int
|
||||
{
|
||||
return $this->attributes['amount'];
|
||||
}
|
||||
public function getExtra(): string|null
|
||||
{
|
||||
return $this->attributes['extra'];
|
||||
|
||||
@ -8,14 +8,20 @@ class CPUEntity extends PartEntity
|
||||
{
|
||||
const PK = CPUModel::PK;
|
||||
const TITLE = CPUModel::TITLE;
|
||||
public function __construct(array|null $data = null)
|
||||
{
|
||||
$this->attributes['used'] = 0;
|
||||
$this->attributes['stock'] = 0;
|
||||
parent::__construct($data);
|
||||
}
|
||||
//기본기능
|
||||
public function getStock(): int
|
||||
{
|
||||
return $this->attributes['stock'];
|
||||
return $this->attributes['stock'] ?? 0;
|
||||
}
|
||||
public function getUsed(): int
|
||||
{
|
||||
return $this->attributes['used'];
|
||||
return $this->attributes['used'] ?? 0;
|
||||
}
|
||||
public function getAvailable(): int
|
||||
{
|
||||
|
||||
@ -8,27 +8,39 @@ class CSEntity extends PartEntity
|
||||
{
|
||||
const PK = CSModel::PK;
|
||||
const TITLE = CSModel::TITLE;
|
||||
public function __construct(array|null $data = null)
|
||||
{
|
||||
$this->attributes['type'] = '';
|
||||
$this->attributes['ip'] = '';
|
||||
$this->attributes['accountid'] = '';
|
||||
$this->attributes['domain'] = '';
|
||||
parent::__construct($data);
|
||||
}
|
||||
//기본기능
|
||||
final public function getClientInfoUid(): int|null
|
||||
{
|
||||
return $this->attributes['clientinfo_uid'];
|
||||
}
|
||||
final public function getServiceInfoUid(): int|null
|
||||
{
|
||||
return $this->attributes['serviceinfo_uid'];
|
||||
}
|
||||
final public function getServerInfoUid(): int|null
|
||||
{
|
||||
return $this->attributes['serverinfo_uid'];
|
||||
}
|
||||
public function getIP(): string
|
||||
{
|
||||
return $this->attributes['ip'];
|
||||
return $this->attributes['ip'] ?? '';
|
||||
}
|
||||
//기본기능
|
||||
public function getAccountID(): string|null
|
||||
public function getAccountID(): string
|
||||
{
|
||||
return $this->attributes['accountid'] ?? null;
|
||||
return $this->attributes['accountid'] ?? "";
|
||||
}
|
||||
public function getDomain(): string|null
|
||||
public function getDomain(): string
|
||||
{
|
||||
return $this->attributes['domain'] ?? null;
|
||||
return $this->attributes['domain'] ?? "";
|
||||
}
|
||||
//abstract 선언처리용
|
||||
public function getUsed(): int
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
public function getAvailable(): int
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,18 +8,25 @@ class DISKEntity extends PartEntity
|
||||
{
|
||||
const PK = DISKModel::PK;
|
||||
const TITLE = DISKModel::TITLE;
|
||||
public function __construct(array|null $data = null)
|
||||
{
|
||||
$this->attributes['used'] = 0;
|
||||
$this->attributes['stock'] = 0;
|
||||
$this->attributes['format'] = '';
|
||||
parent::__construct($data);
|
||||
}
|
||||
//기본기능
|
||||
public function getStock(): int
|
||||
{
|
||||
return $this->attributes['stock'];
|
||||
return $this->attributes['stock'] ?? 0;
|
||||
}
|
||||
public function getFormat(): int
|
||||
{
|
||||
return intval($this->attributes['format'] ?? 0);
|
||||
return $this->attributes['format'] ?? 0;
|
||||
}
|
||||
public function getUsed(): int
|
||||
{
|
||||
return $this->attributes['used'];
|
||||
return $this->attributes['used'] ?? 0;
|
||||
}
|
||||
public function getAvailable(): int
|
||||
{
|
||||
|
||||
@ -8,6 +8,11 @@ class IPEntity extends PartEntity
|
||||
{
|
||||
const PK = IPModel::PK;
|
||||
const TITLE = IPModel::TITLE;
|
||||
public function __construct(array|null $data = null)
|
||||
{
|
||||
$this->attributes['ip'] = '';
|
||||
parent::__construct($data);
|
||||
}
|
||||
public function getLineInfoUID(): int|null
|
||||
{
|
||||
return $this->attributes['lineinfo_uid'] ?? null;
|
||||
@ -16,18 +21,21 @@ class IPEntity extends PartEntity
|
||||
{
|
||||
return $this->attributes['old_clientinfo_uid'] ?? null;
|
||||
}
|
||||
final public function getClientInfoUid(): int|null
|
||||
{
|
||||
return $this->attributes['clientinfo_uid'];
|
||||
}
|
||||
final public function getServiceInfoUid(): int|null
|
||||
{
|
||||
return $this->attributes['serviceinfo_uid'];
|
||||
}
|
||||
final public function getServerInfoUid(): int|null
|
||||
{
|
||||
return $this->attributes['serverinfo_uid'];
|
||||
}
|
||||
//기본기능
|
||||
public function getIP(): string
|
||||
{
|
||||
return $this->attributes['ip'];
|
||||
}
|
||||
//abstract 선언처리용
|
||||
public function getUsed(): int
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
public function getAvailable(): int
|
||||
{
|
||||
return 0;
|
||||
return $this->attributes['ip'] ?? "";
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,24 +6,15 @@ use App\Entities\CommonEntity;
|
||||
|
||||
abstract class PartEntity extends CommonEntity
|
||||
{
|
||||
protected $attributes = [
|
||||
'title' => '',
|
||||
'price' => 0,
|
||||
'status' => STATUS['AVAILABLE'],
|
||||
];
|
||||
public function __construct(array|null $data = null)
|
||||
{
|
||||
parent::__construct($data);
|
||||
}
|
||||
abstract public function getAvailable(): int;
|
||||
abstract public function getUsed(): int;
|
||||
final public function getClientInfoUID(): int|null
|
||||
{
|
||||
return $this->attributes['clientinfo_uid'];
|
||||
}
|
||||
final public function getServiceInfoUID(): int|null
|
||||
{
|
||||
return $this->attributes['serviceinfo_uid'];
|
||||
}
|
||||
final public function getServerInfoUID(): int|null
|
||||
{
|
||||
return $this->attributes['serverinfo_uid'];
|
||||
}
|
||||
//기본기능용
|
||||
public function getCustomTitle(mixed $title = null): string
|
||||
{
|
||||
@ -31,6 +22,6 @@ abstract class PartEntity extends CommonEntity
|
||||
}
|
||||
final public function getPrice(): int
|
||||
{
|
||||
return $this->attributes['price'];
|
||||
return $this->attributes['price'] ?? 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,14 +8,20 @@ class RAMEntity extends PartEntity
|
||||
{
|
||||
const PK = RAMModel::PK;
|
||||
const TITLE = RAMModel::TITLE;
|
||||
public function __construct(array|null $data = null)
|
||||
{
|
||||
$this->attributes['used'] = 0;
|
||||
$this->attributes['stock'] = 0;
|
||||
parent::__construct($data);
|
||||
}
|
||||
//기본기능
|
||||
public function getStock(): int
|
||||
{
|
||||
return $this->attributes['stock'];
|
||||
return $this->attributes['stock'] ?? 0;
|
||||
}
|
||||
public function getUsed(): int
|
||||
{
|
||||
return $this->attributes['used'];
|
||||
return $this->attributes['used'] ?? 0;
|
||||
}
|
||||
public function getAvailable(): int
|
||||
{
|
||||
|
||||
@ -8,14 +8,20 @@ class SOFTWAREEntity extends PartEntity
|
||||
{
|
||||
const PK = SOFTWAREModel::PK;
|
||||
const TITLE = SOFTWAREModel::TITLE;
|
||||
public function __construct(array|null $data = null)
|
||||
{
|
||||
$this->attributes['used'] = 0;
|
||||
$this->attributes['stock'] = 0;
|
||||
parent::__construct($data);
|
||||
}
|
||||
//기본기능
|
||||
public function getStock(): int
|
||||
{
|
||||
return $this->attributes['stock'];
|
||||
return $this->attributes['stock'] ?? 0;
|
||||
}
|
||||
public function getUsed(): int
|
||||
{
|
||||
return $this->attributes['used'];
|
||||
return $this->attributes['used'] ?? 0;
|
||||
}
|
||||
public function getAvailable(): int
|
||||
{
|
||||
|
||||
@ -8,17 +8,25 @@ class SWITCHEntity extends PartEntity
|
||||
{
|
||||
const PK = SWITCHModel::PK;
|
||||
const TITLE = SWITCHModel::TITLE;
|
||||
public function __construct(array|null $data = null)
|
||||
{
|
||||
$this->attributes['code'] = '';
|
||||
parent::__construct($data);
|
||||
}
|
||||
final public function getClientInfoUid(): int|null
|
||||
{
|
||||
return $this->attributes['clientinfo_uid'];
|
||||
}
|
||||
final public function getServiceInfoUid(): int|null
|
||||
{
|
||||
return $this->attributes['serviceinfo_uid'];
|
||||
}
|
||||
final public function getServerInfoUid(): int|null
|
||||
{
|
||||
return $this->attributes['serverinfo_uid'];
|
||||
}
|
||||
public function getCode(): string
|
||||
{
|
||||
return $this->attributes['code'] ?? "";
|
||||
}
|
||||
//abstract 선언처리용
|
||||
public function getUsed(): int
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
public function getAvailable(): int
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,15 +9,15 @@ class PaymentEntity extends CommonEntity
|
||||
{
|
||||
const PK = PaymentModel::PK;
|
||||
const TITLE = PaymentModel::TITLE;
|
||||
final public function getUserUID(): int|null
|
||||
final public function getUserUid(): int|null
|
||||
{
|
||||
return $this->attributes['user_uid'] ?? null;
|
||||
}
|
||||
final public function getClientInfoUID(): int|null
|
||||
final public function getClientInfoUid(): int|null
|
||||
{
|
||||
return $this->attributes['clientinfo_uid'] ?? null;
|
||||
}
|
||||
final public function getServiceInfoUID(): int|null
|
||||
final public function getServiceInfoUid(): int|null
|
||||
{
|
||||
return $this->attributes['serviceinfo_uid'] ?? null;
|
||||
}
|
||||
|
||||
@ -117,7 +117,7 @@ abstract class CommonForm
|
||||
return $this->_batchjobButtons;
|
||||
}
|
||||
//Validation용
|
||||
public function validate(array $formDatas): void
|
||||
final public function validate(array $formDatas): void
|
||||
{
|
||||
if ($this->_validation === null) {
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: Validation 서비스가 초기화되지 않았습니다.");
|
||||
@ -128,7 +128,18 @@ abstract class CommonForm
|
||||
foreach ($this->getFormRules() as $field => $rule) {
|
||||
list($field, $rule) = $this->getValidationRule($field, $rule);
|
||||
$dynamicRules[$field] = $rule; // 규칙만 저장
|
||||
$dynamicLabels[$field] = $this->getFormFields()[$field];
|
||||
|
||||
// role.* 키가 getFormFields()에 없을 확률이 99%이므로 isset 체크를 합니다.
|
||||
$formFields = $this->getFormFields();
|
||||
if (isset($formFields[$field])) {
|
||||
$dynamicLabels[$field] = $formFields[$field];
|
||||
} elseif (str_contains($field, '.*')) {
|
||||
// role.* 형태라면 부모인 'role'의 레이블을 가져오거나 직접 명시
|
||||
$parentField = str_replace('.*', '', $field);
|
||||
$dynamicLabels[$field] = ($formFields[$parentField] ?? $field) . " 항목";
|
||||
} else {
|
||||
$dynamicLabels[$field] = $field; // 기본값
|
||||
}
|
||||
}
|
||||
if (!count($dynamicRules)) {
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: 지정된 Form RULE이 없습니다.");
|
||||
@ -229,14 +240,12 @@ abstract class CommonForm
|
||||
case 'user_uid':
|
||||
foreach ($this->getFormOption_process(service('userservice'), $action, $field, $formDatas) as $entity) {
|
||||
$tempOptions[$entity->getPK()] = $entity->getTitle();
|
||||
// $options['attributes'][$entity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $entity->getRole())];
|
||||
}
|
||||
$options['options'] = $tempOptions;
|
||||
break;
|
||||
case 'clientinfo_uid':
|
||||
foreach ($this->getFormOption_process(service('customer_clientservice'), $action, $field, $formDatas) as $entity) {
|
||||
$tempOptions[$entity->getPK()] = $entity->getTitle();
|
||||
// $options['attributes'][$entity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $entity->getRole())];
|
||||
}
|
||||
$options['options'] = $tempOptions;
|
||||
break;
|
||||
|
||||
@ -85,7 +85,7 @@ class ServiceHelper extends CustomerHelper
|
||||
$label,
|
||||
'modify_service',
|
||||
[
|
||||
"data-src" => "/admin/customer/service/modify/{$viewDatas['entity']->getPK()}?clientinfo_uid={$viewDatas['entity']->getClientInfoUID()}",
|
||||
"data-src" => "/admin/customer/service/modify/{$viewDatas['entity']->getPK()}?clientinfo_uid={$viewDatas['entity']->getClientInfoUid()}",
|
||||
"data-bs-toggle" => "modal",
|
||||
"data-bs-target" => "#modal_action_form",
|
||||
"class" => "text-primary form-label-sm",
|
||||
|
||||
@ -85,7 +85,7 @@ class BoardService extends CommonService
|
||||
$datas[] = [
|
||||
'title' => "<label for=\"view\" data-src=\"/admin/board/view/{$entity->getPK()}\" data-bs-toggle=\"modal\" data-bs-target=\" #modal_action_form\" class=\"text-primary form-label-sm\">{$entity->getTitle()}</label>",
|
||||
'created_at' => date('Y-m-d H:m', strtotime($entity->getCreatedAT())),
|
||||
'user' => $userEntities[$entity->getUserUID()]->getTitle(),
|
||||
'user' => $userEntities[$entity->getUserUid()]->getTitle(),
|
||||
];
|
||||
}
|
||||
return $datas;
|
||||
|
||||
@ -182,13 +182,14 @@ abstract class CommonService
|
||||
$this->getFormService()->validate($formDatas);
|
||||
// 💡 동적으로 가져온 Entity 클래스 이름으로 instanceof 검사
|
||||
$entityClass = $this->getEntityClass();
|
||||
dd($formDatas);
|
||||
$entity = new $entityClass($formDatas);
|
||||
if (!$entity instanceof $entityClass) {
|
||||
throw new RuntimeException("Return Type은 {$entityClass}만 가능");
|
||||
}
|
||||
return $this->save_process($entity);
|
||||
} catch (\Throwable $e) {
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:" . $e->getMessage() . var_export($entity));
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:" . $e->getMessage());
|
||||
}
|
||||
}
|
||||
final public function create(array $formDatas): CommonEntity
|
||||
|
||||
@ -118,7 +118,7 @@ class ServiceService extends CustomerService
|
||||
$entity->getRack(),
|
||||
$entity->getLine(),
|
||||
$entity->getSale(),
|
||||
$entity->getServerInfoUID()
|
||||
$entity->getServerInfoUid()
|
||||
);
|
||||
//총 서비스금액 설정 및 저장
|
||||
if (!$this->model->save($entity)) {
|
||||
@ -160,7 +160,7 @@ class ServiceService extends CustomerService
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:Return Type은 ServiceEntity만 가능");
|
||||
}
|
||||
//서버정보 연결
|
||||
service('equipment_serverservice')->attatchToService($entity, $entity->getServerInfoUID());
|
||||
service('equipment_serverservice')->attatchToService($entity, $entity->getServerInfoUid());
|
||||
//서비스비용 설정
|
||||
$entity = $this->updateAmount($entity);
|
||||
//결제정보 생성
|
||||
@ -185,8 +185,8 @@ class ServiceService extends CustomerService
|
||||
//기존 서비스용 결제비용 과 신규 서버스용으로 결제비용이 다르면 수정
|
||||
service('paymentservice')->modifyByService($oldEntity, $entity);
|
||||
//서버정보 연결 신규서버로 변경
|
||||
if ($oldEntity->getServerInfoUID() !== $entity->getServerInfoUID()) {
|
||||
// throw new RuntimeException("{$oldEntity->getServerInfoUID()} !== {$entity->getServerInfoUID()}");
|
||||
if ($oldEntity->getServerInfoUid() !== $entity->getServerInfoUid()) {
|
||||
// throw new RuntimeException("{$oldEntity->getServerInfoUid()} !== {$entity->getServerInfoUid()}");
|
||||
service('equipment_serverservice')->modifyByService($oldEntity, $entity);
|
||||
}
|
||||
return $entity;
|
||||
|
||||
@ -63,12 +63,12 @@ abstract class WalletService extends CustomerService
|
||||
final public function withdrawalByPayment(PaymentEntity $paymentEntity): void
|
||||
{
|
||||
//고객 정보
|
||||
$clientEntity = service('customer_clientservice')->getEntity($paymentEntity->getClientInfoUID());
|
||||
$clientEntity = service('customer_clientservice')->getEntity($paymentEntity->getClientInfoUid());
|
||||
if (!$clientEntity instanceof ClientEntity) {
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$paymentEntity->getClientInfoUID()}에 해당하는 고객정보를 찾을수 없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$paymentEntity->getClientInfoUid()}에 해당하는 고객정보를 찾을수 없습니다.");
|
||||
}
|
||||
$formDatas = [
|
||||
'clientinfo_uid' => $paymentEntity->getClientInfoUID(),
|
||||
'clientinfo_uid' => $paymentEntity->getClientInfoUid(),
|
||||
'title' => $paymentEntity->getTitle(),
|
||||
'amount' => $paymentEntity->getAmount(),
|
||||
'status' => STATUS['WITHDRAWAL'],
|
||||
|
||||
@ -79,9 +79,9 @@ class CHASSISService extends EquipmentService
|
||||
public function getPartEntityByServer(ServerEntity $serverEntity): CHASSISEntity
|
||||
{
|
||||
//IP정보에서 해당하는 IP가 있으면 가져와서 사용중인지 체크 후 수정
|
||||
$entity = $this->getEntity($serverEntity->getChassisInfoUID());
|
||||
$entity = $this->getEntity($serverEntity->getChassisInfoUid());
|
||||
if (!$entity instanceof CHASSISEntity) {
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$serverEntity->getChassisInfoUID()}에 해당하는 샷시정보를 찾을수없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$serverEntity->getChassisInfoUid()}에 해당하는 샷시정보를 찾을수없습니다.");
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
@ -89,7 +89,7 @@ class CHASSISService extends EquipmentService
|
||||
{
|
||||
//부품정보가져오기
|
||||
/** @var CHASSISEntity $entity IDE에 entity type알려주기*/
|
||||
$entity = $this->getEntity($serverEntity->getChassisInfoUID());
|
||||
$entity = $this->getEntity($serverEntity->getChassisInfoUid());
|
||||
//파트정보의 사용가능한 갯수 , 사용갯수 비교
|
||||
if ($entity->getAvailable() < 1) {
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 현재 사용가능한 {$serverEntity->getTitle()} 샷시가 없습니다.");
|
||||
@ -102,7 +102,7 @@ class CHASSISService extends EquipmentService
|
||||
{
|
||||
//부품정보가져오기
|
||||
/** @var CHASSISEntity $entity IDE에 entity type알려주기*/
|
||||
$entity = $this->getEntity($serverEntity->getChassisInfoUID());
|
||||
$entity = $this->getEntity($serverEntity->getChassisInfoUid());
|
||||
//파트정보의 사용된 갯수 , 회수용 갯수 비교
|
||||
if ($entity->getUsed() < 1) {
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 현재 사용한 {$serverEntity->getTitle()} 샷시가 없습니다.");
|
||||
|
||||
@ -91,16 +91,16 @@ class ServerPartService extends EquipmentService
|
||||
}
|
||||
//서비스정보 가져오기
|
||||
$serviceEntity = null;
|
||||
if ($serverEntity->getServiceInfoUID()) {
|
||||
$serviceEntity = service('customer_serviceservice')->getEntity($serverEntity->getServiceInfoUID());
|
||||
if ($serverEntity->getServiceInfoUid()) {
|
||||
$serviceEntity = service('customer_serviceservice')->getEntity($serverEntity->getServiceInfoUid());
|
||||
}
|
||||
//각 파트정보 가져오기
|
||||
$partEntity = $this->getPartService($formDatas['type'])->getEntity($formDatas['part_uid']);
|
||||
if (!$serviceEntity instanceof ServiceEntity) {
|
||||
}
|
||||
//해당 파트정보에 고객번호,서비스번호 설정
|
||||
$formDatas['clientinfo_uid'] = $serverEntity->getClientInfoUID();
|
||||
$formDatas['serviceinfo_uid'] = $serverEntity->getServiceInfoUID();
|
||||
$formDatas['clientinfo_uid'] = $serverEntity->getClientInfoUid();
|
||||
$formDatas['serviceinfo_uid'] = $serverEntity->getServiceInfoUid();
|
||||
//해당 파트정보의 Title을 서버파트정보의 Titlte 설정
|
||||
$formDatas['title'] = $partEntity->getTitle();
|
||||
//청구방식에 따른 결제일 설정
|
||||
@ -151,7 +151,7 @@ class ServerPartService extends EquipmentService
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:Return Type은 PaymentEntity만 가능");
|
||||
}
|
||||
//해당 파트정보가 변경
|
||||
if ($oldEntity->getPartUID() != $entity->getPartUID()) {
|
||||
if ($oldEntity->getPartUid() != $entity->getPartUid()) {
|
||||
$this->getPartService($entity->getType())->detachFromServerPart($oldEntity);
|
||||
$this->getPartService($entity->getType())->attachToServerPart($entity);
|
||||
}
|
||||
@ -177,11 +177,11 @@ class ServerPartService extends EquipmentService
|
||||
}
|
||||
//서비스가 정의 되어 있으면
|
||||
//월비용 서버파트 인경우 서비스 금액 재설정
|
||||
if ($entity->getServiceInfoUID() !== null && $entity->getBilling() == PAYMENT['BILLING']['MONTH']) {
|
||||
if ($entity->getServiceInfoUid() !== null && $entity->getBilling() == PAYMENT['BILLING']['MONTH']) {
|
||||
//서비스정보 가져오기
|
||||
$serviceEntity = service('customer_serviceservice')->getEntity($entity->getServiceInfoUID());
|
||||
$serviceEntity = service('customer_serviceservice')->getEntity($entity->getServiceInfoUid());
|
||||
if (!$serviceEntity instanceof ServiceEntity) {
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$entity->getServiceInfoUID()}에 해당하는 서비스정보를 찾을 수 없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$entity->getServiceInfoUid()}에 해당하는 서비스정보를 찾을 수 없습니다.");
|
||||
}
|
||||
service('customer_serviceservice')->updateAmount($serviceEntity);
|
||||
}
|
||||
@ -197,8 +197,8 @@ class ServerPartService extends EquipmentService
|
||||
//*서버의 Title 대소문자구분 필요->서버의 Title로 구분해서 기본부품 추가
|
||||
foreach (SERVERPART['SERVER_PARTTYPES'] as $parttype) {
|
||||
//해당 서버의 chassis_uid에 해당하는 Default값이 있는지 체크 후 서버파트 추가
|
||||
if (array_key_exists($serverEntity->getChassisInfoUID(), SERVERPART[$parttype])) {
|
||||
foreach (SERVERPART[$parttype][$serverEntity->getChassisInfoUID()] as $part) {
|
||||
if (array_key_exists($serverEntity->getChassisInfoUid(), SERVERPART[$parttype])) {
|
||||
foreach (SERVERPART[$parttype][$serverEntity->getChassisInfoUid()] as $part) {
|
||||
//해당 파트정보 가져오기
|
||||
$partEntity = $this->getPartService($parttype)->getEntity($part['UID']);
|
||||
if (!$partEntity instanceof PartEntity) {
|
||||
|
||||
@ -180,19 +180,19 @@ class ServerService extends EquipmentService
|
||||
service('part_ipservice')->attachToServer($entity);
|
||||
}
|
||||
//SWITCH변경
|
||||
if ($oldEntity->getSwitchInfoUID() !== $entity->getSwitchInfoUID()) {
|
||||
if ($oldEntity->getSwitchInfoUid() !== $entity->getSwitchInfoUid()) {
|
||||
service('part_switchservice')->detachFromServer($oldEntity);
|
||||
service('part_switchservice')->attachToServer($entity);
|
||||
}
|
||||
//샷시변경
|
||||
if ($oldEntity->getSwitchInfoUID() !== $entity->getSwitchInfoUID()) {
|
||||
if ($oldEntity->getSwitchInfoUid() !== $entity->getSwitchInfoUid()) {
|
||||
service('equipment_chassisservice')->detachFromServer($oldEntity);
|
||||
service('equipment_chassisservice')->attachToServer($entity);
|
||||
}
|
||||
if ($entity->getServiceInfoUID() !== null) { //서비스가 정의 되어 있으면
|
||||
$serviceEntity = service('customer_serviceservice')->getEntity($entity->getServiceInfoUID());
|
||||
if ($entity->getServiceInfoUid() !== null) { //서비스가 정의 되어 있으면
|
||||
$serviceEntity = service('customer_serviceservice')->getEntity($entity->getServiceInfoUid());
|
||||
if (!$serviceEntity instanceof ServiceEntity) {
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$entity->getServiceInfoUID()}에 해당하는 서비스정보을 찾을수 없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$entity->getServiceInfoUid()}에 해당하는 서비스정보을 찾을수 없습니다.");
|
||||
}
|
||||
service('customer_serviceservice')->updateAmount($serviceEntity);
|
||||
}
|
||||
@ -216,21 +216,21 @@ class ServerService extends EquipmentService
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$uid}에 해당하는 서버정보을 찾을수 없습니다.");
|
||||
}
|
||||
$formDatas['serviceinfo_uid'] = $serviceEntity->getPK();
|
||||
$formDatas["clientinfo_uid"] = $serviceEntity->getClientInfoUID();
|
||||
$formDatas["clientinfo_uid"] = $serviceEntity->getClientInfoUid();
|
||||
$formDatas['status'] = $formDatas['status'] ?? STATUS['OCCUPIED'];
|
||||
parent::modify_process($entity, $formDatas);
|
||||
}
|
||||
public function modifyByService(ServiceENtity $oldServiceEntity, ServiceEntity $serviceEntity): void
|
||||
{
|
||||
//기존 메인서버 정보
|
||||
$oldEntity = $this->getEntity($oldServiceEntity->getServerInfoUID());
|
||||
$oldEntity = $this->getEntity($oldServiceEntity->getServerInfoUid());
|
||||
if (!$oldEntity instanceof ServerEntity) {
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$oldServiceEntity->getServerInfoUID()}에 해당하는 서비스의 기존 메인 서버정보을 찾을수 없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$oldServiceEntity->getServerInfoUid()}에 해당하는 서비스의 기존 메인 서버정보을 찾을수 없습니다.");
|
||||
}
|
||||
//신규 메인서버 정보
|
||||
$entity = $this->getEntity($serviceEntity->getServerInfoUID());
|
||||
$entity = $this->getEntity($serviceEntity->getServerInfoUid());
|
||||
if (!$entity instanceof ServerEntity) {
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$serviceEntity->getServerInfoUID()}에 해당하는 서비스의 신규 메인 서버정보을 찾을수 없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$serviceEntity->getServerInfoUid()}에 해당하는 서비스의 신규 메인 서버정보을 찾을수 없습니다.");
|
||||
}
|
||||
//신규 메인서버는 기존 메인서버의 타입으로 설정 식뉴규서버는 메인서버로 추가
|
||||
$this->attatchToService($serviceEntity, $entity->getPK(), ['type' => $oldEntity->getType()]);
|
||||
|
||||
@ -78,9 +78,9 @@ class CPUService extends PartType1Service
|
||||
public function getPartEntityByServerPart(ServerPartEntity $serverPartEntity): CPUEntity
|
||||
{
|
||||
//IP정보에서 해당하는 IP가 있으면 가져와서 사용중인지 체크 후 수정
|
||||
$entity = $this->getEntity($serverPartEntity->getPartUID());
|
||||
$entity = $this->getEntity($serverPartEntity->getPartUid());
|
||||
if (!$entity instanceof CPUEntity) {
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$serverPartEntity->getPartUID()}에 해당하는 CPUEntity정보를 찾을수없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$serverPartEntity->getPartUid()}에 해당하는 CPUEntity정보를 찾을수없습니다.");
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
|
||||
@ -80,9 +80,9 @@ class CSService extends PartType2Service
|
||||
public function getPartEntityByServerPart(ServerPartEntity $serverPartEntity): CSEntity
|
||||
{
|
||||
//IP정보에서 해당하는 IP가 있으면 가져와서 사용중인지 체크 후 수정
|
||||
$entity = $this->getEntity($serverPartEntity->getPartUID());
|
||||
$entity = $this->getEntity($serverPartEntity->getPartUid());
|
||||
if (!$entity instanceof CSEntity) {
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$serverPartEntity->getPartUID()}에 해당하는 CS정보를 찾을수없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$serverPartEntity->getPartUid()}에 해당하는 CS정보를 찾을수없습니다.");
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
|
||||
@ -80,9 +80,9 @@ class DISKService extends PartType1Service
|
||||
public function getPartEntityByServerPart(ServerPartEntity $serverPartEntity): DISKEntity
|
||||
{
|
||||
//IP정보에서 해당하는 IP가 있으면 가져와서 사용중인지 체크 후 수정
|
||||
$entity = $this->getEntity($serverPartEntity->getPartUID());
|
||||
$entity = $this->getEntity($serverPartEntity->getPartUid());
|
||||
if (!$entity instanceof DISKEntity) {
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$serverPartEntity->getPartUID()}에 해당하는 DISKEntity정보를 찾을수없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$serverPartEntity->getPartUid()}에 해당하는 DISKEntity정보를 찾을수없습니다.");
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
|
||||
@ -96,7 +96,7 @@ class IPService extends PartType3Service
|
||||
{
|
||||
/** @var IPEntity $entity IDE에 entity type알려주기*/
|
||||
$entity = $this->getPartEntityByServer($serverEntity);
|
||||
$formDatas['old_clientinfo_uid'] = $entity->getClientInfoUID() ?? $serverEntity->getClientInfoUID();
|
||||
$formDatas['old_clientinfo_uid'] = $entity->getClientInfoUid() ?? $serverEntity->getClientInfoUid();
|
||||
$entity = parent::detachFromServer($serverEntity, $formDatas);
|
||||
return $entity;
|
||||
}
|
||||
@ -105,9 +105,9 @@ class IPService extends PartType3Service
|
||||
public function getPartEntityByServerPart(ServerPartEntity $serverPartEntity): IPEntity
|
||||
{
|
||||
//IP정보에서 해당하는 IP가 있으면 가져와서 사용중인지 체크 후 수정
|
||||
$entity = $this->getEntity($serverPartEntity->getPartUID());
|
||||
$entity = $this->getEntity($serverPartEntity->getPartUid());
|
||||
if (!$entity instanceof IPEntity) {
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$serverPartEntity->getPartUID()}에 해당하는 IP정보를 찾을수없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$serverPartEntity->getPartUid()}에 해당하는 IP정보를 찾을수없습니다.");
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
@ -122,7 +122,7 @@ class IPService extends PartType3Service
|
||||
{
|
||||
/** @var IPEntity $entity IDE에 entity type알려주기*/
|
||||
$entity = $this->getPartEntityByServerPart($serverPartEntity);
|
||||
$formDatas['old_clientinfo_uid'] = $entity->getClientInfoUID();
|
||||
$formDatas['old_clientinfo_uid'] = $entity->getClientInfoUid();
|
||||
$entity = parent::detachFromServerPart($serverPartEntity, $formDatas);
|
||||
return $entity;
|
||||
}
|
||||
|
||||
@ -16,9 +16,9 @@ abstract class PartType2Service extends PartService
|
||||
//서버파트관련 작업
|
||||
public function attachToServerPart(ServerPartEntity $serverPartEntity, array $formDatas = []): PartEntity
|
||||
{
|
||||
$formDatas['clientinfo_uid'] = $serverPartEntity->getClientInfoUID();
|
||||
$formDatas['serviceinfo_uid'] = $serverPartEntity->getServiceInfoUID();
|
||||
$formDatas['serverinfo_uid'] = $serverPartEntity->getServerInfoUID();
|
||||
$formDatas['clientinfo_uid'] = $serverPartEntity->getClientInfoUid();
|
||||
$formDatas['serviceinfo_uid'] = $serverPartEntity->getServiceInfoUid();
|
||||
$formDatas['serverinfo_uid'] = $serverPartEntity->getServerInfoUid();
|
||||
$formDatas['status'] = STATUS['OCCUPIED'];
|
||||
//파트정보가져오기
|
||||
$entity = $this->getPartEntityByServerPart($serverPartEntity);
|
||||
|
||||
@ -16,8 +16,8 @@ abstract class PartType3Service extends PartType2Service
|
||||
//서버관련 작업
|
||||
public function attachToServer(ServerEntity $serverEntity, array $formDatas = []): PartEntity
|
||||
{
|
||||
$formDatas['clientinfo_uid'] = $serverEntity->getClientInfoUID();
|
||||
$formDatas['serviceinfo_uid'] = $serverEntity->getServiceInfoUID();
|
||||
$formDatas['clientinfo_uid'] = $serverEntity->getClientInfoUid();
|
||||
$formDatas['serviceinfo_uid'] = $serverEntity->getServiceInfoUid();
|
||||
$formDatas['serverinfo_uid'] = $serverEntity->getPK();
|
||||
$formDatas['status'] = STATUS['OCCUPIED'];
|
||||
//파트정보가져오기
|
||||
|
||||
@ -78,9 +78,9 @@ class RAMService extends PartType1Service
|
||||
public function getPartEntityByServerPart(ServerPartEntity $serverPartEntity): RAMEntity
|
||||
{
|
||||
//IP정보에서 해당하는 IP가 있으면 가져와서 사용중인지 체크 후 수정
|
||||
$entity = $this->getEntity($serverPartEntity->getPartUID());
|
||||
$entity = $this->getEntity($serverPartEntity->getPartUid());
|
||||
if (!$entity instanceof RAMEntity) {
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$serverPartEntity->getPartUID()}에 해당하는 RAMEntity정보를 찾을수없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$serverPartEntity->getPartUid()}에 해당하는 RAMEntity정보를 찾을수없습니다.");
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
|
||||
@ -79,9 +79,9 @@ class SOFTWAREService extends PartType1Service
|
||||
public function getPartEntityByServerPart(ServerPartEntity $serverPartEntity): SOFTWAREEntity
|
||||
{
|
||||
//IP정보에서 해당하는 IP가 있으면 가져와서 사용중인지 체크 후 수정
|
||||
$entity = $this->getEntity($serverPartEntity->getPartUID());
|
||||
$entity = $this->getEntity($serverPartEntity->getPartUid());
|
||||
if (!$entity instanceof SOFTWAREEntity) {
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$serverPartEntity->getPartUID()}에 해당하는 SOFTWAREEntity정보를 찾을수없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$serverPartEntity->getPartUid()}에 해당하는 SOFTWAREEntity정보를 찾을수없습니다.");
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
|
||||
@ -81,9 +81,9 @@ class SWITCHService extends PartType3Service
|
||||
public function getPartEntityByServer(ServerEntity $serverEntity): SWITCHEntity
|
||||
{
|
||||
//IP정보에서 해당하는 IP가 있으면 가져와서 사용중인지 체크 후 수정
|
||||
$entity = $this->getEntity($serverEntity->getSwitchInfoUID());
|
||||
$entity = $this->getEntity($serverEntity->getSwitchInfoUid());
|
||||
if (!$entity instanceof SWITCHEntity) {
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$serverEntity->getSwitchInfoUID()}에 해당하는 IP정보를 찾을수없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$serverEntity->getSwitchInfoUid()}에 해당하는 IP정보를 찾을수없습니다.");
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
@ -104,9 +104,9 @@ class SWITCHService extends PartType3Service
|
||||
public function getPartEntityByServerPart(ServerPartEntity $serverPartEntity): SWITCHEntity
|
||||
{
|
||||
//IP정보에서 해당하는 IP가 있으면 가져와서 사용중인지 체크 후 수정
|
||||
$entity = $this->getEntity($serverPartEntity->getPartUID());
|
||||
$entity = $this->getEntity($serverPartEntity->getPartUid());
|
||||
if (!$entity instanceof SWITCHEntity) {
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$serverPartEntity->getPartUID()}에 해당하는 Switch정보를 찾을수없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$serverPartEntity->getPartUid()}에 해당하는 Switch정보를 찾을수없습니다.");
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
|
||||
@ -139,7 +139,7 @@ class PaymentService extends CommonService
|
||||
if (!$serviceEntity instanceof ServiceEntity) {
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$formDatas['serviceinfo_uid']}에 해당하는 서비스정보를 찾을 수 없습니다.");
|
||||
}
|
||||
$formDatas['clientinfo_uid'] = $serviceEntity->getClientInfoUID();
|
||||
$formDatas['clientinfo_uid'] = $serviceEntity->getClientInfoUid();
|
||||
$entity = parent::create_process($formDatas);
|
||||
if (!$entity instanceof PaymentEntity) {
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:Return Type은 PaymentEntity만 가능");
|
||||
@ -150,7 +150,7 @@ class PaymentService extends CommonService
|
||||
}
|
||||
//선결제인경우 서비스정보에 결제일 변경용
|
||||
if ($entity->getBilling() === PAYMENT['BILLING']['PREPAYMENT']) {
|
||||
service('customer_serviceservice')->updateBillingAt($entity->getServiceInfoUID(), $entity->getBillingAt());
|
||||
service('customer_serviceservice')->updateBillingAt($entity->getServiceInfoUid(), $entity->getBillingAt());
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
@ -167,7 +167,7 @@ class PaymentService extends CommonService
|
||||
if (!$serviceEntity instanceof ServiceEntity) {
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$formDatas['serviceinfo_uid']}에 해당하는 서비스정보를 찾을 수 없습니다.");
|
||||
}
|
||||
$formDatas['clientinfo_uid'] = $serviceEntity->getClientInfoUID();
|
||||
$formDatas['clientinfo_uid'] = $serviceEntity->getClientInfoUid();
|
||||
//수정된 결제정보
|
||||
$entity = parent::modify_process($entity, $formDatas);
|
||||
if (!$entity instanceof PaymentEntity) {
|
||||
@ -179,7 +179,7 @@ class PaymentService extends CommonService
|
||||
}
|
||||
//선결제인경우 서비스정보에 결제일 변경용
|
||||
if ($entity->getBilling() === PAYMENT['BILLING']['PREPAYMENT']) {
|
||||
service('customer_serviceservice')->updateBillingAt($entity->getServiceInfoUID(), $entity->getBillingAt());
|
||||
service('customer_serviceservice')->updateBillingAt($entity->getServiceInfoUid(), $entity->getBillingAt());
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
@ -202,9 +202,9 @@ class PaymentService extends CommonService
|
||||
];
|
||||
}
|
||||
if (!array_key_exists($serviceEntity->getPK(), $rows[$clientEntity->getPK()]['services'])) {
|
||||
$serverEntity = service('equipment_serverservice')->getEntity($serviceEntity->getServerInfoUID());
|
||||
$serverEntity = service('equipment_serverservice')->getEntity($serviceEntity->getServerInfoUid());
|
||||
if (!$serverEntity instanceof ServerEntity) {
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:[{$serviceEntity->getServerInfoUID()}]에 대한 서버정보를 찾을 수 없습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:[{$serviceEntity->getServerInfoUid()}]에 대한 서버정보를 찾을 수 없습니다.");
|
||||
}
|
||||
$rows[$clientEntity->getPK()]['services'][$serviceEntity->getPK()] = [
|
||||
'ip' => $serverEntity->getIP(),
|
||||
@ -227,7 +227,7 @@ class PaymentService extends CommonService
|
||||
private function getFormDatasFromService(ServiceEntity $serviceEntity, array $formDatas = []): array
|
||||
{
|
||||
$formDatas['serviceinfo_uid'] = $serviceEntity->getPK();
|
||||
$formDatas["clientinfo_uid"] = $serviceEntity->getClientInfoUID();
|
||||
$formDatas["clientinfo_uid"] = $serviceEntity->getClientInfoUid();
|
||||
$formDatas['amount'] = $serviceEntity->getAmount();
|
||||
$formDatas['billing'] = $formDatas['billing'] ?? PAYMENT['BILLING']['MONTH'];
|
||||
$formDatas['billing_at'] = $serviceEntity->getBillingAt();
|
||||
@ -270,11 +270,11 @@ class PaymentService extends CommonService
|
||||
//서버파트별 일회성 관련
|
||||
private function getFormDatasFromServerPart(ServerPartEntity $serverPartEntity, array $formDatas = []): array
|
||||
{
|
||||
if ($serverPartEntity->getServiceInfoUID() === null) {
|
||||
if ($serverPartEntity->getServiceInfoUid() === null) {
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: 서비스정보가 정의되지 않아 일회성 상품을 설정하실수 없습니다.");
|
||||
}
|
||||
$formDatas['serviceinfo_uid'] = $serverPartEntity->getServiceInfoUID();
|
||||
$formDatas["clientinfo_uid"] = $serverPartEntity->getClientInfoUID();
|
||||
$formDatas['serviceinfo_uid'] = $serverPartEntity->getServiceInfoUid();
|
||||
$formDatas["clientinfo_uid"] = $serverPartEntity->getClientInfoUid();
|
||||
$formDatas["serverpartinfo_uid"] = $serverPartEntity->getPK();
|
||||
$formDatas['amount'] = $serverPartEntity->getAmount();
|
||||
$formDatas['billing'] = $formDatas['billing'] ?? PAYMENT['BILLING']['ONETIME'];
|
||||
@ -286,7 +286,7 @@ class PaymentService extends CommonService
|
||||
}
|
||||
public function createByServerPart(ServerPartEntity $serverPartEntity): PaymentEntity
|
||||
{
|
||||
if ($serverPartEntity->getServiceInfoUID() === null) {
|
||||
if ($serverPartEntity->getServiceInfoUid() === null) {
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: 서비스정보가 정의되지 않아 일회성 상품을 설정하실수 없습니다.");
|
||||
}
|
||||
$formDatas = $this->getFormDatasFromServerPart($serverPartEntity);
|
||||
@ -294,13 +294,13 @@ class PaymentService extends CommonService
|
||||
}
|
||||
public function modifyByServerPart(ServerPartEntity $oldServerPartEntity, ServerPartEntity $serverPartEntity): PaymentEntity
|
||||
{
|
||||
if ($serverPartEntity->getServiceInfoUID() === null) {
|
||||
if ($serverPartEntity->getServiceInfoUid() === null) {
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: 서비스정보가 정의되지 않아 일회성 상품을 설정하실수 없습니다.");
|
||||
}
|
||||
//서버파트정보의 서비스번호가 같고, 청구방식이 onetime이고 상태가 UNPAID인 결제정보 가져와서 결제정보 수정
|
||||
$entity = $this->getEntity([
|
||||
'serverpartinfo_uid' => $oldServerPartEntity->getPK(),
|
||||
'serviceinfo_uid' => $oldServerPartEntity->getServiceInfoUID(),
|
||||
'serviceinfo_uid' => $oldServerPartEntity->getServiceInfoUid(),
|
||||
'billing' => $oldServerPartEntity->getBilling(),
|
||||
'billing_at' => $oldServerPartEntity->getBillingAt(),
|
||||
'status' => STATUS['UNPAID']
|
||||
|
||||
@ -24,9 +24,9 @@
|
||||
<?php $viewDatas['entity'] = $entity ?>
|
||||
<tr class="text-center">
|
||||
<td><?= SITES[$entity->getSite()] ?></td>
|
||||
<td nowrap><?= $viewDatas['helper']->getFieldView('clientinfo_uid', $entity->getClientInfoUID(), $viewDatas) ?></td>
|
||||
<td class="text-start"><?= $viewDatas['helper']->getFieldView('serverinfo_uid', $entity->getServerInfoUID(), $viewDatas) ?></td>
|
||||
<td nowrap><?= $viewDatas['helper']->getFieldView('user_uid', $entity->getUserUID(), $viewDatas) ?></td>
|
||||
<td nowrap><?= $viewDatas['helper']->getFieldView('clientinfo_uid', $entity->getClientInfoUid(), $viewDatas) ?></td>
|
||||
<td class="text-start"><?= $viewDatas['helper']->getFieldView('serverinfo_uid', $entity->getServerInfoUid(), $viewDatas) ?></td>
|
||||
<td nowrap><?= $viewDatas['helper']->getFieldView('user_uid', $entity->getUserUid(), $viewDatas) ?></td>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
</tbody>
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
<?php $paymentCellDatas['entity'] = $entity ?>
|
||||
<tr class="text-left">
|
||||
<td><?= $cnt ?></td>
|
||||
<td class="text-center"><?= $paymentCellDatas['helper']->getFieldView('serviceinfo_uid', $entity->getServiceInfoUID(), $paymentCellDatas) ?></td>
|
||||
<td class="text-center"><?= $paymentCellDatas['helper']->getFieldView('serviceinfo_uid', $entity->getServiceInfoUid(), $paymentCellDatas) ?></td>
|
||||
<td class="text-center">
|
||||
<?= $paymentCellDatas['helper']->getFieldView('title', $entity->getTitle(), $paymentCellDatas) ?>
|
||||
<div><?= $paymentCellDatas['helper']->getFieldView('content', $entity->getContent(), $paymentCellDatas) ?></div>
|
||||
@ -26,7 +26,7 @@
|
||||
<td class="text-center"><?= $paymentCellDatas['helper']->getFieldView('billing', $entity->getBilling(), $paymentCellDatas) ?></td>
|
||||
<td class="text-center"><?= $paymentCellDatas['helper']->getFieldView('pay', $entity->getPay(), $paymentCellDatas) ?></td>
|
||||
<td class="text-center"><?= $paymentCellDatas['helper']->getFieldView('create_at', $entity->getCreatedAt(), $paymentCellDatas) ?></td>
|
||||
<td class="text-center"><?= $paymentCellDatas['helper']->getFieldView('user_uid', $entity->getUserUID(), $paymentCellDatas) ?></td>
|
||||
<td class="text-center"><?= $paymentCellDatas['helper']->getFieldView('user_uid', $entity->getUserUid(), $paymentCellDatas) ?></td>
|
||||
<td class="text-center"><?= $paymentCellDatas['helper']->getListButton('paid', "", $paymentCellDatas) ?></td>
|
||||
</tr>
|
||||
<?php $cnt-- ?>
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
<?php $serverCellDatas['entity'] = $entity ?>
|
||||
<tr class="text-center">
|
||||
<th style="width: 250px">
|
||||
<?= $serverCellDatas['serviceEntity']->getServerInfoUID() == $entity->getPK() ? "📌" : "<a href=\"/admin/customer/service/changeServer/{$serverCellDatas['serviceEntity']->getPK()}?serverinfo_uid={$entity->getPK()}\">✔️</a>" ?>
|
||||
<?= $serverCellDatas['serviceEntity']->getServerInfoUid() == $entity->getPK() ? "📌" : "<a href=\"/admin/customer/service/changeServer/{$serverCellDatas['serviceEntity']->getPK()}?serverinfo_uid={$entity->getPK()}\">✔️</a>" ?>
|
||||
<?= $serverCellDatas['serverPartHelper']->getFieldView('SERVER', "", ['serverEntity' => $entity]) ?>
|
||||
<?= "<a href=\"/admin/customer/service/terminateServer/{$serverCellDatas['serviceEntity']->getPK()}?serverinfo_uid={$entity->getPK()}\">❌</a>" ?>
|
||||
</th>
|
||||
@ -17,7 +17,7 @@
|
||||
</tr>
|
||||
<tr class="text-center">
|
||||
<td nowrap>
|
||||
<div><?= $serverCellDatas['helper']->getFieldView('switchinfo_uid', $entity->getSwitchInfoUID(), $serverCellDatas) ?></div>
|
||||
<div><?= $serverCellDatas['helper']->getFieldView('switchinfo_uid', $entity->getSwitchInfoUid(), $serverCellDatas) ?></div>
|
||||
<div><?= $entity->getTitle() ?></div>
|
||||
<div><?= $entity->getIP() ?></div>
|
||||
<div><?= $entity->getOS() ?></div>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
$part = sprintf(
|
||||
"%s / %s / %s / %s / %s",
|
||||
$entity->getTitle(),
|
||||
$serverCellDatas['helper']->getFieldView('switchinfo_uid', $entity->getSwitchInfoUID(), $serverCellDatas),
|
||||
$serverCellDatas['helper']->getFieldView('switchinfo_uid', $entity->getSwitchInfoUid(), $serverCellDatas),
|
||||
$serverCellDatas['helper']->getFieldView('ip', $entity->getIP(), $serverCellDatas),
|
||||
$serverCellDatas['helper']->getFieldView('os', $entity->getOS(), $serverCellDatas),
|
||||
view_cell("\App\Cells\Equipment\ServerPartCell::parttable", [
|
||||
@ -20,7 +20,7 @@
|
||||
"<span class=\"serverparts\" style=\"cursor:pointer;\" onClick=\"copyServerPartToClipboard('%s')\" text-data=\"%s\">📋</span>%s%s",
|
||||
$entity->getCode() . ' / ' . $part,
|
||||
$part,
|
||||
$serverCellDatas['serviceEntity']->getServerInfoUID() == $entity->getPK() ? "📌" : "✔️",
|
||||
$serverCellDatas['serviceEntity']->getServerInfoUid() == $entity->getPK() ? "📌" : "✔️",
|
||||
$html
|
||||
) ?>
|
||||
<?php endforeach; ?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user