dbmsv2_init...1
This commit is contained in:
parent
6de94c5607
commit
4f99fda98e
@ -2,29 +2,28 @@
|
||||
|
||||
namespace App\Cells\Equipment;
|
||||
|
||||
use App\Services\Equipment\PartService;
|
||||
use App\Services\Part\DISKService;
|
||||
|
||||
class PartCell extends EquipmentCell
|
||||
class DISKCell extends EquipmentCell
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(new PartService());
|
||||
parent::__construct(new DISKService());
|
||||
}
|
||||
|
||||
public function parttable(array $params): string
|
||||
public function stock(array $params): string
|
||||
{
|
||||
$this->getService()->setAction(__FUNCTION__);
|
||||
$this->getService()->setFormFields();
|
||||
$this->getService()->setFormFilters();
|
||||
$this->getService()->setFormRules();
|
||||
$this->getService()->setFormOptions();
|
||||
$types = array_key_exists('types', $params) ? $params['types'] : SERVERPART['STOCK_PARTTYPES'];
|
||||
$template = array_key_exists('template', $params) ? $params['template'] : __FUNCTION__;
|
||||
$template = array_key_exists('template', $params) ? $params['template'] : 'disk_stock';
|
||||
return view('cells/part/' . $template, [
|
||||
'partCellDatas' => [
|
||||
'control' => $this->getService()->getControlDatas(),
|
||||
'service' => $this->getService(),
|
||||
'entities' => $this->getService()->getEntities("type IN (" . "'" . implode("','", $types) . "'" . ")"),
|
||||
'entities' => $this->getService()->getEntities(),
|
||||
],
|
||||
]);
|
||||
}
|
||||
30
app/Cells/Part/RAMCell.php
Normal file
30
app/Cells/Part/RAMCell.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Cells\Equipment;
|
||||
|
||||
use App\Services\Part\RAMService;
|
||||
|
||||
class RAMCell extends EquipmentCell
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(new RAMService());
|
||||
}
|
||||
|
||||
public function stock(array $params): string
|
||||
{
|
||||
$this->getService()->setAction(__FUNCTION__);
|
||||
$this->getService()->setFormFields();
|
||||
$this->getService()->setFormFilters();
|
||||
$this->getService()->setFormRules();
|
||||
$this->getService()->setFormOptions();
|
||||
$template = array_key_exists('template', $params) ? $params['template'] : 'ram_stock';
|
||||
return view('cells/part/' . $template, [
|
||||
'partCellDatas' => [
|
||||
'control' => $this->getService()->getControlDatas(),
|
||||
'service' => $this->getService(),
|
||||
'entities' => $this->getService()->getEntities(),
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -234,7 +234,7 @@ define('ICONS', [
|
||||
'SERVER_ITEM_CPU' => '<i class="bi bi-cpu"></i>',
|
||||
'SERVER_ITEM_RAM' => '<i class="bi bi-memory"></i>',
|
||||
'SERVER_ITEM_DISK' => '<i class="bi bi-device-hdd"></i>',
|
||||
'SERVER_ITEM_SWITCH' => '<i class="bi bi-diagram-3"></i>',
|
||||
'SERVER_ITEM_Switch' => '<i class="bi bi-diagram-3"></i>',
|
||||
'SERVER_ITEM_OS' => '<i class="bi bi-microsoft"></i>',
|
||||
'SERVER_ITEM_DB' => '<i class="bi bi-database"></i>',
|
||||
'SERVER_ITEM_SOFTWARE' => '<i class="bi bi-window-sidebar"></i>',
|
||||
@ -404,7 +404,7 @@ define("SERVICE", [
|
||||
//서버파트 관련
|
||||
define("SERVERPART", [
|
||||
"CNT_RANGE" => array_combine(range(1, 10), range(1, 10)),
|
||||
"STOCK_PARTTYPES" => ['CPU', 'RAM', 'DISK'],
|
||||
"STOCK_PARTTYPES" => ['RAM', 'DISK'],
|
||||
"SERVER_PARTTYPES" => ['CPU', 'RAM', 'DISK'],
|
||||
"SERVICE_PARTTYPES" => ['Switch', 'IP', 'OS', 'SOFTWARE', 'CS'],
|
||||
"ALL_PARTTYPES" => ['CPU', 'RAM', 'DISK', 'OS', 'SOFTWARE', 'Switch', 'IP', 'CS'],
|
||||
|
||||
@ -29,22 +29,6 @@ class ClientController extends CustomerController
|
||||
return $this->_service;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
//생성관련
|
||||
protected function create_process(array $formDatas): ClientEntity
|
||||
{
|
||||
//생성 전처리, 관리자 UID는 현재 인증된 사용자로 설정
|
||||
$formDatas['user_uid'] = $this->getService()->getMyAuth()->getUIDByAuthInfo();
|
||||
//생성처리
|
||||
return parent::create_process($formDatas);
|
||||
}
|
||||
//수정관련
|
||||
protected function modify_process(mixed $entity, array $formDatas): ClientEntity
|
||||
{
|
||||
//수정 전처리, 관리자 UID는 현재 인증된 사용자로 설정
|
||||
$formDatas['user_uid'] = $this->getService()->getMyAuth()->getUIDByAuthInfo();
|
||||
//수정처리
|
||||
return parent::modify_process($entity, $formDatas);
|
||||
}
|
||||
protected function doValidation(Validation $validation, string $field, string $rule): Validation
|
||||
{
|
||||
switch ($field) {
|
||||
|
||||
@ -29,17 +29,4 @@ class CouponController extends CustomerController
|
||||
return $this->_service;
|
||||
}
|
||||
//Index,FieldForm관련.
|
||||
protected function create_process(array $formDatas): CouponEntity
|
||||
{
|
||||
// 관리자 UID는 현재 인증된 사용자로 설정
|
||||
$formDatas['user_uid'] = $this->getService()->getMyAuth()->getUIDByAuthInfo();
|
||||
return parent::create_process($formDatas);
|
||||
}
|
||||
//수정관련
|
||||
protected function modify_process(mixed $entity, array $formDatas): CouponEntity
|
||||
{
|
||||
// 관리자 UID는 현재 인증된 사용자로 설정
|
||||
$formDatas['user_uid'] = $this->getService()->getMyAuth()->getUIDByAuthInfo();
|
||||
return parent::modify_process($entity, $formDatas);
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,20 +59,6 @@ class PaymentController extends CustomerController
|
||||
return $result;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
//생성관련
|
||||
protected function create_process(array $formDatas): PaymentEntity
|
||||
{
|
||||
// 관리자 UID는 현재 인증된 사용자로 설정
|
||||
$formDatas['user_uid'] = $this->getService()->getMyAuth()->getUIDByAuthInfo();
|
||||
return parent::create_process($formDatas);
|
||||
}
|
||||
//수정관련
|
||||
protected function modify_process(mixed $entity, array $formDatas): PaymentEntity
|
||||
{
|
||||
// 관리자 UID는 현재 인증된 사용자로 설정
|
||||
$formDatas['user_uid'] = $this->getService()->getMyAuth()->getUIDByAuthInfo();
|
||||
return parent::modify_process($entity, $formDatas);
|
||||
}
|
||||
//Invoice 관련
|
||||
private function invoice_process(): array
|
||||
{
|
||||
|
||||
@ -29,17 +29,4 @@ class PointController extends CustomerController
|
||||
return $this->_service;
|
||||
}
|
||||
//Index,FieldForm관련.
|
||||
protected function create_process(array $formDatas): PointEntity
|
||||
{
|
||||
// 관리자 UID는 현재 인증된 사용자로 설정
|
||||
$formDatas['user_uid'] = $this->getService()->getMyAuth()->getUIDByAuthInfo();
|
||||
return parent::create_process($formDatas);
|
||||
}
|
||||
//수정관련
|
||||
protected function modify_process(mixed $entity, array $formDatas): PointEntity
|
||||
{
|
||||
// 관리자 UID는 현재 인증된 사용자로 설정
|
||||
$formDatas['user_uid'] = $this->getService()->getMyAuth()->getUIDByAuthInfo();
|
||||
return parent::modify_process($entity, $formDatas);
|
||||
}
|
||||
}
|
||||
|
||||
@ -78,19 +78,6 @@ class ServiceController extends CustomerController
|
||||
$this->getService()->setFormDatas($formDatas);
|
||||
parent::create_form_process();
|
||||
}
|
||||
protected function create_process(array $formDatas): ServiceEntity
|
||||
{
|
||||
// 관리자 UID는 현재 인증된 사용자로 설정
|
||||
$formDatas['user_uid'] = $this->getService()->getMyAuth()->getUIDByAuthInfo();
|
||||
return parent::create_process($formDatas);
|
||||
}
|
||||
//수정관련
|
||||
protected function modify_process(mixed $entity, array $formDatas): ServiceEntity
|
||||
{
|
||||
// 관리자 UID는 현재 인증된 사용자로 설정
|
||||
$formDatas['user_uid'] = $this->getService()->getMyAuth()->getUIDByAuthInfo();
|
||||
return parent::modify_process($entity, $formDatas);
|
||||
}
|
||||
//List 관련
|
||||
protected function index_process(array $entities = []): array
|
||||
{
|
||||
|
||||
@ -57,7 +57,7 @@ class ServerPartEntity extends EquipmentEntity
|
||||
{
|
||||
return $this->getPartEntity() !== null ? $this->getPartEntity()->getPrice() : 0;
|
||||
}
|
||||
public function getCaculatedAmount(): int
|
||||
public function getTotalAmount(): int
|
||||
{
|
||||
return $this->getAmount() * $this->getCnt();
|
||||
}
|
||||
|
||||
@ -3,10 +3,10 @@
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
use App\Libraries\LogCollector;
|
||||
|
||||
abstract class CommonModel extends Model
|
||||
{
|
||||
private $_myAuth = null;
|
||||
protected $table = '';
|
||||
protected $primaryKey = '';
|
||||
protected $useAutoIncrement = true;
|
||||
@ -65,6 +65,13 @@ abstract class CommonModel extends Model
|
||||
// protected $beforeInsert = ['generateUUID'];
|
||||
// allowedFields에는 PK넣으면 않됨, Column Type: CHAR(36)
|
||||
//
|
||||
final public function getMyAuth(): mixed
|
||||
{
|
||||
if (!$this->_myAuth) {
|
||||
$this->_myAuth = service('myauth');
|
||||
}
|
||||
return $this->_myAuth;
|
||||
}
|
||||
final protected function generateUUID(): string
|
||||
{
|
||||
$data = random_bytes(16);
|
||||
@ -73,12 +80,6 @@ abstract class CommonModel extends Model
|
||||
$data[8] = chr(ord($data[8]) & 0x3f | 0x80); // variant 10
|
||||
return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
|
||||
}
|
||||
// final public function getLastestCode(string $format, int $default): string
|
||||
// {
|
||||
// $entity = $this->selectMax($this->primaryKey)->first();
|
||||
// $pk = (int) ($entity->getPK() ?? $default); // 정수로 강제 변환
|
||||
// return sprintf($format, date('ymd'), $pk + 1);
|
||||
// }
|
||||
public function getFormRule(string $action, string $field): string
|
||||
{
|
||||
if (is_array($field)) {
|
||||
|
||||
@ -53,4 +53,18 @@ class AccountModel extends CustomerModel
|
||||
}
|
||||
return $rule;
|
||||
}
|
||||
|
||||
final public function create(array $formDatas): AccountEntity
|
||||
{
|
||||
// 관리자 UID는 현재 인증된 사용자로 설정
|
||||
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
||||
return parent::create($formDatas);
|
||||
}
|
||||
//수정
|
||||
final public function modify(mixed $entity, array $formDatas): AccountEntity
|
||||
{
|
||||
// 관리자 UID는 현재 인증된 사용자로 설정
|
||||
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
||||
return parent::modify($entity, $formDatas);
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,9 +68,18 @@ class ClientModel extends CustomerModel
|
||||
return $rule;
|
||||
}
|
||||
//입력전 코드처리
|
||||
public function create(array $formDatas): ClientEntity
|
||||
final public function create(array $formDatas): ClientEntity
|
||||
{
|
||||
$formDatas['code'] = $formDatas['site'] . "_c" . uniqid();
|
||||
// 관리자 UID는 현재 인증된 사용자로 설정
|
||||
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
||||
return parent::create($formDatas);
|
||||
}
|
||||
//수정
|
||||
final public function modify(mixed $entity, array $formDatas): ClientEntity
|
||||
{
|
||||
// 관리자 UID는 현재 인증된 사용자로 설정
|
||||
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
||||
return parent::modify($entity, $formDatas);
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,4 +45,17 @@ class CouponModel extends CustomerModel
|
||||
}
|
||||
return $rule;
|
||||
}
|
||||
final public function create(array $formDatas): CouponEntity
|
||||
{
|
||||
// 관리자 UID는 현재 인증된 사용자로 설정
|
||||
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
||||
return parent::create($formDatas);
|
||||
}
|
||||
//수정
|
||||
final public function modify(mixed $entity, array $formDatas): CouponEntity
|
||||
{
|
||||
// 관리자 UID는 현재 인증된 사용자로 설정
|
||||
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
||||
return parent::modify($entity, $formDatas);
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,4 +45,17 @@ class PointModel extends CustomerModel
|
||||
}
|
||||
return $rule;
|
||||
}
|
||||
final public function create(array $formDatas): PointEntity
|
||||
{
|
||||
// 관리자 UID는 현재 인증된 사용자로 설정
|
||||
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
||||
return parent::create($formDatas);
|
||||
}
|
||||
//수정
|
||||
final public function modify(mixed $entity, array $formDatas): PointEntity
|
||||
{
|
||||
// 관리자 UID는 현재 인증된 사용자로 설정
|
||||
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
||||
return parent::modify($entity, $formDatas);
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,9 +77,18 @@ class ServiceModel extends CustomerModel
|
||||
return $rule;
|
||||
}
|
||||
//입력전 코드처리
|
||||
public function create(array $formDatas): ServiceEntity
|
||||
final public function create(array $formDatas): ServiceEntity
|
||||
{
|
||||
$formDatas['code'] = $formDatas['site'] . "_s" . uniqid();
|
||||
// 관리자 UID는 현재 인증된 사용자로 설정
|
||||
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
||||
return parent::create($formDatas);
|
||||
}
|
||||
//수정
|
||||
final public function modify(mixed $entity, array $formDatas): ServiceEntity
|
||||
{
|
||||
// 관리자 UID는 현재 인증된 사용자로 설정
|
||||
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
||||
return parent::modify($entity, $formDatas);
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,4 +61,18 @@ class PaymentModel extends CommonModel
|
||||
}
|
||||
return $rule;
|
||||
}
|
||||
|
||||
final public function create(array $formDatas): PaymentEntity
|
||||
{
|
||||
// 관리자 UID는 현재 인증된 사용자로 설정
|
||||
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
||||
return parent::create($formDatas);
|
||||
}
|
||||
//수정
|
||||
final public function modify(mixed $entity, array $formDatas): PaymentEntity
|
||||
{
|
||||
// 관리자 UID는 현재 인증된 사용자로 설정
|
||||
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
||||
return parent::modify($entity, $formDatas);
|
||||
}
|
||||
}
|
||||
|
||||
@ -142,7 +142,7 @@ abstract class CommonService
|
||||
$this->setControlDatas('field_optons', $options);
|
||||
}
|
||||
//Entity별로 작업처리시
|
||||
protected function getEntity_process(object $entity): mixed
|
||||
protected function getEntity_process(mixed $entity): mixed
|
||||
{
|
||||
return $entity;
|
||||
}
|
||||
|
||||
@ -65,19 +65,9 @@ class AccountService extends CustomerService
|
||||
//생성
|
||||
public function create(array $formDatas): AccountEntity
|
||||
{
|
||||
// 관리자 UID는 현재 인증된 사용자로 설정
|
||||
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
||||
$this->setBalance($formDatas);
|
||||
return parent::create($formDatas);
|
||||
}
|
||||
//수정
|
||||
public function modify(mixed $entity, array $formDatas): AccountEntity
|
||||
{
|
||||
// 관리자 UID는 현재 인증된 사용자로 설정
|
||||
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
||||
$this->setBalance($formDatas);
|
||||
return parent::modify($entity, $formDatas);
|
||||
}
|
||||
//List 검색용
|
||||
public function index_condition_filterWord(string $word): void
|
||||
{
|
||||
|
||||
@ -28,7 +28,7 @@ class PaymentService extends ParentService implements ServiceInterface
|
||||
public function createService(ServiceEntity $serviceEntity): ServiceEntity
|
||||
{
|
||||
//필수정보처리 후 결제정보등록
|
||||
$entity = parent::create($this->action_process($serviceEntity));
|
||||
$entity = $this->getModel()->create($this->action_process($serviceEntity));
|
||||
//서비스정보 Entity에 결제정보 설정
|
||||
return $serviceEntity->setPaymentEntity($entity);
|
||||
}
|
||||
@ -44,7 +44,7 @@ class PaymentService extends ParentService implements ServiceInterface
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: 완료된 결제는 수정이 불가합니다.");
|
||||
}
|
||||
//필수정보처리 후 결제정보수정
|
||||
$entity = parent::modify($entity, $this->action_process($serviceEntity));
|
||||
$entity = $this->getModel()->modify($entity, $this->action_process($serviceEntity));
|
||||
//서비스정보 Entity에 결제정보 설정
|
||||
return $serviceEntity->setPaymentEntity($entity);
|
||||
}
|
||||
|
||||
@ -13,7 +13,6 @@ class ServerService extends ParentService implements ServiceInterface
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
private function action_process(ServiceEntity $serviceEntity, array $formDatas = []): ServerEntity
|
||||
{
|
||||
if (!array_key_exists('status', $formDatas)) {
|
||||
@ -25,7 +24,7 @@ class ServerService extends ParentService implements ServiceInterface
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: 서비스정보[{$serviceEntity->getPK()}]에 해당하는 서버정보를 찾을수없습니다.");
|
||||
}
|
||||
//서버정보 수정
|
||||
return parent::modify($entity, $formDatas);
|
||||
return $this->getModel()->modify($entity, $formDatas);
|
||||
}
|
||||
public function createService(ServiceEntity $serviceEntity): ServiceEntity
|
||||
{
|
||||
|
||||
@ -212,20 +212,16 @@ class ServiceService extends CustomerService
|
||||
) WHERE billing_at = ? AND status = ?";
|
||||
return $this->getModel()->query($sql, [$billing_at, $status]);
|
||||
}
|
||||
final public function getCaculatedAmount(int $uid): int
|
||||
final public function getCaculatedAmount(ServiceEntity $entity): int
|
||||
{
|
||||
$entity = $this->getEntity($uid);
|
||||
if (!$entity instanceof ServiceEntity) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생:[{$uid}]에 대한 서비스정보를 찾을수 없습니다.");
|
||||
}
|
||||
$summary_amount = $entity->getRack() + $entity->getLine() + $entity->getServerEntity()->getPrice(); //기본:상면비+회선비+서버금액(price)+서버파트연결(월비용)
|
||||
$caculatedAmount = $entity->getRack() + $entity->getLine() + $entity->getServerEntity()->getPrice(); //기본:상면비+회선비+서버금액(price)+서버파트연결(월비용)
|
||||
//해당 서비스(서버) 관련 결제방식(Billing)이 Month인 ServerPart 전체를 다시 검사하여 월청구액을 합산한다.
|
||||
foreach ($this->getServerPartService()->getEntities(['serverinfo_uid' => $entity->getServerEntity()->getPK()]) as $serverPartEntity) {
|
||||
if ($serverPartEntity->getBilling() === PAYMENT['BILLING']['MONTH']) { //월비용일때만 적용
|
||||
$summary_amount += $serverPartEntity->getCaculatedAmount(); //단가*Cnt
|
||||
$caculatedAmount += $serverPartEntity->getTotalAmount(); //단가*Cnt
|
||||
}
|
||||
}
|
||||
return $summary_amount;
|
||||
return $caculatedAmount;
|
||||
}
|
||||
//기본 기능부분
|
||||
//FieldForm관련용
|
||||
@ -280,10 +276,7 @@ class ServiceService extends CustomerService
|
||||
$entity->getServerService()->deleteService($entity);
|
||||
}
|
||||
//수정작업(월청구액계산 확인 후 서비스정보에 수정)
|
||||
$entity = parent::modify(
|
||||
$entity,
|
||||
['amount' => $this->getCaculatedAmount($entity->getPK())]
|
||||
);
|
||||
$entity = parent::modify($entity, ['amount' => $this->getCaculatedAmount($entity)]);
|
||||
//후처리작업
|
||||
return $this->action_process($entity, __FUNCTION__ . 'Service');
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@ class ServerPartService extends ParentService implements ServerInterface
|
||||
{
|
||||
//기존 ServerPart정보 삭제
|
||||
foreach ($this->getEntities(['serverinfo_uid' => $serverEntity->getPK()]) as $serverPartEntity) {
|
||||
parent::delete($serverPartEntity);
|
||||
$this->getModel()->delete($serverPartEntity);
|
||||
}
|
||||
return $serverEntity;
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ class ServiceService extends ParentService implements ServerInterface
|
||||
throw new \Exception("[{$serverEntity->getServiceInfoUID()}]에 대한 서비스정보를 찾을수 없습니다.");
|
||||
}
|
||||
//서비스금액은 modify 함수내에서 재계산을 하므로 여기서는 modify만 호출함
|
||||
return parent::modify($entity, []);
|
||||
return $this->getModel()->modify($entity, []);
|
||||
}
|
||||
public function createServer(ServerEntity $serverEntity): ServerEntity
|
||||
{
|
||||
|
||||
@ -33,7 +33,7 @@ class CPUService extends ParentService implements ServerPartInterface
|
||||
}
|
||||
$formDatas['stock'] = $entity->getStock() - $serverPartEntity->getCnt();
|
||||
}
|
||||
return parent::modify($entity, $formDatas);
|
||||
return $this->getModel()->modify($entity, $formDatas);
|
||||
}
|
||||
|
||||
public function createServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity
|
||||
|
||||
@ -26,7 +26,7 @@ class CSService extends ParentService implements ServerPartInterface
|
||||
throw new \Exception("{$serverPartEntity->getPartUID()}에 해당하는 CS정보를 찾을수없습니다.");
|
||||
}
|
||||
//CS정보 수정
|
||||
return parent::modify($entity, $formDatas);
|
||||
return $this->getModel()->modify($entity, $formDatas);
|
||||
}
|
||||
public function createServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity
|
||||
{
|
||||
|
||||
@ -33,7 +33,7 @@ class DISKService extends ParentService implements ServerPartInterface
|
||||
}
|
||||
$formDatas['stock'] = $entity->getStock() - $serverPartEntity->getCnt();
|
||||
}
|
||||
return parent::modify($entity, $formDatas);
|
||||
return $this->getModel()->modify($entity, $formDatas);
|
||||
}
|
||||
|
||||
public function createServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity
|
||||
|
||||
@ -26,7 +26,7 @@ class IPService extends ParentService implements ServerPartInterface
|
||||
throw new \Exception("{$serverPartEntity->getPartUID()}에 해당하는 IP정보를 찾을수없습니다.");
|
||||
}
|
||||
//IP정보 수정
|
||||
return parent::modify($entity, $formDatas);
|
||||
return $this->getModel()->modify($entity, $formDatas);
|
||||
}
|
||||
public function createServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity
|
||||
{
|
||||
|
||||
@ -33,7 +33,7 @@ class OSService extends ParentService implements ServerPartInterface
|
||||
}
|
||||
$formDatas['stock'] = $entity->getStock() - $serverPartEntity->getCnt();
|
||||
}
|
||||
return parent::modify($entity, $formDatas);
|
||||
return $this->getModel()->modify($entity, $formDatas);
|
||||
}
|
||||
|
||||
public function createServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity
|
||||
|
||||
@ -29,7 +29,7 @@ class PaymentService extends ParentService implements ServerPartInterface
|
||||
$formDatas['serverinfo_uid'] = $serverPartEntity->getServerInfoUID(); //서버연결정보 수정시에 필요함
|
||||
//타이틀은 기타의 경우 직접작성한 제목을 등록하고 아닌경우는 Part의 Title을 사용한다.
|
||||
$formDatas['title'] = $serverPartEntity->getPartEntity()->getTitle();
|
||||
$formDatas['amount'] = $serverPartEntity->getCaculatedAmount(); //단가*cnt
|
||||
$formDatas['amount'] = $serverPartEntity->getTotalAmount(); //단가*cnt
|
||||
$formDatas['billing'] = $serverPartEntity->getBilling();
|
||||
return $formDatas;
|
||||
}
|
||||
@ -40,7 +40,7 @@ class PaymentService extends ParentService implements ServerPartInterface
|
||||
//당일결체일로 설정
|
||||
$formDatas['billing_at'] = date("Y-m-d");
|
||||
//결제정보등록
|
||||
$entity = parent::create($formDatas);
|
||||
$entity = $this->getModel()->create($formDatas);
|
||||
//서버연결정보 Entity에 결제정보 설정
|
||||
return $serverPartEntity->setPaymentEntity($entity);
|
||||
}
|
||||
@ -58,7 +58,7 @@ class PaymentService extends ParentService implements ServerPartInterface
|
||||
//필수정보처리 후 FormData 가져오기
|
||||
$formDatas = $this->action_process($serverPartEntity);
|
||||
//결제정보수정
|
||||
$entity = parent::modify($entity, $formDatas);
|
||||
$entity = $this->getModel()->modify($entity, $formDatas);
|
||||
//서버연결정보 Entity에 결제정보 설정
|
||||
return $serverPartEntity->setPaymentEntity($entity);
|
||||
}
|
||||
|
||||
@ -33,7 +33,7 @@ class RAMService extends ParentService implements ServerPartInterface
|
||||
}
|
||||
$formDatas['stock'] = $entity->getStock() - $serverPartEntity->getCnt();
|
||||
}
|
||||
return parent::modify($entity, $formDatas);
|
||||
return $this->getModel()->modify($entity, $formDatas);
|
||||
}
|
||||
|
||||
public function createServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity
|
||||
|
||||
@ -33,7 +33,7 @@ class SOFTWAREService extends ParentService implements ServerPartInterface
|
||||
}
|
||||
$formDatas['stock'] = $entity->getStock() - $serverPartEntity->getCnt();
|
||||
}
|
||||
return parent::modify($entity, $formDatas);
|
||||
return $this->getModel()->modify($entity, $formDatas);
|
||||
}
|
||||
|
||||
public function createServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity
|
||||
|
||||
@ -22,7 +22,7 @@ class ServiceService extends ParentService implements ServerPartInterface
|
||||
throw new \Exception("[{$serverPartEntity->getServiceInfoUID()}]에 대한 서비스정보를 찾을수 없습니다.");
|
||||
}
|
||||
//서비스금액은 modify 함수내에서 재계산을 하므로 여기서는 modify만 호출함
|
||||
return parent::modify($entity, []);
|
||||
return $this->getModel()->modify($entity, []);
|
||||
}
|
||||
public function createServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity
|
||||
{
|
||||
|
||||
@ -26,7 +26,7 @@ class SwitchService extends ParentService implements ServerPartInterface
|
||||
throw new \Exception("{$serverPartEntity->getPartUID()}에 해당하는 Switch정보를 찾을수없습니다.");
|
||||
}
|
||||
//Switch정보 수정
|
||||
return parent::modify($entity, $formDatas);
|
||||
return $this->getModel()->modify($entity, $formDatas);
|
||||
}
|
||||
public function createServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity
|
||||
{
|
||||
|
||||
@ -131,20 +131,6 @@ class PaymentService extends CommonService
|
||||
return $options;
|
||||
}
|
||||
//Action 기능
|
||||
//생성
|
||||
final public function create(array $formDatas): PaymentEntity
|
||||
{
|
||||
// 관리자 UID는 현재 인증된 사용자로 설정
|
||||
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
||||
return parent::create($formDatas);
|
||||
}
|
||||
//수정
|
||||
final public function modify(mixed $entity, array $formDatas): PaymentEntity
|
||||
{
|
||||
// 관리자 UID는 현재 인증된 사용자로 설정
|
||||
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
||||
return parent::modify($entity, $formDatas);
|
||||
}
|
||||
//List 검색용
|
||||
//OrderBy 처리
|
||||
final public function setOrderBy(mixed $field = null, mixed $value = null): void
|
||||
|
||||
@ -8,6 +8,9 @@
|
||||
</ul>
|
||||
</div>
|
||||
<div style="border-left: 1px solid black; border-right: 1px solid black; padding:20px;">
|
||||
<?= view_cell("\App\Cells\Equipment\PartCell::parttable", ['types' => SERVERPART['STOCK_PARTTYPES']]) ?>
|
||||
<table class="index_table data table table-bordered table-hover table-striped" data-rtc-resizable-table="reisze_table">
|
||||
<?= view_cell("\App\Cells\Part\RAMCell::stock") ?>
|
||||
<?= view_cell("\App\Cells\Part\DISKCell::stock") ?>
|
||||
</table>
|
||||
</div>
|
||||
<div class="layout_footer"></div>
|
||||
7
app/Views/cells/part/disk_stock.php
Normal file
7
app/Views/cells/part/disk_stock.php
Normal file
@ -0,0 +1,7 @@
|
||||
<?php foreach ($partCellDatas['entities'] as $entity): ?>
|
||||
<?php $partCellDatas['entity'] = $entity; ?>
|
||||
<?php foreach (['title', 'stock'] as $field): ?>
|
||||
<td><?= $partCellDatas['service']->getHelper()->getFieldView($field, $entity->$field, $partCellDatas) ?></td>
|
||||
<?php endforeach ?>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
@ -1,11 +0,0 @@
|
||||
<table class="index_table data table table-bordered table-hover table-striped" data-rtc-resizable-table="reisze_table">
|
||||
<?php $cnt = 0 ?>
|
||||
<?php foreach ($partCellDatas['entities'] as $entity): ?>
|
||||
<?php $partCellDatas['entity'] = $entity; ?>
|
||||
<?php foreach (['title', 'stock'] as $field): ?>
|
||||
<td><?= $partCellDatas['service']->getHelper()->getFieldView($field, $entity->$field, $partCellDatas) ?></td>
|
||||
<?php endforeach ?>
|
||||
</tr>
|
||||
<?php $cnt++ ?>
|
||||
<?php endforeach ?>
|
||||
</table>
|
||||
7
app/Views/cells/part/ram_stock.php
Normal file
7
app/Views/cells/part/ram_stock.php
Normal file
@ -0,0 +1,7 @@
|
||||
<?php foreach ($partCellDatas['entities'] as $entity): ?>
|
||||
<?php $partCellDatas['entity'] = $entity; ?>
|
||||
<?php foreach (['title', 'stock'] as $field): ?>
|
||||
<td><?= $partCellDatas['service']->getHelper()->getFieldView($field, $entity->$field, $partCellDatas) ?></td>
|
||||
<?php endforeach ?>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
@ -6,7 +6,7 @@
|
||||
<?php $serverPartCellDatas['entity'] = $entity ?>
|
||||
<?php $htmls[$type][] = [
|
||||
'view' => $serverPartCellDatas['service']->getHelper()->getFieldView($type, $entity->getPK(), $serverPartCellDatas),
|
||||
'amount' => $entity->getCaculatedAmount()
|
||||
'amount' => $entity->getTotalAmount()
|
||||
] ?>
|
||||
<?php endforeach ?>
|
||||
<?php endforeach ?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user