ComposerUpdate

This commit is contained in:
Anyon 2020-04-26 10:49:10 +08:00
parent 08e026adda
commit 56cd916948
7 changed files with 36 additions and 25 deletions

View File

@ -42,10 +42,10 @@ class Plugs extends Controller
* 网站压缩发布 * 网站压缩发布
* @login true * @login true
*/ */
public function online() public function push()
{ {
try { try {
if (AdminService::instance()->getUserName() !== 'admin') { if (AdminService::instance()->isSuper()) {
$this->error('只有超级管理员才能操作!'); $this->error('只有超级管理员才能操作!');
} }
$this->app->console->call('optimize:route'); $this->app->console->call('optimize:route');
@ -65,7 +65,7 @@ class Plugs extends Controller
public function clear() public function clear()
{ {
try { try {
if (AdminService::instance()->getUserName() !== 'admin') { if (AdminService::instance()->isSuper()) {
$this->error('只有超级管理员才能操作!'); $this->error('只有超级管理员才能操作!');
} }
$data = SystemService::instance()->getRuntime(); $data = SystemService::instance()->getRuntime();
@ -86,7 +86,7 @@ class Plugs extends Controller
public function debug() public function debug()
{ {
if (input('state')) { if (input('state')) {
if (AdminService::instance()->getUserName() !== 'admin') { if (AdminService::instance()->isSuper()) {
$this->error('只有超级管理员才能操作!'); $this->error('只有超级管理员才能操作!');
} }
SystemService::instance()->productMode(true); SystemService::instance()->productMode(true);
@ -103,7 +103,7 @@ class Plugs extends Controller
*/ */
public function optimize() public function optimize()
{ {
if (AdminService::instance()->getUserName() !== 'admin') { if (AdminService::instance()->isSuper()) {
$this->error('只有超级管理员才能操作!'); $this->error('只有超级管理员才能操作!');
} }
$this->_queue('优化数据库所有数据表', 'xadmin:dbOptimize', 0, [], 0, 0); $this->_queue('优化数据库所有数据表', 'xadmin:dbOptimize', 0, [], 0, 0);

View File

@ -51,7 +51,7 @@
<dd lay-unselect><a data-modal="{:url('admin/index/info',['id'=>session('user.id')])}"><i class="layui-icon layui-icon-set-fill margin-right-5"></i> 基本资料</a></dd> <dd lay-unselect><a data-modal="{:url('admin/index/info',['id'=>session('user.id')])}"><i class="layui-icon layui-icon-set-fill margin-right-5"></i> 基本资料</a></dd>
<dd lay-unselect><a data-modal="{:url('admin/index/pass',['id'=>session('user.id')])}"><i class="layui-icon layui-icon-component margin-right-5"></i> 安全设置</a></dd> <dd lay-unselect><a data-modal="{:url('admin/index/pass',['id'=>session('user.id')])}"><i class="layui-icon layui-icon-component margin-right-5"></i> 安全设置</a></dd>
{if session('user.username') eq 'admin'} {if session('user.username') eq 'admin'}
<dd lay-unselect><a data-load="{:url('admin/api.plugs/online')}"><i class="layui-icon layui-icon-template-1 margin-right-5"></i> 缓存加速</a></dd> <dd lay-unselect><a data-load="{:url('admin/api.plugs/push')}"><i class="layui-icon layui-icon-template-1 margin-right-5"></i> 缓存加速</a></dd>
<dd lay-unselect><a data-load="{:url('admin/api.plugs/clear')}"><i class="layui-icon layui-icon-fonts-clear margin-right-5"></i> 清理缓存</a></dd> <dd lay-unselect><a data-load="{:url('admin/api.plugs/clear')}"><i class="layui-icon layui-icon-fonts-clear margin-right-5"></i> 清理缓存</a></dd>
{/if} {/if}
<dd lay-unselect><a data-load="{:url('admin/login/out')}" data-confirm="确定要退出登录吗?"><i class="layui-icon layui-icon-release margin-right-5"></i> 退出登录</a></dd> <dd lay-unselect><a data-load="{:url('admin/login/out')}" data-confirm="确定要退出登录吗?"><i class="layui-icon layui-icon-release margin-right-5"></i> 退出登录</a></dd>

View File

@ -17,12 +17,14 @@
"require": { "require": {
"php": ">=7.1.0", "php": ">=7.1.0",
"ext-gd": "*", "ext-gd": "*",
"ext-xml": "*",
"ext-soap": "*", "ext-soap": "*",
"ext-json": "*", "ext-json": "*",
"ext-curl": "*", "ext-curl": "*",
"ext-iconv": "*", "ext-iconv": "*",
"ext-openssl": "*", "ext-openssl": "*",
"ext-mbstring": "*", "ext-mbstring": "*",
"ext-simplexml": "*",
"endroid/qr-code": "^1.9", "endroid/qr-code": "^1.9",
"topthink/framework": "^6.0", "topthink/framework": "^6.0",
"topthink/think-view": "^1.0", "topthink/think-view": "^1.0",

14
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "c55d51d2e1cb52e013e7635caf4fb45c", "content-hash": "ca7a0ef3ca75a7287eb4c5ecf7e156f3",
"packages": [ "packages": [
{ {
"name": "endroid/qr-code", "name": "endroid/qr-code",
@ -909,12 +909,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zoujingli/ThinkLibrary.git", "url": "https://github.com/zoujingli/ThinkLibrary.git",
"reference": "e4c99cc5188f842c2842b0822e9e93328932900d" "reference": "692d1f717a5010707d7bd4148d028602f0e3ba00"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/e4c99cc5188f842c2842b0822e9e93328932900d", "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/692d1f717a5010707d7bd4148d028602f0e3ba00",
"reference": "e4c99cc5188f842c2842b0822e9e93328932900d", "reference": "692d1f717a5010707d7bd4148d028602f0e3ba00",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -958,7 +958,7 @@
], ],
"description": "ThinkPHP v6.0 Development Library", "description": "ThinkPHP v6.0 Development Library",
"homepage": "http://framework.thinkadmin.top", "homepage": "http://framework.thinkadmin.top",
"time": "2020-04-23T09:59:16+00:00" "time": "2020-04-26T02:44:32+00:00"
}, },
{ {
"name": "zoujingli/wechat-developer", "name": "zoujingli/wechat-developer",
@ -1037,12 +1037,14 @@
"platform": { "platform": {
"php": ">=7.1.0", "php": ">=7.1.0",
"ext-gd": "*", "ext-gd": "*",
"ext-xml": "*",
"ext-soap": "*", "ext-soap": "*",
"ext-json": "*", "ext-json": "*",
"ext-curl": "*", "ext-curl": "*",
"ext-iconv": "*", "ext-iconv": "*",
"ext-openssl": "*", "ext-openssl": "*",
"ext-mbstring": "*" "ext-mbstring": "*",
"ext-simplexml": "*"
}, },
"platform-dev": [] "platform-dev": []
} }

View File

@ -935,12 +935,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zoujingli/ThinkLibrary.git", "url": "https://github.com/zoujingli/ThinkLibrary.git",
"reference": "e4c99cc5188f842c2842b0822e9e93328932900d" "reference": "692d1f717a5010707d7bd4148d028602f0e3ba00"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/e4c99cc5188f842c2842b0822e9e93328932900d", "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/692d1f717a5010707d7bd4148d028602f0e3ba00",
"reference": "e4c99cc5188f842c2842b0822e9e93328932900d", "reference": "692d1f717a5010707d7bd4148d028602f0e3ba00",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -956,7 +956,7 @@
"ext-json": "*", "ext-json": "*",
"topthink/framework": "^6.0" "topthink/framework": "^6.0"
}, },
"time": "2020-04-23T09:59:16+00:00", "time": "2020-04-26T02:44:32+00:00",
"type": "library", "type": "library",
"extra": { "extra": {
"think": { "think": {

2
vendor/services.php vendored
View File

@ -1,5 +1,5 @@
<?php <?php
// This file is automatically generated at:2020-04-26 09:33:53 // This file is automatically generated at:2020-04-26 10:47:27
declare (strict_types = 1); declare (strict_types = 1);
return array ( return array (
0 => 'think\\app\\Service', 0 => 'think\\app\\Service',

View File

@ -27,12 +27,21 @@ class AdminService extends Service
{ {
/** /**
* 判断是否已经登录 * 是否已经登录
* @return boolean * @return boolean
*/ */
public function isLogin() public function isLogin()
{ {
return $this->app->session->get('user.id') ? true : false; return $this->getUserId() > 0;
}
/**
* 是否为超级用户
* @return boolean
*/
public function isSuper()
{
return $this->getUserName() === 'admin';
} }
/** /**
@ -62,8 +71,8 @@ class AdminService extends Service
*/ */
public function check($node = '') public function check($node = '')
{ {
if ($this->isSuper()) return true;
$service = NodeService::instance(); $service = NodeService::instance();
if ($this->app->session->get('user.username') === 'admin') return true;
list($real, $nodes) = [$service->fullnode($node), $service->getMethods()]; list($real, $nodes) = [$service->fullnode($node), $service->getMethods()];
if (!empty($nodes[$real]['isauth'])) { if (!empty($nodes[$real]['isauth'])) {
return in_array($real, $this->app->session->get('user.nodes', [])); return in_array($real, $this->app->session->get('user.nodes', []));
@ -80,11 +89,9 @@ class AdminService extends Service
*/ */
public function getTree($checkeds = []) public function getTree($checkeds = [])
{ {
list($nodes, $pnodes) = [[], []]; list($nodes, $pnodes, $methods) = [[], [], array_reverse(NodeService::instance()->getMethods())];
$methods = array_reverse(NodeService::instance()->getMethods());
foreach ($methods as $node => $method) { foreach ($methods as $node => $method) {
$count = substr_count($node, '/'); list($count, $pnode) = [substr_count($node, '/'), substr($node, 0, strripos($node, '/'))];
$pnode = substr($node, 0, strripos($node, '/'));
if ($count === 2 && !empty($method['isauth'])) { if ($count === 2 && !empty($method['isauth'])) {
in_array($pnode, $pnodes) or array_push($pnodes, $pnode); in_array($pnode, $pnodes) or array_push($pnodes, $pnode);
$nodes[$node] = ['node' => $node, 'title' => $method['title'], 'pnode' => $pnode, 'checked' => in_array($node, $checkeds)]; $nodes[$node] = ['node' => $node, 'title' => $method['title'], 'pnode' => $pnode, 'checked' => in_array($node, $checkeds)];
@ -110,7 +117,7 @@ class AdminService extends Service
*/ */
public function apply($force = false) public function apply($force = false)
{ {
if ($force) $this->app->cache->delete('system_auth_node'); if ($force) $this->clearCache();
if (($uid = $this->app->session->get('user.id'))) { if (($uid = $this->app->session->get('user.id'))) {
$user = $this->app->db->name('SystemUser')->where(['id' => $uid])->find(); $user = $this->app->db->name('SystemUser')->where(['id' => $uid])->find();
if (($aids = $user['authorize'])) { if (($aids = $user['authorize'])) {