diff --git a/app/Config/Constants.php b/app/Config/Constants.php index b5181b4..ec2d3c1 100644 --- a/app/Config/Constants.php +++ b/app/Config/Constants.php @@ -470,5 +470,4 @@ define("BOARD", [ 'WORKING' => 'working', 'REQUESTTASK' => 'requesttask' ], - 'LATEST_LIMIT' => 3, ]); diff --git a/app/Config/Routes.php b/app/Config/Routes.php index ee3e5e3..e5debb4 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -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) { diff --git a/app/Controllers/Admin/BoardController.php b/app/Controllers/Admin/BoardController.php index 77b4b68..b1a6cd5 100644 --- a/app/Controllers/Admin/BoardController.php +++ b/app/Controllers/Admin/BoardController.php @@ -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()] )); } } diff --git a/app/Services/BoardService.php b/app/Services/BoardService.php index 2fd2bae..27e09f4 100644 --- a/app/Services/BoardService.php +++ b/app/Services/BoardService.php @@ -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' => "", 'created_at' => date('Y-m-d H:m', strtotime($entity->getCreatedAT())), diff --git a/app/Views/admin/welcome/stock.php b/app/Views/admin/welcome/stock.php index 51f709b..133103f 100644 --- a/app/Views/admin/welcome/stock.php +++ b/app/Views/admin/welcome/stock.php @@ -10,9 +10,9 @@
- - - + + + diff --git a/app/Views/layouts/admin/top.php b/app/Views/layouts/admin/top.php index 674dace..d2c0db3 100644 --- a/app/Views/layouts/admin/top.php +++ b/app/Views/layouts/admin/top.php @@ -94,7 +94,7 @@ document.addEventListener("DOMContentLoaded", function() { async function loadNotices() { try { - const res = await fetch("/admin/board/latest?category="); + const res = await fetch("/admin/board/notice?category="); 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="); + const res = await fetch("/admin/board/reqeusttask?category="); const requesttasks = await res.json(); const requesttask_list = document.getElementById("requesttaskList"); const requesttask_count = document.getElementById("requesttask-count");
서버메모리저장장치사용 서버메모리 재고저장장치 재고