mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
Merge branch 'master' into v5
This commit is contained in:
commit
86c904c610
@ -28,14 +28,13 @@ class Plugs extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* Plugs constructor.
|
||||
* 系统选择器图标
|
||||
*/
|
||||
public function __construct()
|
||||
public function icon()
|
||||
{
|
||||
parent::__construct();
|
||||
if (!NodeService::islogin()) {
|
||||
$this->error('访问授权失败,请重新登录授权再试!');
|
||||
}
|
||||
$this->title = '图标选择器';
|
||||
$this->field = input('field', 'icon');
|
||||
$this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -46,13 +45,16 @@ class Plugs extends Controller
|
||||
*/
|
||||
public function plupload()
|
||||
{
|
||||
if (!NodeService::islogin()) {
|
||||
$this->error('访问授权失败,请重新登录授权再试!');
|
||||
}
|
||||
if (!($file = $this->getUploadFile()) || empty($file)) {
|
||||
return json(['uploaded' => false, 'error' => ['message' => '文件上传异常,文件可能过大或未上传']]);
|
||||
}
|
||||
if (!$file->checkExt(strtolower(sysconf('storage_local_exts')))) {
|
||||
return json(['uploaded' => false, 'error' => ['message' => '文件上传类型受限,请在后台配置']]);
|
||||
}
|
||||
if ($file->checkExt('php')) {
|
||||
if ($file->checkExt('php,sh')) {
|
||||
return json(['uploaded' => false, 'error' => ['message' => '可执行文件禁止上传到本地服务器']]);
|
||||
}
|
||||
$this->safe = boolval(input('safe'));
|
||||
@ -95,14 +97,4 @@ class Plugs extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 系统选择器图标
|
||||
*/
|
||||
public function icon()
|
||||
{
|
||||
$this->title = '图标选择器';
|
||||
$this->field = input('field', 'icon');
|
||||
$this->fetch();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ class Update extends Controller
|
||||
*/
|
||||
public function tree()
|
||||
{
|
||||
$sync = new Sync('Sync');
|
||||
$sync = new Sync('Update');
|
||||
$this->success('获取当前文件列表成功!', $sync->build());
|
||||
}
|
||||
|
||||
@ -46,13 +46,14 @@ class Update extends Controller
|
||||
*/
|
||||
public function read($encode)
|
||||
{
|
||||
$file = env('root_path') . decode($encode);
|
||||
if (!file_exists($file)) {
|
||||
$this->error('获取文件内容失败!');
|
||||
} else {
|
||||
$this->success('获取文件内容成功!', [
|
||||
'format' => 'base64', 'content' => base64_encode(file_get_contents($file)),
|
||||
$this->file = env('root_path') . decode($encode);
|
||||
if (file_exists($this->file)) {
|
||||
$this->success('读取文件成功!', [
|
||||
'format' => 'base64',
|
||||
'content' => base64_encode(file_get_contents($this->file)),
|
||||
]);
|
||||
} else {
|
||||
$this->error('获取文件内容失败!');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -235,14 +235,10 @@ class NodeService
|
||||
if (($uid = session('admin_user.id'))) {
|
||||
session('admin_user', Db::name('SystemUser')->where(['id' => $uid])->find());
|
||||
}
|
||||
$authorize = session('admin_user.authorize');
|
||||
if (!empty($authorize) && $authids = explode(',', $authorize)) {
|
||||
$auths = Db::name('SystemAuth')->where(['status' => '1'])->whereIn('id', $authids)->column('id');
|
||||
if (empty($auths)) {
|
||||
session('admin_user.nodes', []);
|
||||
} else {
|
||||
session('admin_user.nodes', array_unique(Db::name('SystemAuthNode')->whereIn('auth', $auths)->column('node')));
|
||||
}
|
||||
if (($aids = session('admin_user.authorize'))) {
|
||||
$where = [['status', 'eq', '1'], ['id', 'in', explode(',', $aids)]];
|
||||
$subsql = Db::name('SystemAuth')->field('id')->where($where)->buildSql();
|
||||
session('admin_user.nodes', array_unique(Db::name('SystemAuthNode')->whereRaw("auth in {$subsql}")->column('node')));
|
||||
} else {
|
||||
session('admin_user.nodes', []);
|
||||
}
|
||||
|
@ -19,9 +19,9 @@
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">电子邮箱</label>
|
||||
<label class="layui-form-label">联系邮箱</label>
|
||||
<div class="layui-input-inline">
|
||||
<input name="mail" value="{$Think.get.mail|default=''}" placeholder="请输入电子邮箱" class="layui-input">
|
||||
<input name="mail" value="{$Think.get.mail|default=''}" placeholder="请输入联系邮箱" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -54,4 +54,4 @@
|
||||
|
||||
</fieldset>
|
||||
|
||||
<script>form.render()</script>
|
||||
<script>form.render()</script>
|
||||
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
@ -4,4 +4,4 @@
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit715bbba180591c7e55267e7c41402e91::getLoader();
|
||||
return ComposerAutoloaderInit05623102e809b1029859cb55f12358ed::getLoader();
|
||||
|
14
vendor/composer/autoload_real.php
vendored
14
vendor/composer/autoload_real.php
vendored
@ -2,7 +2,7 @@
|
||||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit715bbba180591c7e55267e7c41402e91
|
||||
class ComposerAutoloaderInit05623102e809b1029859cb55f12358ed
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -19,15 +19,15 @@ class ComposerAutoloaderInit715bbba180591c7e55267e7c41402e91
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit715bbba180591c7e55267e7c41402e91', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit05623102e809b1029859cb55f12358ed', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit715bbba180591c7e55267e7c41402e91', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit05623102e809b1029859cb55f12358ed', '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\ComposerStaticInit715bbba180591c7e55267e7c41402e91::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit05623102e809b1029859cb55f12358ed::getInitializer($loader));
|
||||
} else {
|
||||
$map = require __DIR__ . '/autoload_namespaces.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
@ -48,19 +48,19 @@ class ComposerAutoloaderInit715bbba180591c7e55267e7c41402e91
|
||||
$loader->register(true);
|
||||
|
||||
if ($useStaticLoader) {
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit715bbba180591c7e55267e7c41402e91::$files;
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit05623102e809b1029859cb55f12358ed::$files;
|
||||
} else {
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
}
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequire715bbba180591c7e55267e7c41402e91($fileIdentifier, $file);
|
||||
composerRequire05623102e809b1029859cb55f12358ed($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
}
|
||||
}
|
||||
|
||||
function composerRequire715bbba180591c7e55267e7c41402e91($fileIdentifier, $file)
|
||||
function composerRequire05623102e809b1029859cb55f12358ed($fileIdentifier, $file)
|
||||
{
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
require $file;
|
||||
|
8
vendor/composer/autoload_static.php
vendored
8
vendor/composer/autoload_static.php
vendored
@ -4,7 +4,7 @@
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit715bbba180591c7e55267e7c41402e91
|
||||
class ComposerStaticInit05623102e809b1029859cb55f12358ed
|
||||
{
|
||||
public static $files = array (
|
||||
'841780ea2e1d6545ea3a253239d59c05' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/functions.php',
|
||||
@ -347,9 +347,9 @@ class ComposerStaticInit715bbba180591c7e55267e7c41402e91
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit715bbba180591c7e55267e7c41402e91::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit715bbba180591c7e55267e7c41402e91::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit715bbba180591c7e55267e7c41402e91::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit05623102e809b1029859cb55f12358ed::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit05623102e809b1029859cb55f12358ed::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit05623102e809b1029859cb55f12358ed::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
8
vendor/composer/installed.json
vendored
8
vendor/composer/installed.json
vendored
@ -502,12 +502,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/zoujingli/ThinkLibrary.git",
|
||||
"reference": "f3eeca76e07fc7b21f9879ca1ead5b2f30c97d99"
|
||||
"reference": "c278499d1e7be0db3b76388112ae26038205d052"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/f3eeca76e07fc7b21f9879ca1ead5b2f30c97d99",
|
||||
"reference": "f3eeca76e07fc7b21f9879ca1ead5b2f30c97d99",
|
||||
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/c278499d1e7be0db3b76388112ae26038205d052",
|
||||
"reference": "c278499d1e7be0db3b76388112ae26038205d052",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
@ -526,7 +526,7 @@
|
||||
"qiniu/php-sdk": "^7.2",
|
||||
"topthink/framework": "5.1.*"
|
||||
},
|
||||
"time": "2019-07-19T03:42:10+00:00",
|
||||
"time": "2019-07-20T03:04:58+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
|
@ -16,6 +16,8 @@
|
||||
namespace library\command;
|
||||
|
||||
use think\console\Command;
|
||||
use think\console\Input;
|
||||
use think\console\Output;
|
||||
|
||||
/**
|
||||
* 清理会话文件
|
||||
@ -25,22 +27,30 @@ use think\console\Command;
|
||||
class Sess extends Command
|
||||
{
|
||||
|
||||
/**
|
||||
* 指令属性配置
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('xclean:session')->setDescription('清理失效过期的会话文件');
|
||||
}
|
||||
|
||||
protected function execute(\think\console\Input $input, \think\console\Output $output)
|
||||
/**
|
||||
* 执行清理操作
|
||||
* @param Input $input
|
||||
* @param Output $output
|
||||
*/
|
||||
protected function execute(Input $input, Output $output)
|
||||
{
|
||||
$output->writeln('Start cleaning up invalid session files');
|
||||
$output->comment('=== 准备清理无效的会话文件 ===');
|
||||
foreach (glob(config('session.path') . 'sess_*') as $file) {
|
||||
list($fileatime, $filesize) = [fileatime($file), filesize($file)];
|
||||
if ($filesize < 1 || $fileatime < time() - 3600) {
|
||||
$output->writeln('clear session file -> [ ' . date('Y-m-d H:i:s', $fileatime) . ' ] ' . basename($file) . " {$filesize}");
|
||||
$output->info('clear session file -> [ ' . date('Y-m-d H:i:s', $fileatime) . ' ] ' . basename($file) . " {$filesize}");
|
||||
@unlink($file);
|
||||
}
|
||||
}
|
||||
$output->writeln('Complete cleaning of invalid session files');
|
||||
$output->comment('=== 成功清理无效的会话文件 ===');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ class Sync extends Command
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行指令
|
||||
* 执行更新操作
|
||||
* @param Input $input
|
||||
* @param Output $output
|
||||
*/
|
||||
|
@ -25,17 +25,26 @@ use think\console\Output;
|
||||
*/
|
||||
class Admin extends Sync
|
||||
{
|
||||
|
||||
/**
|
||||
* 指令属性配置
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this->modules = ['application/admin/', 'think'];
|
||||
$this->setName('xsync:admin')->setDescription('从远程覆盖本地Admin模块的所有代码');
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行更新操作
|
||||
* @param Input $input
|
||||
* @param Output $output
|
||||
*/
|
||||
protected function execute(Input $input, Output $output)
|
||||
{
|
||||
$root = str_replace('\\', '/', env('root_path'));
|
||||
if (file_exists("{$root}/application/admin/sync.lock")) {
|
||||
$this->output->error('admin module has been locked');
|
||||
$this->output->error("--- Admin 模块已经被锁定,不能继续更新");
|
||||
} else {
|
||||
parent::execute($input, $output);
|
||||
}
|
||||
|
@ -25,17 +25,26 @@ use think\console\Output;
|
||||
*/
|
||||
class Config extends Sync
|
||||
{
|
||||
|
||||
/**
|
||||
* 指令属性配置
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this->modules = ['config/'];
|
||||
$this->setName('xsync:config')->setDescription('从远程覆盖本地Config的部分配置文件');
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行更新操作
|
||||
* @param Input $input
|
||||
* @param Output $output
|
||||
*/
|
||||
protected function execute(Input $input, Output $output)
|
||||
{
|
||||
$root = str_replace('\\', '/', env('root_path'));
|
||||
if (file_exists("{$root}/config/sync.lock")) {
|
||||
$this->output->error('config files has been locked');
|
||||
$this->output->error("--- Config 配置已经被锁定,不能继续更新");
|
||||
} else {
|
||||
parent::execute($input, $output);
|
||||
}
|
||||
|
@ -25,17 +25,26 @@ use think\console\Output;
|
||||
*/
|
||||
class Plugs extends Sync
|
||||
{
|
||||
|
||||
/**
|
||||
* 指令属性配置
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this->modules = ['public/static/'];
|
||||
$this->setName('xsync:plugs')->setDescription('从远程覆盖本地Plugs资源插件等代码');
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行更新操作
|
||||
* @param Input $input
|
||||
* @param Output $output
|
||||
*/
|
||||
protected function execute(Input $input, Output $output)
|
||||
{
|
||||
$root = str_replace('\\', '/', env('root_path'));
|
||||
if (file_exists("{$root}/public/static/sync.lock")) {
|
||||
$this->output->error('plugs static files has been locked');
|
||||
$this->output->error("--- Plugs 资源已经被锁定,不能继续更新");
|
||||
} else {
|
||||
parent::execute($input, $output);
|
||||
}
|
||||
|
@ -25,17 +25,25 @@ use think\console\Output;
|
||||
*/
|
||||
class Service extends Sync
|
||||
{
|
||||
/**
|
||||
* 指令属性配置
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this->modules = ['application/service/'];
|
||||
$this->setName('xsync:service')->setDescription('从远程覆盖本地Service模块的所有代码');
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行更新操作
|
||||
* @param Input $input
|
||||
* @param Output $output
|
||||
*/
|
||||
protected function execute(Input $input, Output $output)
|
||||
{
|
||||
$root = str_replace('\\', '/', env('root_path'));
|
||||
if (file_exists("{$root}/application/service/sync.lock")) {
|
||||
$this->output->error('service module has been locked');
|
||||
$this->output->error("--- Service 模块已经被锁定,不能继续更新");
|
||||
} else {
|
||||
parent::execute($input, $output);
|
||||
}
|
||||
|
@ -25,17 +25,26 @@ use think\console\Output;
|
||||
*/
|
||||
class Wechat extends Sync
|
||||
{
|
||||
|
||||
/**
|
||||
* 指令属性配置
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this->modules = ['application/wechat/'];
|
||||
$this->setName('xsync:wechat')->setDescription('从远程覆盖本地Wechat模块的所有代码');
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行更新操作
|
||||
* @param Input $input
|
||||
* @param Output $output
|
||||
*/
|
||||
protected function execute(Input $input, Output $output)
|
||||
{
|
||||
$root = str_replace('\\', '/', env('root_path'));
|
||||
if (file_exists("{$root}/application/wechat/sync.lock")) {
|
||||
$this->output->error('wechat module has been locked');
|
||||
$this->output->error("--- Wechat 模块已经被锁定,不能继续更新");
|
||||
} else {
|
||||
parent::execute($input, $output);
|
||||
}
|
||||
|
@ -16,6 +16,8 @@
|
||||
namespace library\command\task;
|
||||
|
||||
use library\command\Task;
|
||||
use think\console\Input;
|
||||
use think\console\Output;
|
||||
|
||||
/**
|
||||
* Class Reset
|
||||
@ -24,12 +26,21 @@ use library\command\Task;
|
||||
class Reset extends Task
|
||||
{
|
||||
|
||||
/**
|
||||
* 指令属性配置
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('xtask:reset')->setDescription('重新启动消息队列守护进程');
|
||||
}
|
||||
|
||||
protected function execute(\think\console\Input $input, \think\console\Output $output)
|
||||
/**
|
||||
* 执行重置操作
|
||||
* @param Input $input
|
||||
* @param Output $output
|
||||
* @return int|void|null
|
||||
*/
|
||||
protected function execute(Input $input, Output $output)
|
||||
{
|
||||
if (($pid = $this->checkProcess()) > 0) {
|
||||
$this->closeProcess($pid);
|
||||
|
@ -16,6 +16,8 @@
|
||||
namespace library\command\task;
|
||||
|
||||
use library\command\Task;
|
||||
use think\console\Input;
|
||||
use think\console\Output;
|
||||
|
||||
/**
|
||||
* Class Start
|
||||
@ -24,12 +26,20 @@ use library\command\Task;
|
||||
class Start extends Task
|
||||
{
|
||||
|
||||
/**
|
||||
* 指令属性配置
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('xtask:start')->setDescription('开始启动消息队列守护进程');
|
||||
}
|
||||
|
||||
protected function execute(\think\console\Input $input, \think\console\Output $output)
|
||||
/**
|
||||
* 执行启动操作
|
||||
* @param Input $input
|
||||
* @param Output $output
|
||||
*/
|
||||
protected function execute(Input $input, Output $output)
|
||||
{
|
||||
if (($pid = $this->checkProcess()) > 0) {
|
||||
$output->info("The message queue daemon {$pid} already exists!");
|
||||
|
@ -16,6 +16,8 @@
|
||||
namespace library\command\task;
|
||||
|
||||
use library\command\Task;
|
||||
use think\console\Input;
|
||||
use think\console\Output;
|
||||
|
||||
/**
|
||||
* Class State
|
||||
@ -24,12 +26,20 @@ use library\command\Task;
|
||||
class State extends Task
|
||||
{
|
||||
|
||||
/**
|
||||
* 指令属性配置
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('xtask:state')->setDescription('查看消息队列守护进程状态');
|
||||
}
|
||||
|
||||
protected function execute(\think\console\Input $input, \think\console\Output $output)
|
||||
/**
|
||||
* 执行查询操作
|
||||
* @param Input $input
|
||||
* @param Output $output
|
||||
*/
|
||||
protected function execute(Input $input, Output $output)
|
||||
{
|
||||
if (($pid = $this->checkProcess()) > 0) {
|
||||
$output->info("message queue daemon {$pid} is runing.");
|
||||
|
@ -16,6 +16,8 @@
|
||||
namespace library\command\task;
|
||||
|
||||
use library\command\Task;
|
||||
use think\console\Input;
|
||||
use think\console\Output;
|
||||
|
||||
/**
|
||||
* Class Stop
|
||||
@ -24,12 +26,20 @@ use library\command\Task;
|
||||
class Stop extends Task
|
||||
{
|
||||
|
||||
/**
|
||||
* 指令属性配置
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('xtask:stop')->setDescription('立即停止消息队列守护进程');
|
||||
}
|
||||
|
||||
protected function execute(\think\console\Input $input, \think\console\Output $output)
|
||||
/**
|
||||
* 执行停止操作
|
||||
* @param Input $input
|
||||
* @param Output $output
|
||||
*/
|
||||
protected function execute(Input $input, Output $output)
|
||||
{
|
||||
if (($pid = $this->checkProcess()) > 0) {
|
||||
$this->closeProcess($pid);
|
||||
|
Loading…
x
Reference in New Issue
Block a user