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()
{
$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'));
}

2
vendor/autoload.php vendored
View File

@ -4,4 +4,4 @@
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
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;

View File

@ -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);
}

View File

@ -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": {

View File

@ -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 消息内容