diff --git a/app/admin/controller/Index.php b/app/admin/controller/Index.php index 1e8f02584..0807085ba 100644 --- a/app/admin/controller/Index.php +++ b/app/admin/controller/Index.php @@ -16,7 +16,6 @@ namespace app\admin\controller; use think\admin\Controller; -use think\admin\extend\DataExtend; use think\admin\service\AuthService; use think\admin\service\MenuService; @@ -38,9 +37,9 @@ class Index extends Controller public function index() { $this->title = '系统管理后台'; - AuthService::instance()->apply(true); + $auth = AuthService::instance()->apply(true); $this->menus = MenuService::instance()->getTree(); - if (empty($this->menus) && !AuthService::instance()->isLogin()) { + if (empty($this->menus) && !$auth->isLogin()) { $this->redirect(url('@admin/login')); } else { $this->fetch(); diff --git a/app/admin/controller/Menu.php b/app/admin/controller/Menu.php index 4258a78e2..1593230b3 100644 --- a/app/admin/controller/Menu.php +++ b/app/admin/controller/Menu.php @@ -98,6 +98,13 @@ class Menu extends Controller protected function _form_filter(&$vo) { if ($this->request->isGet()) { + // 选择自己的上级菜单 + if (empty($vo['pid']) && $this->request->get('pid', '0')) { + $vo['pid'] = $this->request->get('pid', '0'); + } + // 读取系统功能节点 + $this->nodes = MenuService::instance()->getList(); + // 列出可选上级菜单 $menus = $this->app->db->name($this->table)->where(['status' => '1'])->order('sort desc,id asc')->select()->toArray(); $menus[] = ['title' => '顶级菜单', 'id' => '0', 'pid' => '-1']; foreach ($this->menus = DataExtend::arr2table($menus) as $key => &$menu) { @@ -106,12 +113,6 @@ class Menu extends Controller if (stripos("{$menu['path']}-", "{$cur}-") !== false || $menu['path'] === $cur) unset($this->menus[$key]); # 移除与自己相关联的菜单 } } - // 选择自己的上级菜单 - if (empty($vo['pid']) && $this->request->get('pid', '0')) { - $vo['pid'] = $this->request->get('pid', '0'); - } - // 读取系统功能节点 - $this->nodes = MenuService::instance()->getList(); } } diff --git a/app/admin/controller/api/Upload.php b/app/admin/controller/api/Upload.php index 2112db8fe..288aa4866 100644 --- a/app/admin/controller/api/Upload.php +++ b/app/admin/controller/api/Upload.php @@ -15,7 +15,6 @@ namespace app\admin\controller\api; -use app\admin\service\AuthService; use think\admin\Controller; use think\admin\Storage; @@ -56,9 +55,6 @@ class Upload extends Controller */ public function file() { - if (!AuthService::isLogin()) { - $this->error('访问授权失败,请重新登录授权再试!'); - } if (!($file = $this->getFile()) || empty($file)) { return json(['uploaded' => false, 'error' => ['message' => '文件上传异常,文件可能过大或未上传']]); } diff --git a/composer.lock b/composer.lock index e9e7452a5..2260adfea 100644 --- a/composer.lock +++ b/composer.lock @@ -783,12 +783,12 @@ "source": { "type": "git", "url": "https://github.com/zoujingli/ThinkLibrary.git", - "reference": "fedc488cd0d8c8799b8e5620945c0d739a58cbd5" + "reference": "9e636a7be3d7c468cb73c40c48835bf51cef6864" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/fedc488cd0d8c8799b8e5620945c0d739a58cbd5", - "reference": "fedc488cd0d8c8799b8e5620945c0d739a58cbd5", + "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/9e636a7be3d7c468cb73c40c48835bf51cef6864", + "reference": "9e636a7be3d7c468cb73c40c48835bf51cef6864", "shasum": "", "mirrors": [ { @@ -832,7 +832,7 @@ ], "description": "ThinkPHP v6.0 Development Library", "homepage": "http://framework.thinkadmin.top", - "time": "2019-11-18T10:46:44+00:00" + "time": "2019-11-18T11:43:36+00:00" } ], "packages-dev": [], diff --git a/vendor/autoload.php b/vendor/autoload.php index 3ec7d209b..3f2f6eaf3 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInit5a743c9cd506240941dde8cfe27e723d::getLoader(); +return ComposerAutoloaderInitdc48cac423beab724a7102138067b2f9::getLoader(); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 628270eb6..c7587187f 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit5a743c9cd506240941dde8cfe27e723d +class ComposerAutoloaderInitdc48cac423beab724a7102138067b2f9 { private static $loader; @@ -19,15 +19,15 @@ class ComposerAutoloaderInit5a743c9cd506240941dde8cfe27e723d return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit5a743c9cd506240941dde8cfe27e723d', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInitdc48cac423beab724a7102138067b2f9', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInit5a743c9cd506240941dde8cfe27e723d', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInitdc48cac423beab724a7102138067b2f9', 'loadClassLoader')); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); if ($useStaticLoader) { require_once __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInit5a743c9cd506240941dde8cfe27e723d::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInitdc48cac423beab724a7102138067b2f9::getInitializer($loader)); } else { $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { @@ -48,19 +48,19 @@ class ComposerAutoloaderInit5a743c9cd506240941dde8cfe27e723d $loader->register(true); if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInit5a743c9cd506240941dde8cfe27e723d::$files; + $includeFiles = Composer\Autoload\ComposerStaticInitdc48cac423beab724a7102138067b2f9::$files; } else { $includeFiles = require __DIR__ . '/autoload_files.php'; } foreach ($includeFiles as $fileIdentifier => $file) { - composerRequire5a743c9cd506240941dde8cfe27e723d($fileIdentifier, $file); + composerRequiredc48cac423beab724a7102138067b2f9($fileIdentifier, $file); } return $loader; } } -function composerRequire5a743c9cd506240941dde8cfe27e723d($fileIdentifier, $file) +function composerRequiredc48cac423beab724a7102138067b2f9($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { require $file; diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 050ed09c9..53d0c59c0 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInit5a743c9cd506240941dde8cfe27e723d +class ComposerStaticInitdc48cac423beab724a7102138067b2f9 { public static $files = array ( '9b552a3cc426e3287cc811caefa3cf53' => __DIR__ . '/..' . '/topthink/think-helper/src/helper.php', @@ -470,9 +470,9 @@ class ComposerStaticInit5a743c9cd506240941dde8cfe27e723d public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit5a743c9cd506240941dde8cfe27e723d::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit5a743c9cd506240941dde8cfe27e723d::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInit5a743c9cd506240941dde8cfe27e723d::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInitdc48cac423beab724a7102138067b2f9::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInitdc48cac423beab724a7102138067b2f9::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInitdc48cac423beab724a7102138067b2f9::$classMap; }, null, ClassLoader::class); } diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 192e5f702..f373a7f95 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -805,12 +805,12 @@ "source": { "type": "git", "url": "https://github.com/zoujingli/ThinkLibrary.git", - "reference": "fedc488cd0d8c8799b8e5620945c0d739a58cbd5" + "reference": "9e636a7be3d7c468cb73c40c48835bf51cef6864" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/fedc488cd0d8c8799b8e5620945c0d739a58cbd5", - "reference": "fedc488cd0d8c8799b8e5620945c0d739a58cbd5", + "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/9e636a7be3d7c468cb73c40c48835bf51cef6864", + "reference": "9e636a7be3d7c468cb73c40c48835bf51cef6864", "shasum": "", "mirrors": [ { @@ -826,7 +826,7 @@ "ext-json": "*", "topthink/framework": "^6.0" }, - "time": "2019-11-18T10:46:44+00:00", + "time": "2019-11-18T11:43:36+00:00", "type": "library", "extra": { "think": { diff --git a/vendor/services.php b/vendor/services.php index c118f9f0a..e2b7b2aa9 100644 --- a/vendor/services.php +++ b/vendor/services.php @@ -1,5 +1,5 @@ 'think\\app\\Service', diff --git a/vendor/zoujingli/think-library/src/Controller.php b/vendor/zoujingli/think-library/src/Controller.php index afb461daf..77718c499 100644 --- a/vendor/zoujingli/think-library/src/Controller.php +++ b/vendor/zoujingli/think-library/src/Controller.php @@ -21,7 +21,6 @@ use think\admin\helper\PageHelper; use think\admin\helper\QueryHelper; use think\admin\helper\SaveHelper; use think\admin\helper\TokenHelper; -use think\admin\service\NodeService; use think\App; use think\db\exception\DataNotFoundException; use think\db\exception\DbException; diff --git a/vendor/zoujingli/think-library/src/Queue.php b/vendor/zoujingli/think-library/src/Queue.php index 501856db8..61fe43e27 100644 --- a/vendor/zoujingli/think-library/src/Queue.php +++ b/vendor/zoujingli/think-library/src/Queue.php @@ -113,7 +113,7 @@ class Queue */ protected function iswin() { - return ProcessService::instance($this->app)->iswin(); + return ProcessService::instance()->iswin(); } /** diff --git a/vendor/zoujingli/think-library/src/service/AuthService.php b/vendor/zoujingli/think-library/src/service/AuthService.php index 03d222471..8f68151fb 100644 --- a/vendor/zoujingli/think-library/src/service/AuthService.php +++ b/vendor/zoujingli/think-library/src/service/AuthService.php @@ -85,6 +85,7 @@ class AuthService extends Service /** * 初始化用户权限 * @param boolean $force 强刷权限 + * @return AuthService * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException @@ -104,6 +105,7 @@ class AuthService extends Service $this->app->session->set('user', $user); } } + return $this; } } \ No newline at end of file diff --git a/vendor/zoujingli/think-library/src/service/ProcessService.php b/vendor/zoujingli/think-library/src/service/ProcessService.php index e9a4ca45a..ce22167b1 100644 --- a/vendor/zoujingli/think-library/src/service/ProcessService.php +++ b/vendor/zoujingli/think-library/src/service/ProcessService.php @@ -48,6 +48,7 @@ class ProcessService extends Service /** * 创建异步进程 * @param string $command 任务指令 + * @return ProcessService */ public function create($command) { @@ -57,6 +58,7 @@ class ProcessService extends Service } else { pclose(popen("{$command} &", 'r')); } + return $this; } /** diff --git a/vendor/zoujingli/think-library/src/service/TokenService.php b/vendor/zoujingli/think-library/src/service/TokenService.php index 793ae0f05..5ff652378 100644 --- a/vendor/zoujingli/think-library/src/service/TokenService.php +++ b/vendor/zoujingli/think-library/src/service/TokenService.php @@ -53,11 +53,13 @@ class TokenService extends Service /** * 清理表单CSRF信息 * @param string $token + * @return TokenService */ public function clearFormToken($token = null) { if (is_null($token)) $token = $this->getInputToken(); $this->app->session->delete($token); + return $this; } /**