From 32c04aa9570e0ad9fb3bf2b1b372852d6f9fb700 Mon Sep 17 00:00:00 2001 From: Anyon Date: Tue, 26 Nov 2019 11:45:02 +0800 Subject: [PATCH] ComposerUpdate --- application/admin/controller/Login.php | 16 +++------- vendor/autoload.php | 2 +- vendor/composer/autoload_real.php | 14 ++++----- vendor/composer/autoload_static.php | 8 ++--- vendor/composer/installed.json | 8 ++--- .../think-library/src/Controller.php | 31 +++++++++---------- 6 files changed, 36 insertions(+), 43 deletions(-) diff --git a/application/admin/controller/Login.php b/application/admin/controller/Login.php index afdf76900..10a143ccb 100644 --- a/application/admin/controller/Login.php +++ b/application/admin/controller/Login.php @@ -61,17 +61,11 @@ class Login extends Controller */ protected function _index_post() { - $data = $this->_input([ - 'username' => $this->request->post('username'), - 'password' => $this->request->post('password'), - ], [ - 'username' => 'require|min:4', - 'password' => 'require|min:4', - ], [ + $data = $this->_vali([ 'username.require' => '登录账号不能为空!', 'password.require' => '登录密码不能为空!', - 'username.min' => '登录账号长度不能少于4位有效字符!', - 'password.min' => '登录密码长度不能少于4位有效字符!', + 'username.min:4' => '登录账号长度不能少于4位有效字符!', + 'password.min:4' => '登录密码长度不能少于4位有效字符!', ]); // 用户信息验证 $map = ['is_deleted' => '0', 'username' => $data['username']]; @@ -118,8 +112,8 @@ class Login extends Controller */ public function out() { - \think\facade\Session::clear(); - \think\facade\Session::destroy(); + $this->app->session->clear(); + $this->app->session->destroy(); $this->success('退出登录成功!', url('@admin/login')); } diff --git a/vendor/autoload.php b/vendor/autoload.php index f0ae2e4d2..56ffc9011 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInitb7e6ef67068b48e5175bce380d4bfe2f::getLoader(); +return ComposerAutoloaderInitcd358774cbdeec4e6bc6107ae33ae515::getLoader(); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 6a3e92f87..f99583287 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInitb7e6ef67068b48e5175bce380d4bfe2f +class ComposerAutoloaderInitcd358774cbdeec4e6bc6107ae33ae515 { private static $loader; @@ -19,15 +19,15 @@ class ComposerAutoloaderInitb7e6ef67068b48e5175bce380d4bfe2f return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInitb7e6ef67068b48e5175bce380d4bfe2f', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInitcd358774cbdeec4e6bc6107ae33ae515', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInitb7e6ef67068b48e5175bce380d4bfe2f', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInitcd358774cbdeec4e6bc6107ae33ae515', '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\ComposerStaticInitb7e6ef67068b48e5175bce380d4bfe2f::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInitcd358774cbdeec4e6bc6107ae33ae515::getInitializer($loader)); } else { $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { @@ -48,19 +48,19 @@ class ComposerAutoloaderInitb7e6ef67068b48e5175bce380d4bfe2f $loader->register(true); if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInitb7e6ef67068b48e5175bce380d4bfe2f::$files; + $includeFiles = Composer\Autoload\ComposerStaticInitcd358774cbdeec4e6bc6107ae33ae515::$files; } else { $includeFiles = require __DIR__ . '/autoload_files.php'; } foreach ($includeFiles as $fileIdentifier => $file) { - composerRequireb7e6ef67068b48e5175bce380d4bfe2f($fileIdentifier, $file); + composerRequirecd358774cbdeec4e6bc6107ae33ae515($fileIdentifier, $file); } return $loader; } } -function composerRequireb7e6ef67068b48e5175bce380d4bfe2f($fileIdentifier, $file) +function composerRequirecd358774cbdeec4e6bc6107ae33ae515($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 cbaf4421e..abe21c5ea 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInitb7e6ef67068b48e5175bce380d4bfe2f +class ComposerStaticInitcd358774cbdeec4e6bc6107ae33ae515 { public static $files = array ( '841780ea2e1d6545ea3a253239d59c05' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/functions.php', @@ -366,9 +366,9 @@ class ComposerStaticInitb7e6ef67068b48e5175bce380d4bfe2f public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInitb7e6ef67068b48e5175bce380d4bfe2f::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInitb7e6ef67068b48e5175bce380d4bfe2f::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInitb7e6ef67068b48e5175bce380d4bfe2f::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInitcd358774cbdeec4e6bc6107ae33ae515::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInitcd358774cbdeec4e6bc6107ae33ae515::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInitcd358774cbdeec4e6bc6107ae33ae515::$classMap; }, null, ClassLoader::class); } diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 50b7fefb6..e3d4c795e 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -502,12 +502,12 @@ "source": { "type": "git", "url": "https://github.com/zoujingli/ThinkLibrary.git", - "reference": "10b94d3b9dc3b0bea5e5c759b7f00a3fc057280b" + "reference": "0fb1d49fde76d86487940f2b7f6bb6ff7b613648" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/10b94d3b9dc3b0bea5e5c759b7f00a3fc057280b", - "reference": "10b94d3b9dc3b0bea5e5c759b7f00a3fc057280b", + "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/0fb1d49fde76d86487940f2b7f6bb6ff7b613648", + "reference": "0fb1d49fde76d86487940f2b7f6bb6ff7b613648", "shasum": "", "mirrors": [ { @@ -527,7 +527,7 @@ "qiniu/php-sdk": "^7.2", "topthink/framework": "5.1.*" }, - "time": "2019-11-26T02:19:03+00:00", + "time": "2019-11-26T03:42:04+00:00", "type": "library", "installation-source": "dist", "autoload": { diff --git a/vendor/zoujingli/think-library/src/Controller.php b/vendor/zoujingli/think-library/src/Controller.php index 254a53ffe..97bd92c1e 100644 --- a/vendor/zoujingli/think-library/src/Controller.php +++ b/vendor/zoujingli/think-library/src/Controller.php @@ -72,7 +72,22 @@ abstract class Controller extends \stdClass if (in_array($this->request->action(), get_class_methods(__CLASS__))) { $this->error('Access without permission.'); } + // 初始化控制器 $this->initialize(); + // 控制器后置操作 + if (method_exists($this, $method = "_{$this->request->action()}_{$this->request->method()}")) { + $this->app->hook->add('app_end', function (\think\Response $response) use ($method) { + try { + [ob_start(), ob_clean()]; + call_user_func_array([$this, $method], $this->request->route()); + } catch (HttpResponseException $exception) { + $end = $exception->getResponse(); + $response->code($end->getCode())->header($end->getHeader())->content($response->getContent() . $end->getContent()); + } catch (\Exception $exception) { + throw $exception; + } + }); + } } /** @@ -84,22 +99,6 @@ abstract class Controller extends \stdClass return $this; } - /** - * Controller destruct - * @throws \Exception - */ - public function __destruct() - { - $method = "_{$this->request->action()}_{$this->request->method()}"; - if (method_exists($this, $method)) try { - call_user_func_array([$this, $method], $this->request->route()); - } catch (HttpResponseException $exception) { - $exception->getResponse()->send(); - } catch (\Exception $exception) { - throw $exception; - } - } - /** * 返回失败的操作 * @param mixed $info 消息内容