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() {