完善数据库备份
This commit is contained in:
parent
ad7792cfc9
commit
e01c84dbeb
@ -20,6 +20,19 @@ function get_login_admin($key = "")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* PHP格式化字节大小
|
||||
* @param number $size 字节数
|
||||
* @param string $delimiter 数字和单位分隔符
|
||||
* @return string 格式化后的带单位的大小
|
||||
*/
|
||||
function format_bytes($size, $delimiter = '')
|
||||
{
|
||||
$units = array('B', 'KB', 'MB', 'GB', 'TB', 'PB');
|
||||
for ($i = 0; $size >= 1024 && $i < 5; $i++) $size /= 1024;
|
||||
return round($size, 2) . $delimiter . $units[$i];
|
||||
}
|
||||
|
||||
function list_to_tree($list, $pk = 'id', $pid = 'pid', $child = 'list', $root = 0)
|
||||
{
|
||||
// 创建Tree
|
||||
|
@ -104,7 +104,7 @@ class Admin extends BaseController
|
||||
//提交添加
|
||||
public function post_submit()
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
|
@ -146,7 +146,7 @@ class Api extends BaseController
|
||||
//保存个人信息修改
|
||||
public function personal_submit()
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
try {
|
||||
validate(AdminCheck::class)->scene('editPersonal')->check($param);
|
||||
@ -176,7 +176,7 @@ class Api extends BaseController
|
||||
//保存密码修改
|
||||
public function password_submit()
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
try {
|
||||
validate(AdminCheck::class)->scene('editpwd')->check($param);
|
||||
|
@ -35,7 +35,7 @@ class Article extends BaseController
|
||||
//提交添加
|
||||
public function cate_post_submit()
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
try {
|
||||
@ -128,7 +128,7 @@ class Article extends BaseController
|
||||
//提交添加
|
||||
public function post_submit()
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
try {
|
||||
|
@ -43,7 +43,7 @@ class Conf extends BaseController
|
||||
//提交添加
|
||||
public function post_submit()
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
try {
|
||||
validate(ConfCheck::class)->check($param);
|
||||
@ -93,7 +93,7 @@ class Conf extends BaseController
|
||||
//提交添加
|
||||
public function conf_submit()
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
$data['content'] = serialize($param);
|
||||
$data['update_time'] = time();
|
||||
|
168
app/admin/controller/Database.php
Normal file
168
app/admin/controller/Database.php
Normal file
@ -0,0 +1,168 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\admin\BaseController;
|
||||
use backup\Backup;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
|
||||
class Database extends BaseController
|
||||
{
|
||||
protected $db = '', $datadir;
|
||||
function initialize(){
|
||||
parent::initialize();
|
||||
$this->config=array(
|
||||
'path' => './Backup/', // 数据库备份路径
|
||||
'part' => 20971520, // 数据库备份卷大小
|
||||
'compress' => 0, // 数据库备份文件是否启用压缩 0不压缩 1 压缩
|
||||
'level' => 9 // 数据库备份文件压缩级别 1普通 4 一般 9最高
|
||||
);
|
||||
$this->db = new Backup($this->config);
|
||||
}
|
||||
|
||||
// 数据列表
|
||||
public function database()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
// 数据信息
|
||||
$list = $this->db->dataList();
|
||||
// 计算总大小
|
||||
$total = 0;
|
||||
foreach ($list as $k => $v) {
|
||||
$total += $v['data_length'];
|
||||
$list[$k]['data_size'] = $v['data_length'];
|
||||
$list[$k]['data_length'] = format_bytes($v['data_length']);
|
||||
}
|
||||
// 提示信息
|
||||
$dataTips = '数据库中共有<strong> ' . count($list) . '</strong> 张表,共计 <strong>' . format_bytes($total) .'</strong>大小。';
|
||||
$data['data']=$list;
|
||||
return table_assign(1, $dataTips,$data);
|
||||
}
|
||||
return view();
|
||||
}
|
||||
|
||||
// 备份
|
||||
public function backup()
|
||||
{
|
||||
$tables = get_params('id');
|
||||
if (!empty($tables)) {
|
||||
$tables = explode(',', $tables);
|
||||
foreach ($tables as $table) {
|
||||
$this->db->setFile()->backup($table, 0);
|
||||
}
|
||||
return to_assign(1, '备份成功!');
|
||||
} else {
|
||||
return to_assign(0, '请选择要备份的表!');
|
||||
}
|
||||
}
|
||||
|
||||
// 优化
|
||||
public function optimize() {
|
||||
$tables = get_params('id');
|
||||
if (empty($tables)) {
|
||||
return to_assign(1,'请选择要优化的表!');
|
||||
}
|
||||
$tables = explode(',',$tables);
|
||||
if ($this->db->optimize($tables)) {
|
||||
return to_assign(1, '数据表优化成功!');
|
||||
} else {
|
||||
return to_assign(0, '数据表优化出错请重试!');
|
||||
}
|
||||
}
|
||||
|
||||
// 修复
|
||||
public function repair() {
|
||||
$tables = get_params('id');
|
||||
if (empty($tables)) {
|
||||
return to_assign(0,'请选择要修复的表!');
|
||||
}
|
||||
$tables = explode(',',$tables);
|
||||
if ($this->db->repair($tables)) {
|
||||
return to_assign(1, '数据表修复成功!');
|
||||
} else {
|
||||
return to_assign(0, '数据表修复出错请重试!');
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================
|
||||
|
||||
// 还原列表
|
||||
public function backuplist()
|
||||
{
|
||||
// 数据信息
|
||||
$list = $this->db->fileList();
|
||||
$listNew = [];
|
||||
$indx=0;
|
||||
foreach ($list as $k => $v) {
|
||||
$listNew[$indx]['time'] = $k;
|
||||
$listNew[$indx]['data'][] = $v;
|
||||
$indx++;
|
||||
// $listNew[$k]['list'] = $list[$k];
|
||||
}
|
||||
$list = $listNew;
|
||||
array_multisort(array_column($list, 'time'), SORT_DESC, $list);
|
||||
return view('',['list' => $list]);
|
||||
}
|
||||
|
||||
// 执行还原数据库操作
|
||||
public function import(string $id)
|
||||
{
|
||||
$list = $this->db->getFile('timeverif', $id);
|
||||
$this->db->setFile($list)->import(1);
|
||||
return to_assign(1,'还原成功!');
|
||||
}
|
||||
|
||||
// 下载
|
||||
public function downfile(string $name)
|
||||
{
|
||||
$file_name = $name; //得到文件名
|
||||
header("Content-type:text/html;charset=utf-8");
|
||||
$file_name = iconv("utf-8","gb2312",$file_name); // 转换编码
|
||||
$file_sub_path = CMS_ROOT . '/public'.$this->config['path']; //确保文件在这个路径下面,换成你文件所在的路径
|
||||
$file_path = $file_sub_path . $file_name;
|
||||
# 将反斜杠 替换成正斜杠
|
||||
$file_path = str_replace('\\','/',$file_path);
|
||||
if(!file_exists($file_path)){
|
||||
echo "下载文件不存在!";exit; //如果提示这个错误,很可能你的路径不对,可以打印$file_sub_path查看
|
||||
}
|
||||
$fp = fopen($file_path,"r"); // 以可读的方式打开这个文件
|
||||
# 如果出现图片无法打开,可以在这个位置添加函数
|
||||
ob_clean(); # 清空擦掉,输出缓冲区。
|
||||
$file_size = filesize($file_path);
|
||||
//下载文件需要用到的头
|
||||
Header("Content-type: application/octet-stream");
|
||||
Header("Accept-Ranges: bytes");
|
||||
Header("Accept-Length:".$file_size);
|
||||
Header("Content-Disposition: attachment; filename = ". $file_name);
|
||||
$buffer = 1024000;
|
||||
$file_count = 0;
|
||||
while(!feof($fp) && $file_count<$file_size){
|
||||
$file_con = fread($fp,$buffer);
|
||||
$file_count += $buffer;
|
||||
echo $file_con;
|
||||
}
|
||||
fclose($fp); //关闭这个打开的文件
|
||||
}
|
||||
|
||||
// 删除sql文件
|
||||
public function del(string $id)
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
if (strpos($id, ',') !== false) {
|
||||
$idArr = explode(',', $id);
|
||||
foreach ($idArr as $k => $v) {
|
||||
$this->db->delFile($v);
|
||||
}
|
||||
return to_assign(1,"删除成功!");
|
||||
}
|
||||
if ($this->db->delFile($id)) {
|
||||
return to_assign(1,"删除成功!");
|
||||
} else {
|
||||
return to_assign(0, "备份文件删除失败,请检查文件权限!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -47,7 +47,7 @@ class Keywords extends BaseController
|
||||
//提交添加
|
||||
public function post_submit()
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
try {
|
||||
|
@ -37,7 +37,7 @@ class Menu extends BaseController
|
||||
|
||||
public function post_submit()
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
if ($param['id'] > 0) {
|
||||
try {
|
||||
|
@ -52,7 +52,7 @@ class Nav extends BaseController
|
||||
|
||||
public function post_submit()
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
try {
|
||||
@ -148,7 +148,7 @@ class Nav extends BaseController
|
||||
|
||||
public function nav_info_submit()
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
try {
|
||||
|
@ -47,7 +47,7 @@ class Role extends BaseController
|
||||
//提交保存
|
||||
public function post_submit()
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
|
@ -32,7 +32,7 @@ class Rule extends BaseController
|
||||
//提交添加
|
||||
public function post_submit()
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
if ($param['id'] > 0) {
|
||||
try {
|
||||
|
@ -50,7 +50,7 @@ class Sitemap extends BaseController
|
||||
//提交添加
|
||||
public function post_submit()
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
try {
|
||||
@ -142,7 +142,7 @@ class Sitemap extends BaseController
|
||||
//保存网站地图添加
|
||||
public function sitemap_info_submit()
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
try {
|
||||
|
@ -48,7 +48,7 @@ class Slide extends BaseController
|
||||
//提交添加
|
||||
public function post_submit()
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
try {
|
||||
@ -137,7 +137,7 @@ class Slide extends BaseController
|
||||
//保存幻灯片添加
|
||||
public function slide_info_submit()
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
try {
|
||||
|
@ -62,7 +62,7 @@ class User extends BaseController
|
||||
//提交添加
|
||||
public function post_submit()
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
$res = Db::name('user')->where(['id' => $param['id']])->strict(false)->field(true)->update($param);
|
||||
|
@ -9,11 +9,11 @@
|
||||
<link rel="mobile-prefetch" href=""/>
|
||||
{/block}
|
||||
{block name="title"}
|
||||
<title>{:get_config('webconfig.admin_title')}</title>
|
||||
<title>{:get_system_config('web','admin_title')}</title>
|
||||
{/block}
|
||||
{block name="keywords"}
|
||||
<meta name="keywords" content="{:get_config('webconfig.keywords')}"/>
|
||||
<meta name="description" content="{:get_config('webconfig.desc')}"/>
|
||||
<meta name="keywords" content="{:get_system_config('web','keywords')}"/>
|
||||
<meta name="description" content="{:get_system_config('web','desc')}"/>
|
||||
{/block}
|
||||
{block name="css"}
|
||||
<link rel="stylesheet" href="{__LAYUI__}/css/layui.css?v={:get_system_config('web','version')}" media="all">
|
||||
|
64
app/admin/view/conf/other.html
Normal file
64
app/admin/view/conf/other.html
Normal file
@ -0,0 +1,64 @@
|
||||
{extend name="common/base"/}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<form class="layui-form body-content">
|
||||
<h3 style="height:36px">其他配置</h3>
|
||||
<table class="layui-table layui-table-form">
|
||||
<tr>
|
||||
<td class="layui-td-gray2">开发者</td>
|
||||
<td>
|
||||
<input type="hidden" value="{$id}" name="id">
|
||||
<input type="text" name="author" autocomplete="off" placeholder="请输入开发者"
|
||||
lay-reqText="请输入开发者" class="layui-input"{notempty name="$config.author"} value="{$config.author}" {/notempty}>
|
||||
</td>
|
||||
<td class="layui-td-gray2">开发版本号
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="version" autocomplete="off" placeholder="请输入版本号"
|
||||
lay-reqText="请输入版本号" class="layui-input" {notempty name="$config.version"} value="{$config.version}" {/notempty}>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div style="padding: 10px 0">
|
||||
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</form>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script>
|
||||
function init(layui) {
|
||||
var form = layui.form,
|
||||
layer = layui.layer;
|
||||
|
||||
//监听提交
|
||||
form.on('submit(webform)', function (data) {
|
||||
$.ajax({
|
||||
url: "/admin/conf/conf_submit",
|
||||
type: 'post',
|
||||
data: data.field,
|
||||
success: function (e) {
|
||||
if (e.code == 1) {
|
||||
layer.confirm('保存成功,关闭本页面吗?', {
|
||||
icon: 3,
|
||||
title: '提示'
|
||||
}, function (index) {
|
||||
history.back(-1);
|
||||
layer.close(index);
|
||||
});
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
}
|
||||
})
|
||||
return false;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{include file="common/layui" base='base' extend="[]" use="['form']" callback="init" /}
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
91
app/admin/view/database/backuplist.html
Normal file
91
app/admin/view/database/backuplist.html
Normal file
@ -0,0 +1,91 @@
|
||||
{extend name="common/base"/}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<div class="body-content">
|
||||
<table cellspacing="0" cellpadding="0" border="0" class="layui-table">
|
||||
<tr style="background-color: #f5f5f5; text-align: center;">
|
||||
<th style=" text-align: center; font-weight: 800;"><span>文件名称</span></th>
|
||||
<th style=" text-align: center; font-weight: 800;"><span>分卷</span></th>
|
||||
<th style=" text-align: center; font-weight: 800;"><span>文件大小</span></th>
|
||||
<th style=" text-align: center; font-weight: 800;"><span>文件格式</span></th>
|
||||
<th style=" text-align: center; font-weight: 800;"><span>分隔符</span></th>
|
||||
<th style=" text-align: center; font-weight: 800;"><span>操作</span></th>
|
||||
</tr>
|
||||
{empty name="list"}
|
||||
<tr>
|
||||
<td colspan="6" align="center">暂无备份数据</td>
|
||||
</tr>
|
||||
{/empty}
|
||||
{volist name="list" id="vo" key="k"}
|
||||
<tr style="background-color: #f5f5f5;">
|
||||
<td colspan="6">备份时间:{$vo.time}</td>
|
||||
</tr>
|
||||
{volist name="vo.data" id="voo"}
|
||||
<tr>
|
||||
<td>
|
||||
{:date("Ymd",$voo.time)}{$voo.compress}{:date("His",$voo.time)}{$voo.compress}{$voo.part}.sql
|
||||
</td>
|
||||
<td align="center"><span>{$voo.part}</span></td>
|
||||
<td align="center"><span>{:format_bytes($voo.size)}</span></td>
|
||||
<td align="center"><span>.sql</span></td>
|
||||
<td align="center"><span>{$voo.compress}</span></td>
|
||||
<td align="center" data-id='{$voo.time}'>
|
||||
<a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="import">数据还原</a>
|
||||
<a class="layui-btn layui-btn-xs" href='/admin/database/downfile?name={:date("Ymd",$voo.time)}{$voo.compress}{:date("His",$voo.time)}{$voo.compress}{$voo.part}.sql'>备份下载</a><a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">备份删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
{/volist}
|
||||
{/volist}
|
||||
</table>
|
||||
</div>
|
||||
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script>
|
||||
function init(layui) {
|
||||
var table = layui.table,
|
||||
form = layui.form;
|
||||
//监听行工具事件
|
||||
$('[lay-event="import"]').on('click',function(){
|
||||
var id=$(this).parent().data('id');
|
||||
layer.confirm('确认要还原该备份吗?', {
|
||||
icon: 3,
|
||||
title: '提示'
|
||||
}, function (index) {
|
||||
$.ajax({
|
||||
url: "/admin/database/import?id="+id,
|
||||
success: function (res) {
|
||||
layer.msg(res.msg);
|
||||
}
|
||||
})
|
||||
layer.close(index);
|
||||
});
|
||||
})
|
||||
|
||||
$('[lay-event="del"]').on('click',function(){
|
||||
var id=$(this).parent().data('id');
|
||||
layer.confirm('确认要删除该备份吗?', {
|
||||
icon: 3,
|
||||
title: '提示'
|
||||
}, function (index) {
|
||||
$.ajax({
|
||||
url: "/admin/database/del",
|
||||
data: {'id':id},
|
||||
success: function (res) {
|
||||
layer.msg(res.msg);
|
||||
if (res.code == 1) {
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
})
|
||||
layer.close(index);
|
||||
});
|
||||
})
|
||||
}
|
||||
</script>
|
||||
{include file="common/layui" base='base' extend="[]" use="['table','form']" callback="init" /}
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
152
app/admin/view/database/database.html
Normal file
152
app/admin/view/database/database.html
Normal file
@ -0,0 +1,152 @@
|
||||
{extend name="common/base"/}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<div class="body-content">
|
||||
<table class="layui-hide" id="test" lay-filter="test"></table>
|
||||
</div>
|
||||
<script type="text/html" id="toolbarDemo">
|
||||
<div class="layui-btn-group">
|
||||
<span class="layui-btn layui-btn-sm layui-btn-normal" lay-event="backup">数据备份</span><span class="layui-btn layui-btn-sm" lay-event="optimize">数据优化</span><span class="layui-btn layui-btn-danger layui-btn-sm" lay-event="repair">数据修复</span>
|
||||
</div>
|
||||
<span id="dataTips" style="font-size:12px; margin-left:10px"></span>
|
||||
</script>
|
||||
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script>
|
||||
function init(layui) {
|
||||
var table = layui.table,
|
||||
form = layui.form;
|
||||
|
||||
var tableIns = table.render({
|
||||
elem: '#test',
|
||||
title: '数据备份',
|
||||
toolbar: '#toolbarDemo',
|
||||
url: '/admin/database/database', //数据接口
|
||||
page: false,
|
||||
cols: [
|
||||
[ //表头
|
||||
{type: 'checkbox'},
|
||||
{
|
||||
field: 'name',
|
||||
title: '数据表',
|
||||
width: 220
|
||||
}, {
|
||||
field: 'engine',
|
||||
title: '存储引擎',
|
||||
align: 'center',
|
||||
width: 90
|
||||
}, {
|
||||
field: 'row_format',
|
||||
title: '行格式',
|
||||
align: 'center',
|
||||
width: 90
|
||||
}, {
|
||||
field: 'rows',
|
||||
title: '行数',
|
||||
align: 'center',
|
||||
width: 100,
|
||||
}, {
|
||||
field: 'data_size',
|
||||
title: '字节数',
|
||||
align: 'center',
|
||||
width: 120
|
||||
}, {
|
||||
field: 'data_length',
|
||||
title: '数据大小',
|
||||
align: 'center',
|
||||
width: 120
|
||||
}, {
|
||||
field: 'comment',
|
||||
title: '数据表注释'
|
||||
}, {
|
||||
field: 'create_time',
|
||||
title: '创建时间',
|
||||
width: 160,
|
||||
align: 'center'
|
||||
}
|
||||
]
|
||||
],
|
||||
done:function(res, curr, count){
|
||||
$('#dataTips').html(res.msg);
|
||||
}
|
||||
});
|
||||
|
||||
//监听行工具事件
|
||||
table.on('toolbar(test)', function (obj) {
|
||||
var checkData = table.checkStatus(obj.config.id).data;
|
||||
var len = checkData.length;
|
||||
var ids='';
|
||||
if(len==0){
|
||||
layer.msg('请先选择表');
|
||||
return false;
|
||||
}
|
||||
for(var i=0;i<len;i++){
|
||||
if(i==0){
|
||||
ids+=checkData[i].name;
|
||||
}
|
||||
else{
|
||||
ids+=','+checkData[i].name;
|
||||
}
|
||||
}
|
||||
if (obj.event === 'backup') {
|
||||
layer.confirm('确认要备份选中的'+len+'个数据表吗?', {
|
||||
icon: 3,
|
||||
title: '提示'
|
||||
}, function (index) {
|
||||
$.ajax({
|
||||
url: "/admin/database/backup",
|
||||
data: {'id':ids},
|
||||
success: function (res) {
|
||||
layer.msg(res.msg);
|
||||
if (res.code == 1) {
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
})
|
||||
layer.close(index);
|
||||
});
|
||||
}else if (obj.event === 'optimize') {
|
||||
layer.confirm('确认要优化选中的'+len+'个数据表吗?', {
|
||||
icon: 3,
|
||||
title: '提示'
|
||||
}, function (index) {
|
||||
$.ajax({
|
||||
url: "/admin/database/optimize",
|
||||
data: {'id':ids},
|
||||
success: function (res) {
|
||||
layer.msg(res.msg);
|
||||
if (res.code == 1) {
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
})
|
||||
layer.close(index);
|
||||
});
|
||||
}else if (obj.event === 'repair') {
|
||||
layer.confirm('确认要修复选中的'+len+'个数据表吗?', {
|
||||
icon: 3,
|
||||
title: '提示'
|
||||
}, function (index) {
|
||||
$.ajax({
|
||||
url: "/admin/database/repair",
|
||||
data: {'id':ids},
|
||||
success: function (res) {
|
||||
layer.msg(res.msg);
|
||||
if (res.code == 1) {
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
})
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{include file="common/layui" base='base' extend="[]" use="['table','form']" callback="init" /}
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -9,14 +9,14 @@
|
||||
<link rel="mobile-prefetch" href=""/>
|
||||
{/block}
|
||||
{block name="title"}
|
||||
<title>{:get_config('webconfig.admin_title')}</title>
|
||||
<title>{:get_system_config('web','admin_title')}</title>
|
||||
{/block}
|
||||
{block name="keywords"}
|
||||
<meta name="keywords" content="{:get_config('webconfig.keywords')}"/>
|
||||
<meta name="description" content="{:get_config('webconfig.desc')}"/>
|
||||
<meta name="keywords" content="{:get_system_config('web','keywords')}"/>
|
||||
<meta name="description" content="{:get_system_config('web','desc')}"/>
|
||||
{/block}
|
||||
{block name="css"}
|
||||
<link rel="stylesheet" href="{__CSS__}/common.css?v={:get_config('webconfig.version')}" media="all">
|
||||
<link rel="stylesheet" href="{__CSS__}/common.css?v={:get_system_config('web','version')}" media="all">
|
||||
{/block}
|
||||
{block name="style"}{/block}
|
||||
{block name="js"}
|
||||
|
@ -10,7 +10,7 @@
|
||||
<div class="intro-box">
|
||||
<div class="intro-info">
|
||||
<div class="intro-title">勾股CMS,让WEB开发更简单!</div>
|
||||
<div class="intro-text">勾股CMS是一套基于ThinkPHP6 + Layui + MySql打造的轻量级、高性能快速建站的内容管理系统。<br/>后台管理模块,一目了然,操作简单,通用型后台权限管理框架,紧随潮流、极低门槛、开箱即用。</div>
|
||||
<div class="intro-text">勾股CMS是一套基于ThinkPHP6 + Layui + MySql打造的轻量级、高性能快速建站的内容管理系统。<br/>系统后台各管理模块,一目了然,操作简单;通用型的后台权限管理框架,紧随潮流、极低门槛、开箱即用。<br/>系统易于功能扩展,代码维护,方便二次开发,帮助开发者简单高效降低二次开发成本,满足专注业务深度开发的需求。</div>
|
||||
</div>
|
||||
<div class="intro-ops">
|
||||
<div class="cms-download">
|
||||
|
@ -6,7 +6,7 @@
|
||||
<meta name="renderer" content="webkit" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<title>{:get_config('webconfig.admin_title')}</title>
|
||||
<title>{:get_system_config('web','admin_title')}</title>
|
||||
<style type="text/css">
|
||||
html,
|
||||
body {
|
||||
|
@ -6,7 +6,7 @@
|
||||
<meta name="renderer" content="webkit" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<title>{:get_config('webconfig.admin_title')}</title>
|
||||
<title>{:get_system_config('web','admin_title')}</title>
|
||||
<style type="text/css">
|
||||
html,
|
||||
body {
|
||||
|
@ -47,7 +47,7 @@ CREATE TABLE `cms_admin_group` (
|
||||
-- ----------------------------
|
||||
-- Records of cms_admin_group
|
||||
-- ----------------------------
|
||||
INSERT INTO `cms_admin_group` VALUES ('1', '系统所有者', '1', '1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90', '1,2,3,4,5,6,7,,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23', '系统所有者,系统自动分配所有可操作权限及菜单。', '0', '0');
|
||||
INSERT INTO `cms_admin_group` VALUES ('1', '超级管理员', '1', '1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98', '1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21', '超级管理员,系统自动分配所有可操作权限及菜单。', '0', '0');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for `cms_admin_group_access`
|
||||
@ -95,16 +95,17 @@ INSERT INTO `cms_admin_menu` VALUES (7, 1, '功能节点', 'admin/rule/index', '
|
||||
INSERT INTO `cms_admin_menu` VALUES (8, 1, '权限角色', 'admin/role/index', '', 1, 0, 0);
|
||||
INSERT INTO `cms_admin_menu` VALUES (9, 1, '管 理 员', 'admin/admin/index', '', 1, 0, 0);
|
||||
INSERT INTO `cms_admin_menu` VALUES (10, 1, '操作日志', 'admin/admin/log', '', 1, 0, 0);
|
||||
INSERT INTO `cms_admin_menu` VALUES (11, 1, '数据备份', 'admin/admin/bak', '', 1, 0, 0);
|
||||
INSERT INTO `cms_admin_menu` VALUES (12, 2, '导航设置', 'admin/nav/index', '', 1, 0, 0);
|
||||
INSERT INTO `cms_admin_menu` VALUES (13, 2, '网站地图', 'admin/sitemap/index', '', 1, 0, 0);
|
||||
INSERT INTO `cms_admin_menu` VALUES (14, 2, '轮播广告', 'admin/slide/index', '', 1, 0, 0);
|
||||
INSERT INTO `cms_admin_menu` VALUES (15, 2, 'SEO关键字', 'admin/keywords/index', '', 1, 0, 0);
|
||||
INSERT INTO `cms_admin_menu` VALUES (16, 2, '搜索关键词', 'admin/search/index', '', 1, 0, 0);
|
||||
INSERT INTO `cms_admin_menu` VALUES (17, 3, '用户列表', 'admin/user/index', '',1, 0, 0);
|
||||
INSERT INTO `cms_admin_menu` VALUES (18, 3, '操作日志', 'admin/user/log', '', 1, 0, 0);
|
||||
INSERT INTO `cms_admin_menu` VALUES (19, 4, '文章分类', 'admin/article/cate', '', 1, 0, 0);
|
||||
INSERT INTO `cms_admin_menu` VALUES (20, 4, '文章列表', 'admin/article/index', '', 1, 0, 0);
|
||||
INSERT INTO `cms_admin_menu` VALUES (11, 1, '数据备份', 'admin/database/database', '', 1, 0, 0);
|
||||
INSERT INTO `cms_admin_menu` VALUES (12, 1, '数据还原', 'admin/database/backupList', '', 1, 0, 0);
|
||||
INSERT INTO `cms_admin_menu` VALUES (13, 2, '导航设置', 'admin/nav/index', '', 1, 0, 0);
|
||||
INSERT INTO `cms_admin_menu` VALUES (14, 2, '网站地图', 'admin/sitemap/index', '', 1, 0, 0);
|
||||
INSERT INTO `cms_admin_menu` VALUES (15, 2, '轮播广告', 'admin/slide/index', '', 1, 0, 0);
|
||||
INSERT INTO `cms_admin_menu` VALUES (16, 2, 'SEO关键字', 'admin/keywords/index', '', 1, 0, 0);
|
||||
INSERT INTO `cms_admin_menu` VALUES (17, 2, '搜索关键词', 'admin/search/index', '', 1, 0, 0);
|
||||
INSERT INTO `cms_admin_menu` VALUES (18, 3, '用户列表', 'admin/user/index', '',1, 0, 0);
|
||||
INSERT INTO `cms_admin_menu` VALUES (19, 3, '操作日志', 'admin/user/log', '', 1, 0, 0);
|
||||
INSERT INTO `cms_admin_menu` VALUES (20, 4, '文章分类', 'admin/article/cate', '', 1, 0, 0);
|
||||
INSERT INTO `cms_admin_menu` VALUES (21, 4, '文章列表', 'admin/article/index', '', 1, 0, 0);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for `cms_admin_rule`
|
||||
@ -214,7 +215,14 @@ INSERT INTO `cms_admin_rule` VALUES (87, 86, 'admin/article/get_list', '文章
|
||||
INSERT INTO `cms_admin_rule` VALUES (88, 86, 'admin/article/add', '添加文章', 0, 0);
|
||||
INSERT INTO `cms_admin_rule` VALUES (89, 86, 'admin/article/post_submit', '文章添加', 0, 0);
|
||||
INSERT INTO `cms_admin_rule` VALUES (90, 86, 'admin/article/delete', '文章删除', 0, 0);
|
||||
|
||||
INSERT INTO `cms_admin_rule` VALUES (91, 1, 'admin/database/database', '数据备份', 0, 0);
|
||||
INSERT INTO `cms_admin_rule` VALUES (92, 91, 'admin/database/backup', '数据表备份', 0, 0);
|
||||
INSERT INTO `cms_admin_rule` VALUES (93, 91, 'admin/database/optimize', '数据表优化', 0, 0);
|
||||
INSERT INTO `cms_admin_rule` VALUES (94, 91, 'admin/database/repair', '数据表修复', 0, 0);
|
||||
INSERT INTO `cms_admin_rule` VALUES (95, 1, 'admin/database/backupList', '数据还原', 0, 0);
|
||||
INSERT INTO `cms_admin_rule` VALUES (96, 95, 'admin/database/import', '数据表还原', 0, 0);
|
||||
INSERT INTO `cms_admin_rule` VALUES (97, 95, 'admin/database/downFile', '备份数据下载', 0, 0);
|
||||
INSERT INTO `cms_admin_rule` VALUES (98, 95, 'admin/database/del', '删除备份数据', 0, 0);
|
||||
-- ----------------------------
|
||||
-- Table structure for `cms_admin_log`
|
||||
-- ----------------------------
|
||||
@ -254,7 +262,10 @@ CREATE TABLE `cms_config` (
|
||||
-- ----------------------------
|
||||
-- Records of cms_config
|
||||
-- ----------------------------
|
||||
INSERT INTO `cms_config` VALUES (1, '网站配置', 0, 1, 1610183567, 1610184824);
|
||||
INSERT INTO `cms_config` VALUES (1, '网站配置', 'web', 'a:12:{s:2:\"id\";s:1:\"1\";s:11:\"admin_title\";s:9:\"勾股cms\";s:5:\"title\";s:9:\"勾股cms\";s:4:\"logo\";s:0:\"\";s:4:\"file\";s:0:\"\";s:6:\"domain\";s:23:\"http://www.gouguapp.com\";s:3:\"icp\";s:23:\"粤ICP备1xxxxxx11号-1\";s:8:\"keywords\";s:9:\"勾股cms\";s:4:\"desc\";s:250:\"勾股CMS是一套基于ThinkPHP6 + Layui + MySql打造的轻量级、高性能快速建站的内容管理系统。后台管理模块,一目了然,操作简单,通用型后台权限管理框架,紧随潮流、极低门槛、开箱即用。 \";s:4:\"code\";s:0:\"\";s:9:\"copyright\";s:32:\"© 2021 gouguapp.com MIT license\";s:7:\"version\";s:5:\"1.0.2\";}', 1, 1612514630, 1613788922);
|
||||
INSERT INTO `cms_config` VALUES (2, '邮箱配置', 'email', 'a:8:{s:2:\"id\";s:1:\"2\";s:4:\"smtp\";s:11:\"smtp.qq.com\";s:4:\"port\";s:7:\"465/994\";s:8:\"username\";s:15:\"gougucms@qq.com\";s:8:\"password\";s:6:\"123456\";s:4:\"from\";s:24:\"勾股CMS系统管理员\";s:5:\"email\";s:18:\"admin@gougucms.com\";s:8:\"template\";s:16:\"<p>勾股CMS</p>\";}', 1, 1612521657, 1612521862);
|
||||
INSERT INTO `cms_config` VALUES (3, '微信配置', 'wechat', 'a:9:{s:2:\"id\";s:1:\"3\";s:5:\"token\";s:8:\"GOUGUCMS\";s:14:\"login_back_url\";s:48:\"http://www.gouguapp.com/wechat/index/getChatInfo\";s:5:\"appid\";s:18:\"wxdf96xxxx7cd6f0c5\";s:9:\"appsecret\";s:32:\"1dbf319a4f0dfed7xxxxfd1c7dbba488\";s:5:\"mchid\";s:10:\"151xxxx331\";s:11:\"secrect_key\";s:32:\"beiyuexxxxhunangdmabcxxxxjiaxing\";s:8:\"cert_url\";s:13:\"/extend/cert/\";s:12:\"pay_back_url\";s:42:\"https://www.gouguapp.com/wxappv1/wx/notify\";}', 1, 1612522314, 1613789058);
|
||||
INSERT INTO `cms_config` VALUES (4, '其他配置', 'other', 'a:3:{s:2:\"id\";s:1:\"4\";s:6:\"author\";s:12:\"629工作室\";s:7:\"version\";s:5:\"1.0.2\";}', 1, 1613725791, 1613789431);
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
@ -322,7 +333,7 @@ CREATE TABLE `cms_article` (
|
||||
-- ----------------------------
|
||||
-- Records of cms_article
|
||||
-- ----------------------------
|
||||
INSERT INTO `cms_article` VALUES (1, '勾股CMS简介', '', '', 1, '', '', '', '<p>return view()时报错Driver [Think] not supported</p><p><br/></p><p>如图所示</p><p><br/></p><p><br/></p>', 0, 0, 0, 0, 1, 1608178497, 1608180590, NULL);
|
||||
INSERT INTO `cms_article` VALUES (1, '勾股CMS简介', '', '', 1, '', '', '', '<p>return view()时报错Driver [Think] not supported</p><p><br/></p><p>如图所示</p><p><br/></p><p><br/></p>', 0, 0, 0, 0, 1, 1608178497, 1608180590, '0');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for `cms_article_keywords`
|
||||
@ -490,7 +501,7 @@ CREATE TABLE `cms_user` (
|
||||
`headimgurl` varchar(255) NOT NULL DEFAULT '' COMMENT '微信头像',
|
||||
`sex` tinyint(1) NOT NULL DEFAULT 0 COMMENT '性别 0:未知 1:女 2:男 ',
|
||||
`desc` varchar(255) NOT NULL DEFAULT '' COMMENT '个人简介',
|
||||
`birthday` int(11) NULL DEFAULT NULL COMMENT '生日',
|
||||
`birthday` int(11) NULL DEFAULT '0' COMMENT '生日',
|
||||
`country` varchar(20) NOT NULL DEFAULT '' COMMENT '国家',
|
||||
`province` varchar(20) NOT NULL DEFAULT '' COMMENT '省',
|
||||
`city` varchar(20) NOT NULL DEFAULT '' COMMENT '城市',
|
||||
|
@ -5,7 +5,7 @@
|
||||
.intro-img{width: 518px; position: absolute; bottom:0; left:0;}
|
||||
.intro-img img{width: 100%;}
|
||||
.intro-info{ line-height: 2.4;}
|
||||
.intro-title{font-size: 42px;color: #fff; margin: 20px 0;}
|
||||
.intro-title{font-size: 42px;color: #fff; margin: 10px 0;}
|
||||
.intro-ops{text-align: center;padding: 60px 0;}
|
||||
.cms-download a{width: 268px; line-height: 66px; font-size: 20px; display: inline-block; background-color: #EB4336; color: #fff; border-radius: 4px;}
|
||||
.cms-download a:hover{opacity: .9;}
|
||||
|
Loading…
x
Reference in New Issue
Block a user