ComposerUpdate

This commit is contained in:
Anyon 2019-11-26 11:45:02 +08:00
parent 011c1a13d6
commit 32c04aa957
6 changed files with 36 additions and 43 deletions

View File

@ -61,17 +61,11 @@ class Login extends Controller
*/ */
protected function _index_post() protected function _index_post()
{ {
$data = $this->_input([ $data = $this->_vali([
'username' => $this->request->post('username'),
'password' => $this->request->post('password'),
], [
'username' => 'require|min:4',
'password' => 'require|min:4',
], [
'username.require' => '登录账号不能为空!', 'username.require' => '登录账号不能为空!',
'password.require' => '登录密码不能为空!', 'password.require' => '登录密码不能为空!',
'username.min' => '登录账号长度不能少于4位有效字符', 'username.min:4' => '登录账号长度不能少于4位有效字符',
'password.min' => '登录密码长度不能少于4位有效字符', 'password.min:4' => '登录密码长度不能少于4位有效字符',
]); ]);
// 用户信息验证 // 用户信息验证
$map = ['is_deleted' => '0', 'username' => $data['username']]; $map = ['is_deleted' => '0', 'username' => $data['username']];
@ -118,8 +112,8 @@ class Login extends Controller
*/ */
public function out() public function out()
{ {
\think\facade\Session::clear(); $this->app->session->clear();
\think\facade\Session::destroy(); $this->app->session->destroy();
$this->success('退出登录成功!', url('@admin/login')); $this->success('退出登录成功!', url('@admin/login'));
} }

2
vendor/autoload.php vendored
View File

@ -4,4 +4,4 @@
require_once __DIR__ . '/composer/autoload_real.php'; require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInitb7e6ef67068b48e5175bce380d4bfe2f::getLoader(); return ComposerAutoloaderInitcd358774cbdeec4e6bc6107ae33ae515::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer // autoload_real.php @generated by Composer
class ComposerAutoloaderInitb7e6ef67068b48e5175bce380d4bfe2f class ComposerAutoloaderInitcd358774cbdeec4e6bc6107ae33ae515
{ {
private static $loader; private static $loader;
@ -19,15 +19,15 @@ class ComposerAutoloaderInitb7e6ef67068b48e5175bce380d4bfe2f
return self::$loader; 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(); 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()); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) { if ($useStaticLoader) {
require_once __DIR__ . '/autoload_static.php'; require_once __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInitb7e6ef67068b48e5175bce380d4bfe2f::getInitializer($loader)); call_user_func(\Composer\Autoload\ComposerStaticInitcd358774cbdeec4e6bc6107ae33ae515::getInitializer($loader));
} else { } else {
$map = require __DIR__ . '/autoload_namespaces.php'; $map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) { foreach ($map as $namespace => $path) {
@ -48,19 +48,19 @@ class ComposerAutoloaderInitb7e6ef67068b48e5175bce380d4bfe2f
$loader->register(true); $loader->register(true);
if ($useStaticLoader) { if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInitb7e6ef67068b48e5175bce380d4bfe2f::$files; $includeFiles = Composer\Autoload\ComposerStaticInitcd358774cbdeec4e6bc6107ae33ae515::$files;
} else { } else {
$includeFiles = require __DIR__ . '/autoload_files.php'; $includeFiles = require __DIR__ . '/autoload_files.php';
} }
foreach ($includeFiles as $fileIdentifier => $file) { foreach ($includeFiles as $fileIdentifier => $file) {
composerRequireb7e6ef67068b48e5175bce380d4bfe2f($fileIdentifier, $file); composerRequirecd358774cbdeec4e6bc6107ae33ae515($fileIdentifier, $file);
} }
return $loader; return $loader;
} }
} }
function composerRequireb7e6ef67068b48e5175bce380d4bfe2f($fileIdentifier, $file) function composerRequirecd358774cbdeec4e6bc6107ae33ae515($fileIdentifier, $file)
{ {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file; require $file;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload; namespace Composer\Autoload;
class ComposerStaticInitb7e6ef67068b48e5175bce380d4bfe2f class ComposerStaticInitcd358774cbdeec4e6bc6107ae33ae515
{ {
public static $files = array ( public static $files = array (
'841780ea2e1d6545ea3a253239d59c05' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/functions.php', '841780ea2e1d6545ea3a253239d59c05' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/functions.php',
@ -366,9 +366,9 @@ class ComposerStaticInitb7e6ef67068b48e5175bce380d4bfe2f
public static function getInitializer(ClassLoader $loader) public static function getInitializer(ClassLoader $loader)
{ {
return \Closure::bind(function () use ($loader) { return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInitb7e6ef67068b48e5175bce380d4bfe2f::$prefixLengthsPsr4; $loader->prefixLengthsPsr4 = ComposerStaticInitcd358774cbdeec4e6bc6107ae33ae515::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitb7e6ef67068b48e5175bce380d4bfe2f::$prefixDirsPsr4; $loader->prefixDirsPsr4 = ComposerStaticInitcd358774cbdeec4e6bc6107ae33ae515::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitb7e6ef67068b48e5175bce380d4bfe2f::$classMap; $loader->classMap = ComposerStaticInitcd358774cbdeec4e6bc6107ae33ae515::$classMap;
}, null, ClassLoader::class); }, null, ClassLoader::class);
} }

View File

@ -502,12 +502,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zoujingli/ThinkLibrary.git", "url": "https://github.com/zoujingli/ThinkLibrary.git",
"reference": "10b94d3b9dc3b0bea5e5c759b7f00a3fc057280b" "reference": "0fb1d49fde76d86487940f2b7f6bb6ff7b613648"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/10b94d3b9dc3b0bea5e5c759b7f00a3fc057280b", "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/0fb1d49fde76d86487940f2b7f6bb6ff7b613648",
"reference": "10b94d3b9dc3b0bea5e5c759b7f00a3fc057280b", "reference": "0fb1d49fde76d86487940f2b7f6bb6ff7b613648",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -527,7 +527,7 @@
"qiniu/php-sdk": "^7.2", "qiniu/php-sdk": "^7.2",
"topthink/framework": "5.1.*" "topthink/framework": "5.1.*"
}, },
"time": "2019-11-26T02:19:03+00:00", "time": "2019-11-26T03:42:04+00:00",
"type": "library", "type": "library",
"installation-source": "dist", "installation-source": "dist",
"autoload": { "autoload": {

View File

@ -72,7 +72,22 @@ abstract class Controller extends \stdClass
if (in_array($this->request->action(), get_class_methods(__CLASS__))) { if (in_array($this->request->action(), get_class_methods(__CLASS__))) {
$this->error('Access without permission.'); $this->error('Access without permission.');
} }
// 初始化控制器
$this->initialize(); $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; 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 消息内容 * @param mixed $info 消息内容