dbmsv4 init...3

This commit is contained in:
최준흠 2025-12-19 10:03:03 +09:00
parent c3fa7b8c1a
commit 06a57217e2
34 changed files with 160 additions and 91 deletions

View File

@ -9,7 +9,7 @@ class BoardDTO extends CommonDTO
public ?int $worker_uid = null; public ?int $worker_uid = null;
public string $category = ''; public string $category = '';
public string $title = ''; public string $title = '';
public string $status = STATUS['AVAILABLE']; public string $status = '';
public string $content = ''; public string $content = '';
public function __construct(array $datas = []) public function __construct(array $datas = [])

View File

@ -20,20 +20,36 @@ abstract class CommonDTO
$type = $property->getType(); $type = $property->getType();
$assignValue = $value; $assignValue = $value;
// 1. 빈 문자열('') 처리 로직 개선
if ($value === '') { if ($value === '') {
$assignValue = null; // 프로퍼티가 null을 허용하는 경우에만 null 할당
} elseif ($type instanceof ReflectionNamedType) { if ($type instanceof ReflectionNamedType && $type->allowsNull()) {
$assignValue = null;
} else {
// null을 허용하지 않는 경우, 타입별 기본값 지정
$typeName = ($type instanceof ReflectionNamedType) ? $type->getName() : '';
$assignValue = ($typeName === 'int' || $typeName === 'float') ? 0 : '';
}
}
// 2. 값이 존재할 때의 타입별 캐스팅 로직
elseif ($type instanceof ReflectionNamedType) {
$typeName = $type->getName(); $typeName = $type->getName();
// [추가] 타입이 array인 경우 처리 // 타입이 array이고 입력값이 문자열인 경우 (CSV -> Array)
if ($typeName === 'array' && is_string($value)) { if ($typeName === 'array' && is_string($value)) {
$assignValue = explode(DEFAULTS["DELIMITER_ROLE"], $value); $assignValue = explode(DEFAULTS["DELIMITER_ROLE"], $value);
} elseif ($typeName === 'int' && is_numeric($value)) { }
// 타입이 int이고 입력값이 숫자형인 경우
elseif ($typeName === 'int' && is_numeric($value)) {
$assignValue = (int) $value; $assignValue = (int) $value;
} }
// ... float 등 기존 로직 ... // 타입이 float이고 입력값이 숫자형인 경우
elseif ($typeName === 'float' && is_numeric($value)) {
$assignValue = (float) $value;
}
} }
// 최종 값 할당
$this->{$key} = $assignValue; $this->{$key} = $assignValue;
} }
} }

View File

@ -8,10 +8,10 @@ class ClientDTO extends CommonDTO
{ {
public ?int $uid = null; public ?int $uid = null;
public ?int $user_uid = null; public ?int $user_uid = null;
public string $site = SITES['prime']; public string $site = '';
public string $name = ''; public string $name = '';
public string $phone = ''; public string $phone = '';
public string $email = 'test@example.com'; public string $email = '';
public array $role = []; public array $role = [];
public int $account_balance = 0; public int $account_balance = 0;
public int $coupon_balance = 0; public int $coupon_balance = 0;

View File

@ -6,14 +6,14 @@ use App\DTOs\CommonDTO;
class WalletDTO extends CommonDTO class WalletDTO extends CommonDTO
{ {
final public ?int $uid = null; public ?int $uid = null;
final public ?int $user_uid = null; public ?int $user_uid = null;
final public ?int $clientinfo_uid = null; public ?int $clientinfo_uid = null;
final public string $title = ''; public string $title = '';
final public ?int $amount = 0; public ?int $amount = 0;
final public ?int $balance = 0; public ?int $balance = 0;
final public string $status = STATUS['DEPOSIT']; public string $status = '';
final public string $content = ''; public string $content = '';
public function __construct(array $datas = []) public function __construct(array $datas = [])
{ {

View File

@ -11,7 +11,7 @@ class CHASSISDTO extends CommonDTO
public int $price = 0; public int $price = 0;
public int $used = 0; public int $used = 0;
public int $stock = 0; public int $stock = 0;
public string $status = STATUS['AVAILABLE']; public string $status = '';
public function __construct(array $datas = []) public function __construct(array $datas = [])
{ {

View File

@ -11,7 +11,7 @@ class LineDTO extends CommonDTO
public string $bandwith = ''; public string $bandwith = '';
public string $start_at = ''; public string $start_at = '';
public string $end_at = ''; public string $end_at = '';
public string $status = STATUS['AVAILABLE']; public string $status = '';
public string $content = ''; public string $content = '';
public function __construct(array $datas = []) public function __construct(array $datas = [])

View File

@ -17,7 +17,7 @@ class ServerDTO extends CommonDTO
public int $price = 0; public int $price = 0;
public string $manufactur_at = ''; public string $manufactur_at = '';
public string $format_at = ''; public string $format_at = '';
public string $status = STATUS['AVAILABLE']; public string $status = '';
public function __construct(array $datas = []) public function __construct(array $datas = [])
{ {
parent::__construct($datas); parent::__construct($datas);

View File

@ -8,7 +8,7 @@ class MylogDTO extends CommonDTO
public ?int $user_uid = null; public ?int $user_uid = null;
public string $title = null; public string $title = null;
public string $content = ''; public string $content = '';
public string $status = STATUS['AVAILABLE']; public string $status = '';
public function __construct(array $datas = []) public function __construct(array $datas = [])
{ {

View File

@ -6,10 +6,10 @@ use App\DTOs\CommonDTO;
class PartDTO extends CommonDTO class PartDTO extends CommonDTO
{ {
final public ?int $uid = null; public ?int $uid = null;
final public string $title = ''; public string $title = '';
final public int $price = 0; public int $price = 0;
final public string $status = STATUS['AVAILABLE']; public string $status = '';
public function __construct(array $datas = []) public function __construct(array $datas = [])
{ {

View File

@ -16,7 +16,7 @@ class PaymentDTO extends CommonDTO
public int $billing_month = 0; public int $billing_month = 0;
public string $pay = ''; public string $pay = '';
public string $status = STATUS['UNPAID']; public string $status = STATUS['UNPAID'];
public string $content = null; public string $content = '';
public function __construct(array $datas = []) public function __construct(array $datas = [])
{ {

View File

@ -12,7 +12,7 @@ class UserDTO extends CommonDTO
public string $email = ''; public string $email = '';
public string $mobile = ''; public string $mobile = '';
public array $role = []; public array $role = [];
public string $status = STATUS['AVAILABLE']; public string $status = '';
public function __construct(array $datas = []) public function __construct(array $datas = [])
{ {

View File

@ -12,7 +12,7 @@ class BoardEntity extends CommonEntity
protected $attributes = [ protected $attributes = [
'category' => '', 'category' => '',
'title' => '', 'title' => '',
'status' => STATUS['AVAILABLE'], 'status' => '',
'content' => '' 'content' => ''
]; ];
public function __construct(array|null $data = null) public function __construct(array|null $data = null)
@ -23,4 +23,12 @@ class BoardEntity extends CommonEntity
{ {
return $this->attributes['user_uid'] ?? null; return $this->attributes['user_uid'] ?? null;
} }
final public function getWorkerUid(): int|null
{
return $this->attributes['worker_uid'] ?? null;
}
final public function getCaregory(): string
{
return $this->attributes['category'] ?? "";
}
} }

View File

@ -9,15 +9,15 @@ class ClientEntity extends CustomerEntity
const PK = ClientModel::PK; const PK = ClientModel::PK;
const TITLE = ClientModel::TITLE; const TITLE = ClientModel::TITLE;
protected $attributes = [ protected $attributes = [
'site' => SITES['prime'], 'site' => '',
'name' => '', 'name' => '',
'phone' => '', 'phone' => '',
'email' => 'test@example.com', 'email' => '',
'role' => [], 'role' => [],
'account_balance' => 0, 'account_balance' => 0,
'coupon_balance' => 0, 'coupon_balance' => 0,
'point_balance' => 0, 'point_balance' => 0,
'status' => STATUS['AVAILABLE'], 'status' => '',
'history' => '' 'history' => ''
]; ];
public function __construct(array|null $data = null) public function __construct(array|null $data = null)
@ -25,7 +25,7 @@ class ClientEntity extends CustomerEntity
parent::__construct($data); parent::__construct($data);
} }
final public function getUserUid(): int|null public function getUserUid(): int|null
{ {
return $this->attributes['user_uid'] ?? null; return $this->attributes['user_uid'] ?? null;
} }

View File

@ -21,7 +21,7 @@ class ServiceEntity extends CustomerEntity
'amount' => 0, 'amount' => 0,
'start_at' => '', 'start_at' => '',
'end_at' => '', 'end_at' => '',
'status' => STATUS['AVAILABLE'], 'status' => '',
'history' => '' 'history' => ''
]; ];
public function __construct(array|null $data = null) public function __construct(array|null $data = null)

View File

@ -8,12 +8,19 @@ class AccountEntity extends WalletEntity
{ {
const PK = AccountModel::PK; const PK = AccountModel::PK;
const TITLE = AccountModel::TITLE; const TITLE = AccountModel::TITLE;
protected $attributes = [
'title' => '',
'bank' => '',
'alias' => '',
'issue_at' => '',
'amount' => 0,
'balance' => 0,
'status' => '',
'content' => ''
];
public function __construct(array|null $data = null) public function __construct(array|null $data = null)
{ {
parent::__construct($data); parent::__construct($data);
$this->attributes['bank'] = '';
$this->attributes['alias'] = '';
$this->attributes['issue_at'] = '';
} }
//기본기능 //기본기능
public function getBank(): string public function getBank(): string

View File

@ -6,8 +6,16 @@ use App\Models\Customer\Wallet\CouponModel;
class CouponEntity extends WalletEntity class CouponEntity extends WalletEntity
{ {
const PK = CouponModel::PK; const PK = CouponModel::PK;
const TITLE = CouponModel::TITLE; const TITLE = CouponModel::TITLE;
protected $attributes = [
'title' => '',
'amount' => 0,
'balance' => 0,
'status' => '',
'content' => ''
];
public function __construct(array|null $data = null) public function __construct(array|null $data = null)
{ {
parent::__construct($data); parent::__construct($data);

View File

@ -8,6 +8,13 @@ class PointEntity extends WalletEntity
{ {
const PK = PointModel::PK; const PK = PointModel::PK;
const TITLE = PointModel::TITLE; const TITLE = PointModel::TITLE;
protected $attributes = [
'title' => '',
'amount' => 0,
'balance' => 0,
'status' => '',
'content' => ''
];
public function __construct(array|null $data = null) public function __construct(array|null $data = null)
{ {
parent::__construct($data); parent::__construct($data);

View File

@ -7,14 +7,6 @@ use App\Entities\Customer\CustomerEntity;
abstract class WalletEntity extends CustomerEntity abstract class WalletEntity extends CustomerEntity
{ {
protected $attributes = [
'title' => '',
'amount' => 0,
'balance' => 0,
'status' => STATUS['DEPOSIT'], // 기본 상태
'content' => ''
];
public function __construct(array|null $data = null) public function __construct(array|null $data = null)
{ {
parent::__construct($data); parent::__construct($data);

View File

@ -13,7 +13,7 @@ class CHASSISEntity extends EquipmentEntity
'price' => 0, 'price' => 0,
'used' => 0, 'used' => 0,
'stock' => 0, 'stock' => 0,
'status' => STATUS['AVAILABLE'], 'status' => '',
]; ];
public function __construct(array|null $data = null) public function __construct(array|null $data = null)
{ {

View File

@ -12,7 +12,7 @@ class LineEntity extends EquipmentEntity
'bandwith' => '', 'bandwith' => '',
'start_at' => 0, 'start_at' => 0,
'end_at' => 0, 'end_at' => 0,
'status' => STATUS['AVAILABLE'], 'status' => '',
'content' => '', 'content' => '',
]; ];
public function __construct(array|null $data = null) public function __construct(array|null $data = null)

View File

@ -17,7 +17,7 @@ class ServerEntity extends EquipmentEntity
'price' => 0, 'price' => 0,
'manufactur_at' => '', 'manufactur_at' => '',
'format_at' => '', 'format_at' => '',
'status' => STATUS['AVAILABLE'], 'status' => '',
]; ];
public function __construct(array|null $data = null) public function __construct(array|null $data = null)
{ {

View File

@ -21,15 +21,15 @@ class ServerPartEntity extends EquipmentEntity
{ {
parent::__construct($data); parent::__construct($data);
} }
final public function getClientInfoUid(): int|null public function getClientInfoUid(): int|null
{ {
return $this->attributes['clientinfo_uid'] ?? null; return $this->attributes['clientinfo_uid'] ?? null;
} }
final public function getServiceInfoUid(): int|null public function getServiceInfoUid(): int|null
{ {
return $this->attributes['serviceinfo_uid'] ?? null; return $this->attributes['serviceinfo_uid'] ?? null;
} }
final public function getServerInfoUid(): int|null public function getServerInfoUid(): int|null
{ {
return $this->attributes['serverinfo_uid'] ?? null; return $this->attributes['serverinfo_uid'] ?? null;
} }
@ -48,26 +48,26 @@ class ServerPartEntity extends EquipmentEntity
} }
public function getType(): string public function getType(): string
{ {
return $this->attributes['type']; return $this->attributes['type'] ?? "";
} }
public function getBilling(): string public function getBilling(): string
{ {
return $this->attributes['billing']; return $this->attributes['billing'] ?? "";
} }
public function getBillingAt(): ?string public function getBillingAt(): string
{ {
return $this->attributes['billing_at']; return $this->attributes['billing_at'] ?? "";
} }
public function getCnt(): int public function getCnt(): int
{ {
return $this->attributes['cnt']; return $this->attributes['cnt'] ?? 0;
} }
public function getAmount(): int public function getAmount(): int
{ {
return $this->attributes['amount']; return $this->attributes['amount'] ?? 0;
} }
public function getExtra(): string|null public function getExtra(): string
{ {
return $this->attributes['extra']; return $this->attributes['extra'] ?? '';
} }
} }

View File

@ -10,7 +10,7 @@ class MylogEntity extends CommonEntity
const TITLE = Model::TITLE; const TITLE = Model::TITLE;
protected $attributes = [ protected $attributes = [
'title' => '', 'title' => '',
'status' => STATUS['AVAILABLE'], 'status' => '',
'content' => '' 'content' => ''
]; ];
public function __construct(array|null $data = null) public function __construct(array|null $data = null)

View File

@ -8,10 +8,15 @@ class CPUEntity extends PartEntity
{ {
const PK = CPUModel::PK; const PK = CPUModel::PK;
const TITLE = CPUModel::TITLE; const TITLE = CPUModel::TITLE;
protected $attributes = [
'title' => '',
'used' => 0,
'price' => 0,
'stock' => 0,
'status' => '',
];
public function __construct(array|null $data = null) public function __construct(array|null $data = null)
{ {
$this->attributes['used'] = 0;
$this->attributes['stock'] = 0;
parent::__construct($data); parent::__construct($data);
} }
//기본기능 //기본기능

View File

@ -8,12 +8,16 @@ class CSEntity extends PartEntity
{ {
const PK = CSModel::PK; const PK = CSModel::PK;
const TITLE = CSModel::TITLE; const TITLE = CSModel::TITLE;
protected $attributes = [
'type' => '',
'ip' => '',
'accountid' => '',
'domain' => '',
'price' => 0,
'status' => '',
];
public function __construct(array|null $data = null) public function __construct(array|null $data = null)
{ {
$this->attributes['type'] = '';
$this->attributes['ip'] = '';
$this->attributes['accountid'] = '';
$this->attributes['domain'] = '';
parent::__construct($data); parent::__construct($data);
} }
//기본기능 //기본기능

View File

@ -8,11 +8,16 @@ class DISKEntity extends PartEntity
{ {
const PK = DISKModel::PK; const PK = DISKModel::PK;
const TITLE = DISKModel::TITLE; const TITLE = DISKModel::TITLE;
protected $attributes = [
'title' => '',
'used' => 0,
'price' => 0,
'stock' => 0,
'format' => 0,
'status' => '',
];
public function __construct(array|null $data = null) public function __construct(array|null $data = null)
{ {
$this->attributes['used'] = 0;
$this->attributes['stock'] = 0;
$this->attributes['format'] = '';
parent::__construct($data); parent::__construct($data);
} }
//기본기능 //기본기능

View File

@ -8,9 +8,16 @@ class IPEntity extends PartEntity
{ {
const PK = IPModel::PK; const PK = IPModel::PK;
const TITLE = IPModel::TITLE; const TITLE = IPModel::TITLE;
protected $attributes = [
'title' => '',
'used' => 0,
'price' => 0,
'stock' => 0,
'ip' => '',
'status' => '',
];
public function __construct(array|null $data = null) public function __construct(array|null $data = null)
{ {
$this->attributes['ip'] = '';
parent::__construct($data); parent::__construct($data);
} }
public function getLineInfoUID(): int|null public function getLineInfoUID(): int|null

View File

@ -6,11 +6,6 @@ use App\Entities\CommonEntity;
abstract class PartEntity extends CommonEntity abstract class PartEntity extends CommonEntity
{ {
protected $attributes = [
'title' => '',
'price' => 0,
'status' => STATUS['AVAILABLE'],
];
public function __construct(array|null $data = null) public function __construct(array|null $data = null)
{ {
parent::__construct($data); parent::__construct($data);

View File

@ -8,10 +8,15 @@ class RAMEntity extends PartEntity
{ {
const PK = RAMModel::PK; const PK = RAMModel::PK;
const TITLE = RAMModel::TITLE; const TITLE = RAMModel::TITLE;
protected $attributes = [
'title' => '',
'used' => 0,
'price' => 0,
'stock' => 0,
'status' => '',
];
public function __construct(array|null $data = null) public function __construct(array|null $data = null)
{ {
$this->attributes['used'] = 0;
$this->attributes['stock'] = 0;
parent::__construct($data); parent::__construct($data);
} }
//기본기능 //기본기능

View File

@ -8,10 +8,15 @@ class SOFTWAREEntity extends PartEntity
{ {
const PK = SOFTWAREModel::PK; const PK = SOFTWAREModel::PK;
const TITLE = SOFTWAREModel::TITLE; const TITLE = SOFTWAREModel::TITLE;
protected $attributes = [
'title' => '',
'used' => 0,
'price' => 0,
'stock' => 0,
'status' => '',
];
public function __construct(array|null $data = null) public function __construct(array|null $data = null)
{ {
$this->attributes['used'] = 0;
$this->attributes['stock'] = 0;
parent::__construct($data); parent::__construct($data);
} }
//기본기능 //기본기능

View File

@ -8,6 +8,11 @@ class SWITCHEntity extends PartEntity
{ {
const PK = SWITCHModel::PK; const PK = SWITCHModel::PK;
const TITLE = SWITCHModel::TITLE; const TITLE = SWITCHModel::TITLE;
protected $attributes = [
'code' => 0,
'price' => 0,
'status' => '',
];
public function __construct(array|null $data = null) public function __construct(array|null $data = null)
{ {
$this->attributes['code'] = ''; $this->attributes['code'] = '';

View File

@ -16,7 +16,7 @@ class PaymentEntity extends CommonEntity
'billing_at' => "", 'billing_at' => "",
'billing_month' => 0, 'billing_month' => 0,
'pay' => "", 'pay' => "",
'status' => STATUS['AVAILABLE'], 'status' => '',
'content' => '' 'content' => ''
]; ];
public function __construct(array|null $data = null) public function __construct(array|null $data = null)

View File

@ -22,7 +22,7 @@ class UserEntity extends CommonEntity
'email' => "", 'email' => "",
'mobile' => '', 'mobile' => '',
'role' => "", 'role' => "",
'status' => STATUS['AVAILABLE'], 'status' => '',
]; ];
public function __construct(array|null $data = null) public function __construct(array|null $data = null)
{ {

View File

@ -54,39 +54,39 @@ class ClientHelper extends CustomerHelper
break; break;
case 'account_balance': case 'account_balance':
$value = form_label( $value = form_label(
number_format(intval($value)) . "", number_format($value) . "",
'index', $field,
[ [
"data-src" => "/admin/customer/wallet/account?clientinfo_uid={$viewDatas['entity']->getPK()}", "data-src" => "/admin/customer/wallet/account?clientinfo_uid={$viewDatas['entity']->getPK()}&ActionTemplate=popup",
"data-bs-toggle" => "modal", "data-bs-toggle" => "modal",
"data-bs-target" => "#modal_action_form", "data-bs-target" => "#modal_action_form",
"class" => "btn btn-sm form-label-sm text-primary", "class" => "text-primary",
...$extras, ...$extras,
] ]
); );
break; break;
case 'coupon_balance': case 'coupon_balance':
$value = form_label( $value = form_label(
number_format(intval($value)) . "", number_format($value) . "",
'index', $field,
[ [
"data-src" => "/admin/customer/wallet/coupon?clientinfo_uid={$viewDatas['entity']->getPK()}", "data-src" => "/admin/customer/wallet/coupon?clientinfo_uid={$viewDatas['entity']->getPK()}&ActionTemplate=popup",
"data-bs-toggle" => "modal", "data-bs-toggle" => "modal",
"data-bs-target" => "#modal_action_form", "data-bs-target" => "#modal_action_form",
"class" => "btn btn-sm form-label-sm text-primary", "class" => "text-primary",
...$extras, ...$extras,
] ]
); );
break; break;
case 'point_balance': case 'point_balance':
$value = form_label( $value = form_label(
number_format(intval($value)) . "", number_format($value) . "",
'index', $field,
[ [
"data-src" => "/admin/customer/wallet/point?clientinfo_uid={$viewDatas['entity']->getPK()}", "data-src" => "/admin/customer/wallet/point?clientinfo_uid={$viewDatas['entity']->getPK()}&ActionTemplate=popup",
"data-bs-toggle" => "modal", "data-bs-toggle" => "modal",
"data-bs-target" => "#modal_action_form", "data-bs-target" => "#modal_action_form",
"class" => "btn btn-sm form-label-sm text-primary", "class" => "text-primary",
...$extras, ...$extras,
] ]
); );