46 lines
1.5 KiB
PHP
46 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers\Admin\Equipment;
|
|
|
|
use App\Entities\Equipment\ServerPartEntity;
|
|
use CodeIgniter\HTTP\RequestInterface;
|
|
use CodeIgniter\HTTP\ResponseInterface;
|
|
use Psr\Log\LoggerInterface;
|
|
|
|
class ServerPartController extends EquipmentController
|
|
{
|
|
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
|
{
|
|
parent::initController($request, $response, $logger);
|
|
if ($this->service === null) {
|
|
$this->service = service('equipment_serverpartservice');
|
|
}
|
|
$this->addActionPaths('serverpart');
|
|
}
|
|
protected function getEntityClass(): string
|
|
{
|
|
return ServerPartEntity::class;
|
|
}
|
|
//기본 함수 작업
|
|
//Custom 추가 함수
|
|
protected function create_form_process(array $formDatas = []): array
|
|
{
|
|
// Form Default값 설정 (오버라이드 포인트)
|
|
$formDatas = parent::create_form_process($formDatas);
|
|
$formDatas['serverinfo_uid'] = $this->request->getVar('serverinfo_uid') ?? throw new \Exception("ServerPart는 반드시 서버정보가 필요합니다.");
|
|
$formDatas['type'] = $this->request->getVar('type') ?? throw new \Exception("ServerPart는 반드시 파트형식 필요합니다.");
|
|
$formDatas['cnt'] = 1;
|
|
//type : CS,IP이면 월비용 기본처리
|
|
switch ($formDatas['type']) {
|
|
case 'CS':
|
|
case 'IP':
|
|
$formDatas['billing'] = PAYMENT['BILLING']['MONTH'];
|
|
break;
|
|
default:
|
|
$formDatas['billing'] = PAYMENT['BILLING']['ONETIME'];
|
|
break;
|
|
}
|
|
return $formDatas;
|
|
}
|
|
}
|