dbms_init...1
This commit is contained in:
parent
78847dac70
commit
ee0f5c8e38
@ -7,23 +7,31 @@ use CodeIgniter\HTTP\RequestInterface;
|
|||||||
|
|
||||||
use CodeIgniter\HTTP\ResponseInterface;
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
use App\Services\Customer\ServiceService;
|
||||||
|
|
||||||
abstract class CustomerController extends AdminController
|
abstract class CustomerController extends AdminController
|
||||||
{
|
{
|
||||||
|
private ?ServiceService $_serviceService = null;
|
||||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||||
{
|
{
|
||||||
parent::initController($request, $response, $logger);
|
parent::initController($request, $response, $logger);
|
||||||
}
|
}
|
||||||
|
public function getServiceService(): ServiceService
|
||||||
|
{
|
||||||
|
if (!$this->_serviceService) {
|
||||||
|
$this->_serviceService = new ServiceService($this->request);
|
||||||
|
}
|
||||||
|
return $this->_serviceService;
|
||||||
|
}
|
||||||
//Index,FieldForm관련
|
//Index,FieldForm관련
|
||||||
|
|
||||||
//Service,ServicePaymentController사용
|
//Service,ServicePaymentController사용
|
||||||
//LINE,IP,SERVER등 추가 FilterOption 셋팅용
|
//LINE,IP,SERVER등 추가 FilterOption 셋팅용
|
||||||
final protected function setFilterOptionsByItemType(): void
|
final protected function setFilterOptionsByItemType(): void
|
||||||
{
|
{
|
||||||
|
//LINE,IP,SERVER등 추가 FilterOption 셋팅용
|
||||||
foreach (SERVICE_ITEM_TYPES as $item_type => $label) {
|
foreach (SERVICE_ITEM_TYPES as $item_type => $label) {
|
||||||
$options = $this->getService()->getServiceItemLinkService($item_type)->getEntities();
|
$this->setFilterFieldOption($item_type, $this->getServiceService()->getFilterOptionsByItemType($item_type));
|
||||||
$this->setFilterFieldOption($item_type, $options);
|
}
|
||||||
}
|
|
||||||
// dd($this->getFilterFieldOptions());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,9 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Controllers\Admin\Customer;
|
namespace App\Controllers\Admin\Customer;
|
||||||
|
|
||||||
use App\Entities\Customer\ServiceEntity;
|
|
||||||
use App\Helpers\Customer\ServiceHelper;
|
use App\Helpers\Customer\ServiceHelper;
|
||||||
use App\Services\Customer\ServiceItemService;
|
|
||||||
use App\Services\Customer\ServiceService;
|
use App\Services\Customer\ServiceService;
|
||||||
|
|
||||||
use App\Services\Equipment\CodeService;
|
use App\Services\Equipment\CodeService;
|
||||||
@ -16,7 +14,6 @@ use Psr\Log\LoggerInterface;
|
|||||||
class ServiceController extends CustomerController
|
class ServiceController extends CustomerController
|
||||||
{
|
{
|
||||||
private ?CodeService $_codeService = null;
|
private ?CodeService $_codeService = null;
|
||||||
private ?ServiceItemService $_serviceItemService = null;
|
|
||||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||||
{
|
{
|
||||||
parent::initController($request, $response, $logger);
|
parent::initController($request, $response, $logger);
|
||||||
@ -47,13 +44,6 @@ class ServiceController extends CustomerController
|
|||||||
}
|
}
|
||||||
return $this->_codeService;
|
return $this->_codeService;
|
||||||
}
|
}
|
||||||
public function getServiceItemService(): ServiceItemService
|
|
||||||
{
|
|
||||||
if (!$this->_serviceItemService) {
|
|
||||||
$this->_serviceItemService = new ServiceItemService($this->request);
|
|
||||||
}
|
|
||||||
return $this->_serviceItemService;
|
|
||||||
}
|
|
||||||
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
|
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
|
||||||
{
|
{
|
||||||
switch ($this->getAction()) {
|
switch ($this->getAction()) {
|
||||||
@ -68,24 +58,12 @@ class ServiceController extends CustomerController
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
//Index,FieldForm관련
|
//Index,FieldForm관련
|
||||||
|
|
||||||
//Service마다 ItemEntities 설정용
|
|
||||||
private function setItemEntitiesByService(ServiceEntity $entity): ServiceEntity
|
|
||||||
{
|
|
||||||
foreach (SERVICE_ITEM_TYPES as $item_type => $label) {
|
|
||||||
$entity->setItemEntities(
|
|
||||||
$item_type,
|
|
||||||
$this->getServiceItemService()->getEntities(['serviceinfo_uid' => $entity->getPK(), 'item_type' => $item_type])
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return $entity;
|
|
||||||
}
|
|
||||||
//View 관련
|
//View 관련
|
||||||
protected function view_process(mixed $entity): mixed
|
protected function view_process(mixed $entity): mixed
|
||||||
{
|
{
|
||||||
//LINE,IP,SERVER등 추가 FilterOption 셋팅용
|
//LINE,IP,SERVER등 추가 FilterOption 셋팅용
|
||||||
$this->setFilterOptionsByItemType();
|
$this->setFilterOptionsByItemType();
|
||||||
return $this->setItemEntitiesByService($entity);
|
return $this->getService()->setItemEntitiesByService($entity);
|
||||||
}
|
}
|
||||||
//List 관련
|
//List 관련
|
||||||
protected function setWordConditionForList(): void
|
protected function setWordConditionForList(): void
|
||||||
@ -105,7 +83,7 @@ class ServiceController extends CustomerController
|
|||||||
$this->setFilterOptionsByItemType();
|
$this->setFilterOptionsByItemType();
|
||||||
$entities = [];
|
$entities = [];
|
||||||
foreach (parent::index_process() as $entity) {
|
foreach (parent::index_process() as $entity) {
|
||||||
$entities[$entity->getPK()] = $this->setItemEntitiesByService($entity);
|
$entities[$entity->getPK()] = $this->getService()->setItemEntitiesByService($entity);
|
||||||
}
|
}
|
||||||
return $entities;
|
return $entities;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -69,17 +69,21 @@ class Home extends AdminController
|
|||||||
{
|
{
|
||||||
$this->initAction(__FUNCTION__);
|
$this->initAction(__FUNCTION__);
|
||||||
//최근 inverval(default : 7일)일간 신규서버 정보
|
//최근 inverval(default : 7일)일간 신규서버 정보
|
||||||
|
//LINE,IP,SERVER등 추가 FilterOption 셋팅용
|
||||||
|
foreach (SERVICE_ITEM_TYPES as $item_type => $label) {
|
||||||
|
$this->setFilterFieldOption($item_type, $this->getService()->getFilterOptionsByItemType($item_type));
|
||||||
|
}
|
||||||
$this->interval = intval($this->request->getVar('interval') ?? SERVICE_NEW_INTERVAL);
|
$this->interval = intval($this->request->getVar('interval') ?? SERVICE_NEW_INTERVAL);
|
||||||
$this->newServiceEntities = $this->getService()->getEntitiesByNewService($this->interval);
|
$entities = [];
|
||||||
|
foreach ($this->getService()->getEntitiesByNewService($this->interval) as $entity) {
|
||||||
|
$entities[$entity->getPK()] = $this->getService()->setItemEntitiesByService($entity);
|
||||||
|
}
|
||||||
|
$this->newServiceEntities = $entities;
|
||||||
$this->newServiceCount = count($this->newServiceEntities);
|
$this->newServiceCount = count($this->newServiceEntities);
|
||||||
|
|
||||||
//미납 서버 정보
|
//미납 서버 정보
|
||||||
$this->unPaidEntities = $this->getServicePaymentService()->getEntitiesByUnPaid();
|
$this->unPaidEntities = $this->getServicePaymentService()->getEntitiesByUnPaid();
|
||||||
$this->unPaidCount = count($this->unPaidEntities);
|
$this->unPaidCount = count($this->unPaidEntities);
|
||||||
//LINE,IP,SERVER등 추가 FilterOption 셋팅용
|
|
||||||
foreach (SERVICE_ITEM_TYPES as $item_type => $label) {
|
|
||||||
$options = $this->getService()->getServiceItemLinkService($item_type)->getEntities();
|
|
||||||
$this->setFilterFieldOption($item_type, $options);
|
|
||||||
}
|
|
||||||
helper(['form']);
|
helper(['form']);
|
||||||
return $this->getResultSuccess();
|
return $this->getResultSuccess();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,7 @@ use App\Entities\Customer\ServiceEntity;
|
|||||||
use App\Entities\Equipment\CodeEntity;
|
use App\Entities\Equipment\CodeEntity;
|
||||||
use App\Models\Customer\ServiceModel;
|
use App\Models\Customer\ServiceModel;
|
||||||
|
|
||||||
|
use App\Services\Customer\ServiceItemService;
|
||||||
use App\Services\Equipment\CodeService;
|
use App\Services\Equipment\CodeService;
|
||||||
use App\Services\UserService;
|
use App\Services\UserService;
|
||||||
|
|
||||||
@ -13,6 +14,7 @@ class ServiceService extends CustomerService
|
|||||||
{
|
{
|
||||||
private ?UserService $_userService = null;
|
private ?UserService $_userService = null;
|
||||||
private ?CodeService $_codeService = null;
|
private ?CodeService $_codeService = null;
|
||||||
|
private ?ServiceItemService $_serviceItemService = null;
|
||||||
private ?ServicePaymentService $_servicePaymentService = null;
|
private ?ServicePaymentService $_servicePaymentService = null;
|
||||||
private ?string $_searchIP = null;
|
private ?string $_searchIP = null;
|
||||||
public function __construct(mixed $request = null)
|
public function __construct(mixed $request = null)
|
||||||
@ -70,6 +72,13 @@ class ServiceService extends CustomerService
|
|||||||
}
|
}
|
||||||
return $this->_codeService;
|
return $this->_codeService;
|
||||||
}
|
}
|
||||||
|
public function getServiceItemService(): ServiceItemService
|
||||||
|
{
|
||||||
|
if (!$this->_serviceItemService) {
|
||||||
|
$this->_serviceItemService = new ServiceItemService($this->request);
|
||||||
|
}
|
||||||
|
return $this->_serviceItemService;
|
||||||
|
}
|
||||||
public function getServicePaymentService(): ServicePaymentService
|
public function getServicePaymentService(): ServicePaymentService
|
||||||
{
|
{
|
||||||
if (!$this->_servicePaymentService) {
|
if (!$this->_servicePaymentService) {
|
||||||
@ -118,6 +127,23 @@ class ServiceService extends CustomerService
|
|||||||
}
|
}
|
||||||
return $options;
|
return $options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//ItemType에 따른 FilterOption 설정용
|
||||||
|
public function getFilterOptionsByItemType(string $item_type): array
|
||||||
|
{
|
||||||
|
return $this->getServiceItemLinkService($item_type)->getEntities();
|
||||||
|
}
|
||||||
|
//Service마다 ItemEntities 설정용
|
||||||
|
public function setItemEntitiesByService(ServiceEntity $entity): ServiceEntity
|
||||||
|
{
|
||||||
|
foreach (SERVICE_ITEM_TYPES as $item_type => $label) {
|
||||||
|
$entity->setItemEntities(
|
||||||
|
$item_type,
|
||||||
|
$this->getServiceItemService()->getEntities(['serviceinfo_uid' => $entity->getPK(), 'item_type' => $item_type])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return $entity;
|
||||||
|
}
|
||||||
//interval을 기준으로 신규서비스 가져오기
|
//interval을 기준으로 신규서비스 가져오기
|
||||||
final public function getEntitiesByNewService(int $interval, string $status = DEFAULTS['STATUS'])
|
final public function getEntitiesByNewService(int $interval, string $status = DEFAULTS['STATUS'])
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user