From 36e4c75c51cf9c624d08aac600e627f27a6bc027 Mon Sep 17 00:00:00 2001 From: yaooo <272523191@qq.com> Date: Sat, 28 Oct 2023 18:02:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=B3=BB=E7=BB=9F=E5=85=AC?= =?UTF-8?q?=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/ApiController.php | 8 +++----- app/api/controller/HomeIndex.php | 23 ----------------------- 2 files changed, 3 insertions(+), 28 deletions(-) diff --git a/app/api/ApiController.php b/app/api/ApiController.php index 4f5cb58..db3802e 100644 --- a/app/api/ApiController.php +++ b/app/api/ApiController.php @@ -155,17 +155,15 @@ abstract class ApiController $action = $baseUrl[count($baseUrl)-1] ?? '-' ; $controller = $baseUrl[count($baseUrl)-2] ?? '-'; $controllerArray = explode('_', $controller); - $prefixMod = $controllerArray[0] ?? '-'; - $conMod = $controllerArray[1] ?? '-'; + $prefixMod = strtolower($controllerArray[0] ?? '-'); + $conMod = strtolower($controllerArray[1] ?? '-'); $GOUGU = new Systematic(); $GOUGU->auth($uid); $auth_list_all = Cache::get('RulesSrc0'); $auth_list = Cache::get('RulesSrc' . $uid); $pathUrl = $prefixMod . '/' . $conMod . '/' . $action; if (!in_array($pathUrl, $auth_list)) { - return false; - } else { - return true; + $this->apiError('用户无权限'); } } diff --git a/app/api/controller/HomeIndex.php b/app/api/controller/HomeIndex.php index 341751e..83362c0 100644 --- a/app/api/controller/HomeIndex.php +++ b/app/api/controller/HomeIndex.php @@ -23,29 +23,6 @@ class HomeIndex extends ApiController Auth::class => ['except' => []] ]; - //公告信息 - public function note_list() - { - $param = get_params(); - $where = array(); - if (!empty($param['keywords'])) { - $where[] = ['a.title', 'like', '%' . $param['keywords'] . '%']; - } - $where[] = ['a.status', '=', 1]; - $rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit']; - $note = NoteList::where($where) - ->field('a.id,a.cate_id,a.title,a.content,a.status,a.create_time,a.start_time,a.end_time,c.title as cate_title') - ->alias('a') - ->join('NoteCate c', 'a.cate_id = c.id', 'LEFT') - ->order('a.end_time desc,a.sort desc,a.create_time desc') - ->paginate($rows, false, ['query' => $param]) - ->each(function ($item, $key) { - $item->start_time = empty($item->start_time) ? '-' : date('Y-m-d', $item->start_time); - $item->end_time = empty($item->end_time) ? '-' : date('Y-m-d', $item->end_time); - }); - $this->apiSuccess('获取成功', $note); - } - //用户信息 public function userinfo() {