更新代码

This commit is contained in:
2019-08-03 08:46:27 +08:00
parent 380e1345e6
commit d1e5d45486
13 changed files with 109 additions and 218 deletions

View File

@@ -9,6 +9,7 @@
namespace app\controller\admin;
use app\controller\Admin;
use think\facade\Db;
class Database extends Admin{
@@ -16,8 +17,11 @@ class Database extends Admin{
* @title 数据备份
*/
public function export(){
$list = Db::query('SHOW TABLE STATUS');
$list = array_map('array_change_key_case', $list);
$this->data['data'] = array(
'list' => array()
'list' => $list
);
return $this->data;
}
@@ -25,8 +29,41 @@ class Database extends Admin{
* @title 数据导入
*/
public function import(){
//列出备份文件列表
$path = app()->getRuntimePath() . 'backup';
if (!is_dir($path)) {
mkdir($path, 0755, true);
}
$path = realpath($path);
$flag = \FilesystemIterator::KEY_AS_FILENAME;
$glob = new \FilesystemIterator($path, $flag);
$list = array();
foreach ($glob as $name => $file) {
if (preg_match('/^\d{8,8}-\d{6,6}-\d+\.sql(?:\.gz)?$/', $name)) {
$name = sscanf($name, '%4s%2s%2s-%2s%2s%2s-%d');
$date = "{$name[0]}-{$name[1]}-{$name[2]}";
$time = "{$name[3]}:{$name[4]}:{$name[5]}";
$part = $name[6];
if (isset($list["{$date} {$time}"])) {
$info = $list["{$date} {$time}"];
$info['part'] = max($info['part'], $part);
$info['size'] = $info['size'] + $file->getSize();
} else {
$info['part'] = $part;
$info['size'] = $file->getSize();
}
$extension = strtoupper(pathinfo($file->getFilename(), PATHINFO_EXTENSION));
$info['compress'] = ($extension === 'SQL') ? '-' : $extension;
$info['time'] = strtotime("{$date} {$time}");
$list["{$date} {$time}"] = $info;
}
}
$this->data['data'] = array(
'list' => array()
'list' => $list
);
return $this->data;
}

View File

@@ -8,5 +8,5 @@ return [
// Session初始化
\think\middleware\SessionInit::class,
// 页面Trace调试
// \think\middleware\TraceDebug::class,
\think\middleware\TraceDebug::class,
];

View File

@@ -51,6 +51,7 @@ class Admin {
);
$template = (isset($this->data['template']) && $this->data['template']) ? $this->data['template'] : $template;
return View::config($config)
->assign('sent_version', sent_version)
->assign('config', (isset($this->data['config']) ? $this->data['config'] : []))

View File

@@ -17,7 +17,7 @@ use think\facade\View;
*/
class AdminAuth {
protected $data = ['headerMenu' => [], 'asideMenu' => []];
protected $data = ['headerMenu' => [], 'asideMenu' => [], 'meta_title' => ''];
public function handle($request, \Closure $next) {
$user = Session::get('user');
@@ -44,9 +44,10 @@ class AdminAuth {
$current_url = $current_controller . '/' . strtolower($request->action());
$menu = Cache::get('menu');
if (!$menu) {
$dao = new \app\model\Menu();
$res = $dao->where('is_menu', 1)->select();
$menu = $res->toArray();
$res = (new \app\model\Menu())->where('is_menu', 1)->select();
foreach ($res as $key => $item) {
$menu[$item['id']] = $item->toArray();
}
Cache::set('menu', $menu);
}
$current_pid = 0;
@@ -79,6 +80,9 @@ class AdminAuth {
} else {
$value['active'] = false;
}
if (strpos($value['url'], $current_url) !== false) {
$this->data['meta_title'] = $value['title'];
}
$asideMenu[$value['group']][] = $value;
}

221
composer.lock generated
View File

@@ -436,12 +436,12 @@
"source": {
"type": "git",
"url": "https://github.com/top-think/framework.git",
"reference": "b7317bbede8ee15ce01d54133a4a286d15e0472c"
"reference": "a38ebc73724c2da464b1fcee651f970dcc7a85f4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/top-think/framework/zipball/b7317bbede8ee15ce01d54133a4a286d15e0472c",
"reference": "b7317bbede8ee15ce01d54133a4a286d15e0472c",
"url": "https://api.github.com/repos/top-think/framework/zipball/a38ebc73724c2da464b1fcee651f970dcc7a85f4",
"reference": "a38ebc73724c2da464b1fcee651f970dcc7a85f4",
"shasum": "",
"mirrors": [
{
@@ -451,13 +451,16 @@
]
},
"require": {
"ext-json": "*",
"ext-mbstring": "*",
"league/flysystem": "^1.0",
"league/flysystem-cached-adapter": "^1.0",
"opis/closure": "^3.1",
"php": ">=7.1.0",
"topthink/think-cache": "^2.0",
"topthink/think-container": "^2.0",
"topthink/think-log": "^2.0",
"psr/container": "~1.0",
"psr/log": "~1.0",
"psr/simple-cache": "^1.0",
"topthink/think-helper": "^3.1.1",
"topthink/think-orm": "^2.0"
},
"require-dev": {
@@ -493,115 +496,20 @@
"orm",
"thinkphp"
],
"time": "2019-07-10T05:26:26+00:00"
},
{
"name": "topthink/think-cache",
"version": "v2.0.6",
"source": {
"type": "git",
"url": "https://github.com/top-think/think-cache.git",
"reference": "75a56b24affc65b51688fd89ada48c102757fd74"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/top-think/think-cache/zipball/75a56b24affc65b51688fd89ada48c102757fd74",
"reference": "75a56b24affc65b51688fd89ada48c102757fd74",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"opis/closure": "^3.1",
"php": ">=7.1.0",
"psr/cache": "~1.0",
"psr/simple-cache": "^1.0",
"topthink/think-container": "~2.0"
},
"type": "library",
"autoload": {
"psr-4": {
"think\\": "src"
},
"files": []
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "liu21st",
"email": "liu21st@gmail.com"
}
],
"description": "Cache Manager",
"time": "2019-07-07T14:34:35+00:00"
},
{
"name": "topthink/think-container",
"version": "v2.0.2",
"source": {
"type": "git",
"url": "https://github.com/top-think/think-container.git",
"reference": "88b9f05ece004ac3f177057ed833f1d16d61946f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/top-think/think-container/zipball/88b9f05ece004ac3f177057ed833f1d16d61946f",
"reference": "88b9f05ece004ac3f177057ed833f1d16d61946f",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">=7.1.0",
"psr/container": "~1.0",
"topthink/think-helper": "^3.1"
},
"require-dev": {
"phpunit/phpunit": "^7.0"
},
"type": "library",
"autoload": {
"psr-4": {
"think\\": "src"
},
"files": []
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "liu21st",
"email": "liu21st@gmail.com"
}
],
"description": "PHP Container & Facade Manager",
"time": "2019-07-10T06:28:47+00:00"
"time": "2019-08-01T10:58:36+00:00"
},
{
"name": "topthink/think-helper",
"version": "v3.1.1",
"version": "v3.1.2",
"source": {
"type": "git",
"url": "https://github.com/top-think/think-helper.git",
"reference": "92c24d1057118dada3ca18232cd18ef38a831ad6"
"reference": "a629c4271fdf3d7e7c6d89089791417cb4796a2c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/top-think/think-helper/zipball/92c24d1057118dada3ca18232cd18ef38a831ad6",
"reference": "92c24d1057118dada3ca18232cd18ef38a831ad6",
"url": "https://api.github.com/repos/top-think/think-helper/zipball/a629c4271fdf3d7e7c6d89089791417cb4796a2c",
"reference": "a629c4271fdf3d7e7c6d89089791417cb4796a2c",
"shasum": "",
"mirrors": [
{
@@ -610,6 +518,9 @@
}
]
},
"require": {
"php": ">=7.1.0"
},
"type": "library",
"autoload": {
"psr-4": {
@@ -630,20 +541,20 @@
}
],
"description": "The ThinkPHP6 Helper Package",
"time": "2019-07-10T08:52:50+00:00"
"time": "2019-07-11T04:35:03+00:00"
},
{
"name": "topthink/think-log",
"version": "v2.0.1",
"name": "topthink/think-orm",
"version": "v2.0.21",
"source": {
"type": "git",
"url": "https://github.com/top-think/think-log.git",
"reference": "de0bf6644228b39f03239cdc03251040d34a7b07"
"url": "https://github.com/top-think/think-orm.git",
"reference": "ea0240aa04d1085576064e7164ac563838f0f79c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/top-think/think-log/zipball/de0bf6644228b39f03239cdc03251040d34a7b07",
"reference": "de0bf6644228b39f03239cdc03251040d34a7b07",
"url": "https://api.github.com/repos/top-think/think-orm/zipball/ea0240aa04d1085576064e7164ac563838f0f79c",
"reference": "ea0240aa04d1085576064e7164ac563838f0f79c",
"shasum": "",
"mirrors": [
{
@@ -655,53 +566,8 @@
"require": {
"php": ">=7.1.0",
"psr/log": "~1.0",
"topthink/think-container": "^2.0"
},
"type": "library",
"autoload": {
"psr-4": {
"think\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "liu21st",
"email": "liu21st@gmail.com"
}
],
"description": "think log",
"time": "2019-07-07T14:47:46+00:00"
},
{
"name": "topthink/think-orm",
"version": "v2.0.10",
"source": {
"type": "git",
"url": "https://github.com/top-think/think-orm.git",
"reference": "07fd29b682c38a1ea2ca956cf2e5087ee52327c9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/top-think/think-orm/zipball/07fd29b682c38a1ea2ca956cf2e5087ee52327c9",
"reference": "07fd29b682c38a1ea2ca956cf2e5087ee52327c9",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">=7.1.0",
"topthink/think-container": "^2.0"
},
"suggest": {
"topthink/think-cache": "Required to use query cache (^2.0)."
"psr/simple-cache": "^1.0",
"topthink/think-helper": "^3.1"
},
"type": "library",
"autoload": {
@@ -725,20 +591,20 @@
"database",
"orm"
],
"time": "2019-07-08T09:19:03+00:00"
"time": "2019-08-02T03:54:20+00:00"
},
{
"name": "topthink/think-template",
"version": "v2.0.3",
"version": "v2.0.5",
"source": {
"type": "git",
"url": "https://github.com/top-think/think-template.git",
"reference": "dfd4d1693207aa4ebc027dc11a9d424c28c3fac0"
"reference": "3fb2741d6921475d980d987130cf8780c99c994c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/top-think/think-template/zipball/dfd4d1693207aa4ebc027dc11a9d424c28c3fac0",
"reference": "dfd4d1693207aa4ebc027dc11a9d424c28c3fac0",
"url": "https://api.github.com/repos/top-think/think-template/zipball/3fb2741d6921475d980d987130cf8780c99c994c",
"reference": "3fb2741d6921475d980d987130cf8780c99c994c",
"shasum": "",
"mirrors": [
{
@@ -748,7 +614,8 @@
]
},
"require": {
"php": ">=7.1.0"
"php": ">=7.1.0",
"psr/simple-cache": "^1.0"
},
"type": "library",
"autoload": {
@@ -767,20 +634,20 @@
}
],
"description": "the php template engine",
"time": "2019-07-10T03:56:08+00:00"
"time": "2019-07-30T06:29:57+00:00"
},
{
"name": "topthink/think-view",
"version": "v1.0.7",
"version": "v1.0.9",
"source": {
"type": "git",
"url": "https://github.com/top-think/think-view.git",
"reference": "1e1c42b5fa7c92bed42b334aef733b732f8c32fb"
"reference": "3cc8afc7069d3610b5ed09faebdddcfb5c929e80"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/top-think/think-view/zipball/1e1c42b5fa7c92bed42b334aef733b732f8c32fb",
"reference": "1e1c42b5fa7c92bed42b334aef733b732f8c32fb",
"url": "https://api.github.com/repos/top-think/think-view/zipball/3cc8afc7069d3610b5ed09faebdddcfb5c929e80",
"reference": "3cc8afc7069d3610b5ed09faebdddcfb5c929e80",
"shasum": "",
"mirrors": [
{
@@ -817,7 +684,7 @@
}
],
"description": "thinkphp template driver",
"time": "2019-07-10T04:01:32+00:00"
"time": "2019-07-30T04:10:50+00:00"
}
],
"packages-dev": [
@@ -949,16 +816,16 @@
},
{
"name": "symfony/var-dumper",
"version": "v4.3.2",
"version": "v4.3.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/var-dumper.git",
"reference": "45d6ef73671995aca565a1aa3d9a432a3ea63f91"
"reference": "e4110b992d2cbe198d7d3b244d079c1c58761d07"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/45d6ef73671995aca565a1aa3d9a432a3ea63f91",
"reference": "45d6ef73671995aca565a1aa3d9a432a3ea63f91",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/e4110b992d2cbe198d7d3b244d079c1c58761d07",
"reference": "e4110b992d2cbe198d7d3b244d079c1c58761d07",
"shasum": "",
"mirrors": [
{
@@ -1027,7 +894,7 @@
"debug",
"dump"
],
"time": "2019-06-17T17:37:00+00:00"
"time": "2019-07-27T06:42:46+00:00"
}
],
"aliases": [],

View File

@@ -39,7 +39,7 @@ return [
// 异常页面的模板文件
// 'exception_tmpl' => app()->getThinkPath() . 'tpl/think_exception.tpl',
'exception_tmpl' => app()->getAppPath() . 'view/error.tpl',
'exception_tmpl' => app()->getRootPath() . 'view/error.tpl',
// 'exception_tmpl' => app()->getAppPath() . 'view/exception.html',
// 错误显示信息,非调试模式有效

View File

@@ -14,7 +14,7 @@
// +----------------------------------------------------------------------
return [
// 内置Html 支持扩展
'type' => 'Html',
'type' => 'Console',
// 读取的日志通道名
'channel' => '',
];

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

@@ -1,7 +1,11 @@
define(['jquery'], function($){
var Backend = {
init: function(){
if($('.editable').length > 0){
// require(['editable'], function(){
// $('.editable').editable();
// })
}
},
setBodySize: function(){
var height = $(window).height();

View File

@@ -1,5 +1,5 @@
require.config({
urlArgs: "v=" + Date(),
urlArgs: "v=",
packages: [
{
name: 'moment',
@@ -55,6 +55,7 @@ require.config({
'selectpage': '/static/libs/fastadmin-selectpage/selectpage',
'citypicker': '/static/libs/fastadmin-citypicker/dist/js/city-picker.min',
'citypicker-data': '/static/libs/fastadmin-citypicker/dist/js/city-picker.data',
'editable': '/static/libs/x-editable/dist/bootstrap3-editable/js/bootstrap-editable.min'
},
shim:{
"nanoscroller":['jquery'],
@@ -110,11 +111,14 @@ require.config({
deps: ['/static/libs/plupload/js/moxie.min.js'],
exports: "plupload"
},
'layer': ['css!/static/libs/fastadmin-layer/dist/theme/default/layer.css'],
'layer': ['css!/static/libs/fastadmin-layer/dist/theme/default/layer.css'],
'validator-core': ['css!/static/libs/nice-validator/dist/jquery.validator.css'],
'validator-lang': ['validator-core'],
'selectpage': ['css!/static/libs/fastadmin-selectpage/selectpage.css'],
'citypicker': ['citypicker-data', 'css!/static/libs/fastadmin-citypicker/dist/css/city-picker.css'],
'editable':{
deps: ['bootstrap', 'css!/static/libs/x-editable/dist/bootstrap3-editable/css/bootstrap-editable.css']
}
},
baseUrl:"/static/js/",
map: {

View File

@@ -125,7 +125,7 @@
</div>
</header>
<div id="page-wrapper" class="container nav-small">
<div id="page-wrapper" class="container">
<div class="row">
<div id="nav-col">
<section id="col-left" class="col-left-nano">

View File

@@ -29,7 +29,7 @@
<tbody>
{volist name="list" id="item"}
<tr>
<td>{$item['time']|date='Ymd-His',###}</td>
<td>{$item['time']}</td>
<td>{$item['part']}</td>
<td>{$item['compress']}</td>
<td>{$item['size']|format_bytes}</td>

View File

@@ -1,7 +1,4 @@
{extend name="admin/base"/}
{block name="style"}
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/libs/bootstrap-editable.css">
{/block}
{block name="body"}
<div class="main-box clearfix">
<header class="main-box-header clearfix">
@@ -51,30 +48,7 @@
{/block}
{block name="script"}
<script type="text/javascript" src="__PUBLIC__/js/bootstrap-editable.min.js"></script>
<script type="text/javascript">
$(function() {
//点击排序
$('.list_sort').click(function(){
var url = $(this).attr('url');
var ids = $('.ids:checked');
var param = '';
if(ids.length > 0){
var str = new Array();
ids.each(function(){
str.push($(this).val());
});
param = str.join(',');
}
if(url != undefined && url != ''){
window.location.href = url + '/ids/' + param;
}
});
$.fn.editable.defaults.mode = 'popup';
$.fn.editableform.buttons = '<button type="submit" class="btn btn-success editable-submit btn-mini"><i class="fa fa-check-square-o fa-white"></i></button>' +
'<button type="button" class="btn editable-cancel btn-mini"><i class="fa fa-times"></i></button>';
$('.editable').editable();
});
var isLoadModule = true;
</script>
{/block}