修复后台登录

This commit is contained in:
tao 2021-12-30 16:36:48 +08:00
parent 13037f7440
commit cd50418e62
11 changed files with 95 additions and 41 deletions

View File

@ -3,8 +3,8 @@
> TaoLer是一个简单迅捷的轻论坛系统适用于个人或组织区域型信息交流发布平台。
* 官网https://www.aieok.com
* 版本TaoLer 1.8.17
* 日期2021.12.25
* 版本TaoLer 1.8.18
* 日期2021.12.30
webman版新架构已适配90%

View File

@ -28,13 +28,7 @@ class Login extends AdminController
$user = new \app\admin\model\Admin();
$result = $user->login($data);
if ($result == 1) {
$res = ['code'=>0,'msg'=>'登陆成功', 'url'=>(string) url('index/index')];
//$res['data']['access_token'] = $data['__token__'];
} else {
$res = ['code'=>-1,'msg'=>$result,'url'=>(string) url('admin/login')];
}
return json($res);
return $result;
}
return View::fetch('login');
}

View File

@ -26,6 +26,7 @@ use think\facade\Log;
use app\common\lib\ZipFile;
use app\common\lib\SetConf;
use app\common\lib\SqlFile;
use app\common\lib\Zip;
class Upgrade extends AdminController
{
@ -237,10 +238,12 @@ class Upgrade extends AdminController
private function execute_update(string $package_file)
{
//解压 zip文件有密码的话需要解密
$uzip = new ZipFile();
//$uzip = new ZipFile();
$zip = new Zip;
$zipDir = strstr($package_file, '.zip',true); //返回文件名后缀前的字符串
$zipPath = Files::getDirPath($zipDir); //转换为带/的路径 压缩文件解压到的路径
$unzip_res = $uzip->unzip($package_file,$zipPath,true);
//$unzip_res = $uzip->unzip($package_file,$zipPath,true);
$unzip_res = $zip->unzip($package_file,$zipPath);
if(!$unzip_res)
{

55
app/common/lib/Zip.php Normal file
View File

@ -0,0 +1,55 @@
<?php
namespace app\common\lib;
class Zip
{
/**
* 压缩文件
* @param array $files 待压缩文件 array('d:/test/1.txt''d:/test/2.jpg');【文件地址为绝对路径】
* @param string $filePath 输出文件路径 【绝对文件地址】 d:/test/new.zip
* @return string|bool
*/
function zip($files, $filePath) {
//检查参数
if (empty($files) || empty($filePath)) {
return false;
}
//压缩文件
$zip = new \ZipArchive();
$zip->open($filePath, ZipArchive::CREATE);
foreach ($files as $key => $file) {
//检查文件是否存在
if (!file_exists($file)) {
return false;
}
$zip->addFile($file, basename($file));
}
$zip->close();
return true;
}
/**
* zip解压方法
* @param string $filePath 压缩包所在地址 【绝对文件地址】d:/test/123.zip
* @param string $path 解压路径 【绝对文件目录路径】d:/test
* @return bool
*/
function unzip($filePath, $path) {
if (empty($path) || empty($filePath)) {
return false;
}
$zip = new \ZipArchive();
if ($zip->open($filePath) === true) {
$zip->extractTo($path);
$zip->close();
return true;
} else {
return false;
}
}
}
?>

12
composer.lock generated
View File

@ -1465,16 +1465,16 @@
},
{
"name": "symfony/var-dumper",
"version": "v4.4.34",
"version": "v4.4.36",
"source": {
"type": "git",
"url": "https://github.com/symfony/var-dumper.git",
"reference": "2d0c056b2faaa3d785bdbd5adecc593a5be9c16e"
"reference": "02685c62fcbc4262235cc72a54fbd45ab719ce3c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/2d0c056b2faaa3d785bdbd5adecc593a5be9c16e",
"reference": "2d0c056b2faaa3d785bdbd5adecc593a5be9c16e",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/02685c62fcbc4262235cc72a54fbd45ab719ce3c",
"reference": "02685c62fcbc4262235cc72a54fbd45ab719ce3c",
"shasum": "",
"mirrors": [
{
@ -1540,7 +1540,7 @@
"dump"
],
"support": {
"source": "https://github.com/symfony/var-dumper/tree/v4.4.34"
"source": "https://github.com/symfony/var-dumper/tree/v4.4.36"
},
"funding": [
{
@ -1556,7 +1556,7 @@
"type": "tidelift"
}
],
"time": "2021-11-12T10:50:54+00:00"
"time": "2021-12-29T09:28:53+00:00"
},
{
"name": "topthink/think-trace",

View File

@ -11,8 +11,8 @@ return array(
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
'25072dd6e2470089de65ae7bf11d3109' => $vendorDir . '/symfony/polyfill-php72/bootstrap.php',
'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php',
'667aeda72477189d0494fecd327c3641' => $vendorDir . '/symfony/var-dumper/Resources/functions/dump.php',
'223fa6f9b46fbe5d6b44c5ff847bfceb' => $vendorDir . '/taoser/think-addons/src/helper.php',
'1cfd2761b63b0a29ed23657ea394cb2d' => $vendorDir . '/topthink/think-captcha/src/helper.php',
'667aeda72477189d0494fecd327c3641' => $vendorDir . '/symfony/var-dumper/Resources/functions/dump.php',
'd421242fd42b2ea6cd13f802bcf18a6e' => $baseDir . '/extend/taoler/com/form.php',
);

View File

@ -12,9 +12,9 @@ class ComposerStaticInit1b32198725235c8d6500c87262ef30c2
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
'25072dd6e2470089de65ae7bf11d3109' => __DIR__ . '/..' . '/symfony/polyfill-php72/bootstrap.php',
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
'667aeda72477189d0494fecd327c3641' => __DIR__ . '/..' . '/symfony/var-dumper/Resources/functions/dump.php',
'223fa6f9b46fbe5d6b44c5ff847bfceb' => __DIR__ . '/..' . '/taoser/think-addons/src/helper.php',
'1cfd2761b63b0a29ed23657ea394cb2d' => __DIR__ . '/..' . '/topthink/think-captcha/src/helper.php',
'667aeda72477189d0494fecd327c3641' => __DIR__ . '/..' . '/symfony/var-dumper/Resources/functions/dump.php',
'd421242fd42b2ea6cd13f802bcf18a6e' => __DIR__ . '/../..' . '/extend/taoler/com/form.php',
);

View File

@ -926,17 +926,17 @@
},
{
"name": "symfony/var-dumper",
"version": "v4.4.34",
"version_normalized": "4.4.34.0",
"version": "v4.4.36",
"version_normalized": "4.4.36.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/var-dumper.git",
"reference": "2d0c056b2faaa3d785bdbd5adecc593a5be9c16e"
"reference": "02685c62fcbc4262235cc72a54fbd45ab719ce3c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/2d0c056b2faaa3d785bdbd5adecc593a5be9c16e",
"reference": "2d0c056b2faaa3d785bdbd5adecc593a5be9c16e",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/02685c62fcbc4262235cc72a54fbd45ab719ce3c",
"reference": "02685c62fcbc4262235cc72a54fbd45ab719ce3c",
"shasum": "",
"mirrors": [
{
@ -966,7 +966,7 @@
"ext-intl": "To show region name in time zone dump",
"symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script"
},
"time": "2021-11-12T10:50:54+00:00",
"time": "2021-12-29T09:28:53+00:00",
"bin": [
"Resources/bin/var-dump-server"
],
@ -1004,7 +1004,7 @@
"dump"
],
"support": {
"source": "https://github.com/symfony/var-dumper/tree/v4.4.34"
"source": "https://github.com/symfony/var-dumper/tree/v4.4.36"
},
"funding": [
{

View File

@ -5,7 +5,7 @@
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => 'b6eb893a4cc88c8d03d8d6fdcbf1663ccc8b1cc6',
'reference' => '13037f7440f2dcce2cd78297df9d6a675744ecad',
'name' => 'taoser/taoler',
'dev' => true,
),
@ -128,12 +128,12 @@
'dev_requirement' => true,
),
'symfony/var-dumper' => array(
'pretty_version' => 'v4.4.34',
'version' => '4.4.34.0',
'pretty_version' => 'v4.4.36',
'version' => '4.4.36.0',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/var-dumper',
'aliases' => array(),
'reference' => '2d0c056b2faaa3d785bdbd5adecc593a5be9c16e',
'reference' => '02685c62fcbc4262235cc72a54fbd45ab719ce3c',
'dev_requirement' => true,
),
'taoser/taoler' => array(
@ -142,7 +142,7 @@
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => 'b6eb893a4cc88c8d03d8d6fdcbf1663ccc8b1cc6',
'reference' => '13037f7440f2dcce2cd78297df9d6a675744ecad',
'dev_requirement' => false,
),
'taoser/think-addons' => array(

2
vendor/services.php vendored
View File

@ -1,5 +1,5 @@
<?php
// This file is automatically generated at:2021-12-10 19:21:13
// This file is automatically generated at:2021-12-30 16:35:53
declare (strict_types = 1);
return array (
0 => 'taoser\\addons\\Service',

View File

@ -134,7 +134,7 @@ class ReflectionCaster
array_unshift($trace, [
'function' => 'yield',
'file' => $function->getExecutingFile(),
'line' => $function->getExecutingLine() - 1,
'line' => $function->getExecutingLine() - (int) (\PHP_VERSION_ID < 80100),
]);
$trace[] = $frame;
$a[$prefix.'trace'] = new TraceStub($trace, false, 0, -1, -1);
@ -263,15 +263,17 @@ class ReflectionCaster
unset($a[$prefix.'allowsNull']);
}
try {
$a[$prefix.'default'] = $v = $c->getDefaultValue();
if ($c->isDefaultValueConstant()) {
$a[$prefix.'default'] = new ConstStub($c->getDefaultValueConstantName(), $v);
if ($c->isOptional()) {
try {
$a[$prefix.'default'] = $v = $c->getDefaultValue();
if ($c->isDefaultValueConstant()) {
$a[$prefix.'default'] = new ConstStub($c->getDefaultValueConstantName(), $v);
}
if (null === $v) {
unset($a[$prefix.'allowsNull']);
}
} catch (\ReflectionException $e) {
}
if (null === $v) {
unset($a[$prefix.'allowsNull']);
}
} catch (\ReflectionException $e) {
}
return $a;