dbms_init...1

This commit is contained in:
choi.jh 2025-06-23 11:40:52 +09:00
parent 0e4120f0e0
commit 47d879f578
12 changed files with 166 additions and 365 deletions

View File

@ -2,20 +2,17 @@
namespace App\Controllers\Admin\Customer; namespace App\Controllers\Admin\Customer;
use App\Entities\Customer\ServiceItemEntity;
use CodeIgniter\HTTP\RedirectResponse; use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface; use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use App\Helpers\Customer\ServicePaymentHelper; use App\Helpers\Customer\ServiceHelper;
use App\Services\Customer\ServiceService; use App\Services\Customer\ServiceService;
use App\Services\Customer\ServiceItemService;
use App\Services\Equipment\CodeService; use App\Services\Equipment\CodeService;
class ServiceController extends CustomerController class ServiceController extends CustomerController
{ {
private ?ServiceItemService $_serviceItemService = null;
private ?CodeService $_codeService = null; private ?CodeService $_codeService = null;
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{ {
@ -33,10 +30,10 @@ class ServiceController extends CustomerController
} }
return $this->_service; return $this->_service;
} }
public function getHelper(): ServicePaymentHelper public function getHelper(): ServiceHelper
{ {
if (!$this->_helper) { if (!$this->_helper) {
$this->_helper = new ServicePaymentHelper($this->request); $this->_helper = new ServiceHelper($this->request);
} }
return $this->_helper; return $this->_helper;
} }
@ -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()) {
@ -87,17 +77,6 @@ class ServiceController extends CustomerController
$this->setFilterFieldOption($item_type, $options); $this->setFilterFieldOption($item_type, $options);
} }
// dd($this->getFilterFieldOptions()); // dd($this->getFilterFieldOptions());
$entities = []; return parent::index_process();
foreach (parent::index_process() as $entity) {
foreach (SERVICE_ITEM_TYPES as $item_type => $label) {
$entity->setItemEntities(
$item_type,
$this->getServiceItemService()->getEntities(['serviceinfo_uid' => $entity->getPK(), 'item_type' => $item_type])
);
}
$entities[] = $entity;
}
// $entities = parent::index_process();
return $entities;
} }
} }

View File

@ -13,7 +13,7 @@ use Psr\Log\LoggerInterface;
class Home extends AdminController class Home extends AdminController
{ {
private $_service = null; private $_service = null;
private ?ServiceService $_serviceService = null; private ?ServicePaymentService $_servicePaymentService = 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);
@ -24,10 +24,10 @@ class Home extends AdminController
} }
final public function getService(): ServicePaymentService final public function getService(): ServiceService
{ {
if (!$this->_service) { if (!$this->_service) {
$this->_service = new ServicePaymentService($this->request); $this->_service = new ServiceService($this->request);
} }
return $this->_service; return $this->_service;
} }
@ -38,12 +38,12 @@ class Home extends AdminController
} }
return $this->_helper; return $this->_helper;
} }
final public function getServiceService(): ServiceService final public function getServicePaymentService(): ServicePaymentService
{ {
if (!$this->_serviceService) { if (!$this->_servicePaymentService) {
$this->_serviceService = new ServiceService($this->request); $this->_servicePaymentService = new ServicePaymentService($this->request);
} }
return $this->_serviceService; return $this->_servicePaymentService;
} }
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
{ {
@ -64,19 +64,17 @@ class Home extends AdminController
} }
return $result; return $result;
} }
//Index,FieldForm관련 //Index,FieldForm관련
public function index(): RedirectResponse|string public function index(): RedirectResponse|string
{ {
$this->initAction(__FUNCTION__); $this->initAction(__FUNCTION__);
//신규서비스정보 //최근 inverval(default : 7일)일간 신규서버 정보
$this->interval = $this->request->getVar('interval') ?? SERVICE_NEW_INTERVAL; $this->interval = intval($this->request->getVar('interval') ?? SERVICE_NEW_INTERVAL);
$this->newServiceEntities = $this->getServiceService()->getNewService(intval($this->interval)); $this->newServiceEntities = $this->getService()->getEntitiesByNewService($this->interval);
$this->newServiceCount = count($this->newServiceEntities); $this->newServiceCount = count($this->newServiceEntities);
//미납 서버 정보
//미지금서버Count $this->unPaidEntities = $this->getServicePaymentService()->getEntitiesByUnPaid();
$this->item_type = $this->request->getVar('item_type') ?? SERVICE_UNPAID_ITEM_TYPE; $this->unPaidCount = count($this->unPaidEntities);
$this->unPaidCount = $this->getService()->getUnPaid($this->item_type);
//LINE,IP,SERVER등 추가 FilterOption 셋팅용 //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(); $options = $this->getService()->getServiceItemLinkService($item_type)->getEntities();

View File

@ -4,13 +4,13 @@
"settings": { "settings": {
"width": 3000, "width": 3000,
"height": 3000, "height": 3000,
"scrollTop": -898.5025, "scrollTop": -876.1692,
"scrollLeft": -208.0376, "scrollLeft": -874.0376,
"zoomLevel": 0.73, "zoomLevel": 0.73,
"show": 511, "show": 511,
"database": 4, "database": 4,
"databaseName": "", "databaseName": "",
"canvasType": "ERD", "canvasType": "@dineug/erd-editor/builtin-schema-sql",
"language": 1, "language": 1,
"tableNameCase": 4, "tableNameCase": 4,
"columnNameCase": 2, "columnNameCase": 2,
@ -66,7 +66,8 @@
"ocWjncqwtYkP02mw4A0-8", "ocWjncqwtYkP02mw4A0-8",
"6oBuPqT-ikPI7X8a05Trv", "6oBuPqT-ikPI7X8a05Trv",
"Hj5AZkoYGvM_syvnqMeOi", "Hj5AZkoYGvM_syvnqMeOi",
"dgALp3F5aQw7gy6h_Ejcl" "dgALp3F5aQw7gy6h_Ejcl",
"cRqZmxohkCGd_FTkg1rhI"
], ],
"indexIds": [], "indexIds": [],
"memoIds": [] "memoIds": []
@ -766,6 +767,7 @@
"N_yJVoCN4oUEDhYqdzApb", "N_yJVoCN4oUEDhYqdzApb",
"NzxkmndrTbH7xb6fbnGV7", "NzxkmndrTbH7xb6fbnGV7",
"f1hR1JRFHBHwiJSSX34gw", "f1hR1JRFHBHwiJSSX34gw",
"Vf3bNvvEPfu1zCs4rcHTU",
"O7aGU_LJxCO1NeNVWbB-J", "O7aGU_LJxCO1NeNVWbB-J",
"SGWWOOHjCF81V4O5tUiJu", "SGWWOOHjCF81V4O5tUiJu",
"uuDbJDSDQLey7Km1W9hlJ", "uuDbJDSDQLey7Km1W9hlJ",
@ -792,6 +794,7 @@
"GLfHynBuy8Bzby9_5oRkq", "GLfHynBuy8Bzby9_5oRkq",
"Fx2k158yi9P2l5An09ae1", "Fx2k158yi9P2l5An09ae1",
"f1hR1JRFHBHwiJSSX34gw", "f1hR1JRFHBHwiJSSX34gw",
"Vf3bNvvEPfu1zCs4rcHTU",
"O7aGU_LJxCO1NeNVWbB-J", "O7aGU_LJxCO1NeNVWbB-J",
"SGWWOOHjCF81V4O5tUiJu", "SGWWOOHjCF81V4O5tUiJu",
"uuDbJDSDQLey7Km1W9hlJ", "uuDbJDSDQLey7Km1W9hlJ",
@ -808,7 +811,7 @@
"ocQDEPy6SoxLZr91fT335" "ocQDEPy6SoxLZr91fT335"
], ],
"ui": { "ui": {
"x": 934.3741, "x": 935.744,
"y": 1028.673, "y": 1028.673,
"zIndex": 2395, "zIndex": 2395,
"widthName": 60, "widthName": 60,
@ -816,48 +819,10 @@
"color": "" "color": ""
}, },
"meta": { "meta": {
"updateAt": 1749687034731, "updateAt": 1750645379453,
"createAt": 1748485662214 "createAt": 1748485662214
} }
}, },
"isiA_oaJNIm3F4nYJuLJ1": {
"id": "isiA_oaJNIm3F4nYJuLJ1",
"name": "paymentinfo",
"comment": "결제정보",
"columnIds": [
"YMx_XwTS1PatRlZtoxW8Z",
"1tE_0qGYDjR3udy5-odYS",
"CoJPWxyzPJBARBaOijyTz",
"5cXK6q9-zhiD08pCjjXuW",
"TVw0yqODUSPTpELO89_Dh",
"mkLkPRKSqWPEBbwxKt2Cj"
],
"seqColumnIds": [
"YMx_XwTS1PatRlZtoxW8Z",
"iOrJK_1qtvJG0NLZ_92Ap",
"1tE_0qGYDjR3udy5-odYS",
"YVqb-AsjUrGwO2OfTLrOY",
"CoJPWxyzPJBARBaOijyTz",
"5cXK6q9-zhiD08pCjjXuW",
"TVw0yqODUSPTpELO89_Dh",
"N1z70y9IzSHgCozvR5hKZ",
"uhJTXyt09V-wQHSVkgzUL",
"Y7aavM4QK2DOr1WfKnOXB",
"mkLkPRKSqWPEBbwxKt2Cj"
],
"ui": {
"x": 556.4204,
"y": 607.3278,
"zIndex": 2408,
"widthName": 69,
"widthComment": 60,
"color": ""
},
"meta": {
"updateAt": 1749616246431,
"createAt": 1748505950663
}
},
"0WXrjcyXXGeoAVM2VB8s2": { "0WXrjcyXXGeoAVM2VB8s2": {
"id": "0WXrjcyXXGeoAVM2VB8s2", "id": "0WXrjcyXXGeoAVM2VB8s2",
"name": "serviceinfo_items", "name": "serviceinfo_items",
@ -5672,206 +5637,6 @@
"createAt": 1748489670367 "createAt": 1748489670367
} }
}, },
"YMx_XwTS1PatRlZtoxW8Z": {
"id": "YMx_XwTS1PatRlZtoxW8Z",
"tableId": "isiA_oaJNIm3F4nYJuLJ1",
"name": "uid",
"comment": "",
"dataType": "INT",
"default": "",
"options": 11,
"ui": {
"keys": 1,
"widthName": 60,
"widthComment": 60,
"widthDataType": 60,
"widthDefault": 60
},
"meta": {
"updateAt": 1748506042145,
"createAt": 1748506032690
}
},
"5cXK6q9-zhiD08pCjjXuW": {
"id": "5cXK6q9-zhiD08pCjjXuW",
"tableId": "isiA_oaJNIm3F4nYJuLJ1",
"name": "amount",
"comment": "결제금액",
"dataType": "INT",
"default": "0",
"options": 8,
"ui": {
"keys": 0,
"widthName": 60,
"widthComment": 60,
"widthDataType": 60,
"widthDefault": 60
},
"meta": {
"updateAt": 1748506156258,
"createAt": 1748506032691
}
},
"Y7aavM4QK2DOr1WfKnOXB": {
"id": "Y7aavM4QK2DOr1WfKnOXB",
"tableId": "isiA_oaJNIm3F4nYJuLJ1",
"name": "updated_at",
"comment": "",
"dataType": "TIMESTAMP",
"default": "",
"options": 0,
"ui": {
"keys": 0,
"widthName": 62,
"widthComment": 60,
"widthDataType": 65,
"widthDefault": 60
},
"meta": {
"updateAt": 1748506032691,
"createAt": 1748506032691
}
},
"mkLkPRKSqWPEBbwxKt2Cj": {
"id": "mkLkPRKSqWPEBbwxKt2Cj",
"tableId": "isiA_oaJNIm3F4nYJuLJ1",
"name": "created_at",
"comment": "",
"dataType": "TIMESTAMP",
"default": "CURRENT_TIMESTAMP",
"options": 8,
"ui": {
"keys": 0,
"widthName": 60,
"widthComment": 60,
"widthDataType": 65,
"widthDefault": 122
},
"meta": {
"updateAt": 1748506032691,
"createAt": 1748506032691
}
},
"N1z70y9IzSHgCozvR5hKZ": {
"id": "N1z70y9IzSHgCozvR5hKZ",
"tableId": "isiA_oaJNIm3F4nYJuLJ1",
"name": "status",
"comment": "상태",
"dataType": "VARCHAR(20)",
"default": "'default'",
"options": 8,
"ui": {
"keys": 0,
"widthName": 60,
"widthComment": 60,
"widthDataType": 75,
"widthDefault": 60
},
"meta": {
"updateAt": 1748506036222,
"createAt": 1748506036222
}
},
"1tE_0qGYDjR3udy5-odYS": {
"id": "1tE_0qGYDjR3udy5-odYS",
"tableId": "isiA_oaJNIm3F4nYJuLJ1",
"name": "invoiceinfo_uid",
"comment": "",
"dataType": "INT",
"default": "",
"options": 8,
"ui": {
"keys": 0,
"widthName": 81,
"widthComment": 60,
"widthDataType": 60,
"widthDefault": 60
},
"meta": {
"updateAt": 1748506063289,
"createAt": 1748506047447
}
},
"iOrJK_1qtvJG0NLZ_92Ap": {
"id": "iOrJK_1qtvJG0NLZ_92Ap",
"tableId": "isiA_oaJNIm3F4nYJuLJ1",
"name": "clientinfo_uid",
"comment": "",
"dataType": "INT",
"default": "",
"options": 8,
"ui": {
"keys": 0,
"widthName": 73,
"widthComment": 60,
"widthDataType": 60,
"widthDefault": 60
},
"meta": {
"updateAt": 1748506109417,
"createAt": 1748506096627
}
},
"YVqb-AsjUrGwO2OfTLrOY": {
"id": "YVqb-AsjUrGwO2OfTLrOY",
"tableId": "isiA_oaJNIm3F4nYJuLJ1",
"name": "alias",
"comment": "결제자명",
"dataType": "VARCHAR(50)",
"default": "",
"options": 8,
"ui": {
"keys": 0,
"widthName": 60,
"widthComment": 60,
"widthDataType": 75,
"widthDefault": 60
},
"meta": {
"updateAt": 1748506147968,
"createAt": 1748506125504
}
},
"TVw0yqODUSPTpELO89_Dh": {
"id": "TVw0yqODUSPTpELO89_Dh",
"tableId": "isiA_oaJNIm3F4nYJuLJ1",
"name": "paid_at",
"comment": "결제일",
"dataType": "DATE",
"default": "",
"options": 0,
"ui": {
"keys": 0,
"widthName": 60,
"widthComment": 60,
"widthDataType": 60,
"widthDefault": 60
},
"meta": {
"updateAt": 1748825131724,
"createAt": 1748506173149
}
},
"CoJPWxyzPJBARBaOijyTz": {
"id": "CoJPWxyzPJBARBaOijyTz",
"tableId": "isiA_oaJNIm3F4nYJuLJ1",
"name": "type",
"comment": "결제방식",
"dataType": "VARCHAR(20)",
"default": "",
"options": 8,
"ui": {
"keys": 0,
"widthName": 60,
"widthComment": 60,
"widthDataType": 75,
"widthDefault": 60
},
"meta": {
"updateAt": 1748831103704,
"createAt": 1748506219155
}
},
"NzxkmndrTbH7xb6fbnGV7": { "NzxkmndrTbH7xb6fbnGV7": {
"id": "NzxkmndrTbH7xb6fbnGV7", "id": "NzxkmndrTbH7xb6fbnGV7",
"tableId": "B8haiEbPc1lRBWTv1g25G", "tableId": "B8haiEbPc1lRBWTv1g25G",
@ -6732,26 +6497,6 @@
"createAt": 1749527376195 "createAt": 1749527376195
} }
}, },
"uhJTXyt09V-wQHSVkgzUL": {
"id": "uhJTXyt09V-wQHSVkgzUL",
"tableId": "isiA_oaJNIm3F4nYJuLJ1",
"name": "status",
"comment": "상태",
"dataType": "VARCHAR(20)",
"default": "'default'",
"options": 8,
"ui": {
"keys": 0,
"widthName": 60,
"widthComment": 60,
"widthDataType": 75,
"widthDefault": 60
},
"meta": {
"updateAt": 1749613648954,
"createAt": 1749613648952
}
},
"xWCCXo-zVdNuL4E9AhjCN": { "xWCCXo-zVdNuL4E9AhjCN": {
"id": "xWCCXo-zVdNuL4E9AhjCN", "id": "xWCCXo-zVdNuL4E9AhjCN",
"tableId": "QCNA57Pi6A9dJDgybxS5v", "tableId": "QCNA57Pi6A9dJDgybxS5v",
@ -6851,6 +6596,26 @@
"updateAt": 1749700784536, "updateAt": 1749700784536,
"createAt": 1749700754351 "createAt": 1749700754351
} }
},
"Vf3bNvvEPfu1zCs4rcHTU": {
"id": "Vf3bNvvEPfu1zCs4rcHTU",
"tableId": "B8haiEbPc1lRBWTv1g25G",
"name": "user_uid",
"comment": "관리자정보",
"dataType": "INT",
"default": "",
"options": 8,
"ui": {
"keys": 2,
"widthName": 60,
"widthComment": 62,
"widthDataType": 60,
"widthDefault": 60
},
"meta": {
"updateAt": 1750645865952,
"createAt": 1750645375147
}
} }
}, },
"relationshipEntities": { "relationshipEntities": {
@ -6893,7 +6658,7 @@
"mfHtgzc_Aeocr6xkgwYWh" "mfHtgzc_Aeocr6xkgwYWh"
], ],
"x": 1584.6636, "x": 1584.6636,
"y": 245.7176, "y": 171.7176,
"direction": 1 "direction": 1
}, },
"end": { "end": {
@ -7041,8 +6806,8 @@
"columnIds": [ "columnIds": [
"NzxkmndrTbH7xb6fbnGV7" "NzxkmndrTbH7xb6fbnGV7"
], ],
"x": 1454.3741, "x": 1455.7440000000001,
"y": 1098.0063333333333, "y": 1102.0063333333333,
"direction": 2 "direction": 2
}, },
"meta": { "meta": {
@ -7060,8 +6825,8 @@
"columnIds": [ "columnIds": [
"N_yJVoCN4oUEDhYqdzApb" "N_yJVoCN4oUEDhYqdzApb"
], ],
"x": 934.3741, "x": 935.744,
"y": 1236.673, "y": 1248.673,
"direction": 1 "direction": 1
}, },
"end": { "end": {
@ -7125,8 +6890,8 @@
"columnIds": [ "columnIds": [
"f1hR1JRFHBHwiJSSX34gw" "f1hR1JRFHBHwiJSSX34gw"
], ],
"x": 1454.3741, "x": 1455.7440000000001,
"y": 1236.673, "y": 1248.673,
"direction": 2 "direction": 2
}, },
"meta": { "meta": {
@ -7144,8 +6909,8 @@
"columnIds": [ "columnIds": [
"N_yJVoCN4oUEDhYqdzApb" "N_yJVoCN4oUEDhYqdzApb"
], ],
"x": 934.3741, "x": 935.744,
"y": 1375.3396666666667, "y": 1395.3396666666667,
"direction": 1 "direction": 1
}, },
"end": { "end": {
@ -7181,8 +6946,8 @@
"columnIds": [ "columnIds": [
"O7aGU_LJxCO1NeNVWbB-J" "O7aGU_LJxCO1NeNVWbB-J"
], ],
"x": 1454.3741, "x": 1455.7440000000001,
"y": 1375.3396666666667, "y": 1395.3396666666667,
"direction": 2 "direction": 2
}, },
"meta": { "meta": {
@ -7200,8 +6965,8 @@
"columnIds": [ "columnIds": [
"N_yJVoCN4oUEDhYqdzApb" "N_yJVoCN4oUEDhYqdzApb"
], ],
"x": 934.3741, "x": 935.744,
"y": 1098.0063333333333, "y": 1102.0063333333333,
"direction": 1 "direction": 1
}, },
"end": { "end": {
@ -7245,6 +7010,34 @@
"updateAt": 1749700754352, "updateAt": 1749700754352,
"createAt": 1749700754352 "createAt": 1749700754352
} }
},
"cRqZmxohkCGd_FTkg1rhI": {
"id": "cRqZmxohkCGd_FTkg1rhI",
"identification": false,
"relationshipType": 16,
"startRelationshipType": 2,
"start": {
"tableId": "Jq5Qkun2FzQhCGKANIVOZ",
"columnIds": [
"mfHtgzc_Aeocr6xkgwYWh"
],
"x": 1584.6636,
"y": 319.7176,
"direction": 1
},
"end": {
"tableId": "B8haiEbPc1lRBWTv1g25G",
"columnIds": [
"Vf3bNvvEPfu1zCs4rcHTU"
],
"x": 1195.7440000000001,
"y": 1028.673,
"direction": 4
},
"meta": {
"updateAt": 1750645375148,
"createAt": 1750645375148
}
} }
}, },
"indexEntities": {}, "indexEntities": {},

View File

@ -13,6 +13,10 @@ class ServiceEntity extends CustomerEntity
{ {
return intval($this->attributes['ownerinfo_uid']); return intval($this->attributes['ownerinfo_uid']);
} }
final public function getUserUID(): int
{
return intval($this->attributes['user_uid']);
}
public function getTitle(): string public function getTitle(): string
{ {
return "S" . $this->getPK(); return "S" . $this->getPK();

View File

@ -205,7 +205,7 @@ class CommonHelper
default: default:
// required가 있으면 class 추가 // required가 있으면 class 추가
$extras = (strpos($viewDatas['control']['field_rules'][$field], 'required') !== false) ? ["class" => "text-danger", "required" => "", ...$extras] : $extras; $extras = (strpos($viewDatas['control']['field_rules'][$field], 'required') !== false) ? ["class" => "text-danger", "required" => "", ...$extras] : $extras;
$label = form_label(lang("{$viewDatas['class_path']}.label.{$field}"), $field, $extras); $label = form_label(array_key_exists('label', $extras) ? $extras['label'] : lang("{$viewDatas['class_path']}.label.{$field}"), $field, $extras);
break; break;
} }
return $label; return $label;

View File

@ -17,22 +17,39 @@ class HomeHelper extends CommonHelper
public function getFieldView(string $field, mixed $value, array $viewDatas, array $extras = []): string|null public function getFieldView(string $field, mixed $value, array $viewDatas, array $extras = []): string|null
{ {
switch ($field) { switch ($field) {
case "countdown": //결제일Countdown
$value = $viewDatas['entity']->getView_CounDueAt();
break;
case 'item_uid': case 'item_uid':
// echo "Value:" . $viewDatas['entity']->getItemType() . ":" . $value;
// dd($viewDatas['control']['filter_optons']);
$value = $viewDatas['control']['filter_optons'][$viewDatas['entity']->getItemType()][$value]->getTitle(); $value = $viewDatas['control']['filter_optons'][$viewDatas['entity']->getItemType()][$value]->getTitle();
break; break;
case 'type':
// echo $value;
// dd($viewDatas['control']['filter_optons'][$field]);
$value = $viewDatas['control']['filter_optons'][$field][$value]->getTitle();
break;
case 'amount': case 'amount':
$value = number_format($value) . ""; $value = number_format($value) . "";
break; break;
case 'status': case 'status':
$value = parent::getFieldView($field, $value, $viewDatas, $extras); $value = parent::getFieldView($field, $value, $viewDatas, $extras);
break; break;
case "LINE":
case "IP":
case "SERVER":
case "CPU":
case "RAM":
case "STORAGE":
case "SOFTWARE":
case "DEFENCE":
case "DOMAIN":
// if ($field == 'DEFENCE') {
// dd($viewDatas['entity']->getItemEntities($field));
// }
$temps = [];
foreach ($viewDatas['entity']->getItemEntities($field) as $itemEntity) {
$temps[] = $viewDatas['control']['filter_optons'][$field][$itemEntity->getItemUid()]->getTitle();
}
$value = implode("<BR>", $temps);
break;
default: default:
dd($viewDatas['entity']);
if (in_array($field, $viewDatas['control']['filter_fields'])) { if (in_array($field, $viewDatas['control']['filter_fields'])) {
$value = $viewDatas['control']['filter_optons'][$field][$value]->getTitle(); $value = $viewDatas['control']['filter_optons'][$field][$value]->getTitle();
} }
@ -44,30 +61,4 @@ class HomeHelper extends CommonHelper
} }
return $value; return $value;
} }
public function getListButton(string $action, array $viewDatas, array $extras = []): string
{
switch ($action) {
case 'modify':
$action = $viewDatas['entity']->getPK();
break;
case 'invoice':
$action = form_submit($action . "_submit", '청구서 발행', [
"formaction" => current_url() . '/' . $action,
"class" => "btn btn-outline btn-primary",
// "onclick" => "return submitBatchJob()"
]);
break;
case 'delete':
if ($viewDatas['entity']->getStatus() !== DEFAULTS['STATUS']) {
$action = "";
} else {
$action = parent::getListButton($action, $viewDatas, $extras);
}
break;
default:
$action = parent::getListButton($action, $viewDatas, $extras);
break;
}
return $action;
}
} }

View File

@ -4,6 +4,7 @@ return [
'label' => [ 'label' => [
'clientinfo_uid' => "고객", 'clientinfo_uid' => "고객",
'ownerinfo_uid' => "관리자", 'ownerinfo_uid' => "관리자",
'user_uid' => "등록자",
'title' => "서비스명", 'title' => "서비스명",
'type' => "서비스형식", 'type' => "서비스형식",
'location' => "위치", 'location' => "위치",

View File

@ -15,6 +15,7 @@ class ServiceModel extends CustomerModel
protected $allowedFields = [ protected $allowedFields = [
"clientinfo_uid", "clientinfo_uid",
"ownerinfo_uid", "ownerinfo_uid",
"user_uid",
"type", "type",
"location", "location",
"switch", "switch",
@ -37,6 +38,7 @@ class ServiceModel extends CustomerModel
switch ($field) { switch ($field) {
case "clientinfo_uid": case "clientinfo_uid":
case "ownerinfo_uid": case "ownerinfo_uid":
case "user_uid":
$rule = "required|numeric"; $rule = "required|numeric";
break; break;
case "type": case "type":

View File

@ -75,12 +75,11 @@ class ServicePaymentService extends CustomerService
} }
return $options; return $options;
} }
//미납 Count //미납서비스 정보
final public function getUnPaid(string $item_type, string $status = DEFAULTS['STATUS']): int final public function getEntitiesByUnPaid(): array
{ {
$sql = "SELECT COUNT(*) as CNT FROM serviceinfo_payment WHERE billing_at < NOW() AND item_type = ? AND status = ?"; $where = sprintf("billing_at < NOW() AND amount > 0 AND status = '%s'", DEFAULTS['STATUS']);
$row = $this->getModel()->query($sql, [$item_type, $status])->getRow(); return $this->getEntities($where);
return intval($row->CNT);
} }
//ServiceItemService에서 사용 //ServiceItemService에서 사용
public function createPaymentByServiceItem(ServiceItemEntity $serviceItemEntity): ServicePaymentEntity public function createPaymentByServiceItem(ServiceItemEntity $serviceItemEntity): ServicePaymentEntity

View File

@ -6,11 +6,15 @@ 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;
class ServiceService extends CustomerService class ServiceService extends CustomerService
{ {
private ?UserService $_userService = null;
private ?CodeService $_codeService = null; private ?CodeService $_codeService = null;
private ?ServiceItemService $_serviceItemService = null;
private ?string $_searchIP = null; private ?string $_searchIP = null;
public function __construct(mixed $request = null) public function __construct(mixed $request = null)
{ {
@ -30,6 +34,7 @@ class ServiceService extends CustomerService
return [ return [
"clientinfo_uid", "clientinfo_uid",
"ownerinfo_uid", "ownerinfo_uid",
"user_uid",
"type", "type",
"location", "location",
"switch", "switch",
@ -42,7 +47,7 @@ class ServiceService extends CustomerService
} }
public function getFilterFields(): array public function getFilterFields(): array
{ {
return ["clientinfo_uid", 'ownerinfo_uid', 'type', 'location', 'switch', 'code', 'raid', 'status']; return ["clientinfo_uid", 'ownerinfo_uid', 'user_uid', 'type', 'location', 'switch', 'code', 'raid', 'status'];
} }
public function getBatchJobFields(): array public function getBatchJobFields(): array
{ {
@ -50,7 +55,14 @@ class ServiceService extends CustomerService
} }
public function getIndexFields(): array public function getIndexFields(): array
{ {
return ['clientinfo_uid', 'ownerinfo_uid', 'type', 'location', 'switch', 'code', 'raid', 'billing_at', 'start_at', 'updated_at', 'status']; return ['clientinfo_uid', 'ownerinfo_uid', 'type', 'location', 'switch', 'code', 'raid', 'billing_at', 'start_at', 'updated_at', 'status', 'user_uid'];
}
public function getUSerService(): UserService
{
if (!$this->_userService) {
$this->_userService = new UserService($this->request);
}
return $this->_userService;
} }
public function getCodeService(): CodeService public function getCodeService(): CodeService
{ {
@ -59,6 +71,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;
}
//Entity의 관련객체정의용 //Entity의 관련객체정의용
public function setSearchIp(string $ip): void public function setSearchIp(string $ip): void
{ {
@ -80,6 +99,20 @@ class ServiceService extends CustomerService
} }
return parent::findAllDatas($columns); return parent::findAllDatas($columns);
} }
public function getEntities(mixed $where = null, array $columns = ['*']): array
{
$entities = [];
foreach (parent::getEntities($where, $columns) as $entity) {
foreach (SERVICE_ITEM_TYPES as $item_type => $label) {
$entity->setItemEntities(
$item_type,
$this->getServiceItemService()->getEntities(['serviceinfo_uid' => $entity->getPK(), 'item_type' => $item_type])
);
}
$entities[$entity->getPK()] = $entity;
}
return $entities;
} //
//기본 기능부분 //기본 기능부분
//FieldForm관련용 //FieldForm관련용
public function getFormFieldOption(string $field, array $options = []): array public function getFormFieldOption(string $field, array $options = []): array
@ -88,6 +121,9 @@ class ServiceService extends CustomerService
case 'ownerinfo_uid': case 'ownerinfo_uid':
$options = $this->getClientService()->getEntities(); $options = $this->getClientService()->getEntities();
break; break;
case 'user_uid':
$options = $this->getUserService()->getEntities();
break;
case 'code': case 'code':
$options = $this->getCodeService()->getEntities(); $options = $this->getCodeService()->getEntities();
break; break;
@ -98,10 +134,10 @@ class ServiceService extends CustomerService
return $options; return $options;
} }
//interval을 기준으로 신규서비스 가져오기 //interval을 기준으로 신규서비스 가져오기
final public function getNewService(int $interval, string $status = DEFAULTS['STATUS']) final public function getEntitiesByNewService(int $interval, string $status = DEFAULTS['STATUS'])
{ {
$sql = "SELECT * FROM serviceinfo WHERE start_at >= NOW() - INTERVAL ? DAY AND status = ?"; $where = sprintf("start_at >= NOW()-INTERVAL {$interval} DAY AND status = '%s'", DEFAULTS['STATUS']);
return $this->getModel()->query($sql, [$interval, $status])->getResult(ServiceEntity::class); return $this->getEntities($where);
} }
//다음 달로 결제일을 연장합니다. //다음 달로 결제일을 연장합니다.
final public function extendBillingAt(string $billing_at, string $status): bool final public function extendBillingAt(string $billing_at, string $status): bool

View File

@ -133,7 +133,7 @@
</div> </div>
<div class="col-8 text-end"> <div class="col-8 text-end">
<div class="huge"><?= $viewDatas['unPaidCount'] ?></div> <div class="huge"><?= $viewDatas['unPaidCount'] ?></div>
<div>금일 기준 미납 서버</div> <div><?= date("Y-m-d") ?> 금일 기준 미납 서비스</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -19,7 +19,6 @@
<th>IP정보</th> <th>IP정보</th>
<th>CS</th> <th>CS</th>
<th>등록자</th> <th>등록자</th>
<th>비고</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -32,9 +31,8 @@
<td><?= $viewDatas['helper']->getFieldView('code', $entity->getCode(), $viewDatas) ?></td> <td><?= $viewDatas['helper']->getFieldView('code', $entity->getCode(), $viewDatas) ?></td>
<td><?= $viewDatas['helper']->getFieldView('switch', $entity->getSwitch(), $viewDatas) ?></td> <td><?= $viewDatas['helper']->getFieldView('switch', $entity->getSwitch(), $viewDatas) ?></td>
<td><?= $viewDatas['helper']->getFieldView('IP', null, $viewDatas) ?></td> <td><?= $viewDatas['helper']->getFieldView('IP', null, $viewDatas) ?></td>
<td><?= $viewDatas['helper']->getFieldView('DEFEMCE', null, $viewDatas) ?></td> <td><?= $viewDatas['helper']->getFieldView('DEFENCE', null, $viewDatas) ?></td>
<td>등록자</td> <td><?= $viewDatas['helper']->getFieldView('user_uid', $entity->getUserUID(), $viewDatas) ?></td>
<td>비고</td>
</tr> </tr>
<?php endforeach ?> <?php endforeach ?>
</tbody> </tbody>