dbmsv3 init...1

This commit is contained in:
choi.jh 2025-10-21 14:41:39 +09:00
parent 6bb4130d08
commit be88e4b200
6 changed files with 22 additions and 12 deletions

View File

@ -470,5 +470,4 @@ define("BOARD", [
'WORKING' => 'working',
'REQUESTTASK' => 'requesttask'
],
'LATEST_LIMIT' => 3,
]);

View File

@ -68,7 +68,8 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
$routes->post('batchjob', 'BoardController::batchjob');
$routes->post('batchjob_delete', 'BoardController::batchjob_delete');
$routes->get('download/(:alpha)', 'BoardController::download/$1');
$routes->get('latest', 'BoardController::latest');
$routes->get('notice', 'BoardController::notice');
$routes->get('reqeusttask', 'BoardController::reqeusttask');
});
//Customer 관련
$routes->group('customer', ['namespace' => 'App\Controllers\Admin\Customer'], function ($routes) {

View File

@ -24,7 +24,7 @@ class BoardController extends AdminController
return $this->_service;
}
public function latest(): ResponseInterface
public function notice(): ResponseInterface
{
$this->getService()->setAction(__FUNCTION__);
$this->getService()->setFormFields();
@ -33,7 +33,18 @@ class BoardController extends AdminController
$formDatas = $this->getSErvice()->getFormDatas();
return $this->response->setJSON($this->getService()->getLatest(
array_key_exists('category', $formDatas) && $formDatas['category'] ? $formDatas['category'] : BOARD['CATEGORY']['NOTICE'],
array_key_exists('limit', $formDatas) ? $formDatas['limit'] : BOARD['LATEST_LIMIT']
));
}
public function reqeusttask(): ResponseInterface
{
$this->getService()->setAction(__FUNCTION__);
$this->getService()->setFormFields();
//전달값정의
$this->getService()->setFormDatas($this->request->getGet());
$formDatas = $this->getSErvice()->getFormDatas();
return $this->response->setJSON($this->getService()->getLatest(
array_key_exists('category', $formDatas) && $formDatas['category'] ? $formDatas['category'] : BOARD['CATEGORY']['NOTICE'],
['worker_uid' => $this->getMyAuth()->getUIDByAuthInfo()]
));
}
}

View File

@ -63,13 +63,12 @@ class BoardService extends CommonService
}
//기본 기능부분
//Category별 최근 $limit갯수만큼 게시물
public function getLatest(string $category, int $limit): array
public function getLatest(string $category, array $where = []): array
{
//관리자정보
$userEntities = $this->getUserService()->getEntities();
$this->getModel()->limit($limit);
$datas = [];
foreach ($this->getEntities(['category' => $category, 'status' => STATUS['AVAILABLE']]) as $entity) {
foreach ($this->getEntities(['category' => $category, 'status' => STATUS['AVAILABLE'], ...$where]) as $entity) {
$datas[] = [
'title' => "<label for=\"view\" data-src=\"/admin/board/view/{$entity->getPK()}\" data-bs-toggle=\"modal\" data-bs-target=\" #modal_action_form\" class=\"text-primary form-label-sm\">{$entity->getTitle()}</label>",
'created_at' => date('Y-m-d H:m', strtotime($entity->getCreatedAT())),

View File

@ -10,9 +10,9 @@
<div style="border-left: 1px solid black; border-right: 1px solid black; padding:20px;">
<table class="table table-bordered table-striped">
<tr>
<th class="text-center" width="30%">서버</th>
<th class="text-center" width="30%">메모리</th>
<th class="text-center" width="40%">저장장치</th>
<th class="text-center" width="30%">사용 서버</th>
<th class="text-center" width="30%">메모리 재고</th>
<th class="text-center" width="40%">저장장치 재고</th>
</tr>
<tr>
<td><?= view_cell("\App\Cells\Equipment\ServerCell::stock") ?></td>

View File

@ -94,7 +94,7 @@
document.addEventListener("DOMContentLoaded", function() {
async function loadNotices() {
try {
const res = await fetch("/admin/board/latest?category=<?= BOARD['CATEGORY']['NOTICE'] ?>");
const res = await fetch("/admin/board/notice?category=<?= BOARD['CATEGORY']['NOTICE'] ?>");
const notices = await res.json();
const notice_list = document.getElementById("noticeList");
const notice_count = document.getElementById("notice-count");
@ -116,7 +116,7 @@
}
async function loadrequesttasks() {
try {
const res = await fetch("/admin/board/latest?category=<?= BOARD['CATEGORY']['REQUESTTASK'] ?>");
const res = await fetch("/admin/board/reqeusttask?category=<?= BOARD['CATEGORY']['REQUESTTASK'] ?>");
const requesttasks = await res.json();
const requesttask_list = document.getElementById("requesttaskList");
const requesttask_count = document.getElementById("requesttask-count");