mirror of https://github.com/1099438829/apeblog
修正数据库优化
This commit is contained in:
parent
fc02fa7a43
commit
15b1f564e2
|
|
@ -130,10 +130,10 @@ class Databases extends AuthController
|
||||||
$ids = $data['ids'];
|
$ids = $data['ids'];
|
||||||
if(is_array($ids)){
|
if(is_array($ids)){
|
||||||
$ids = implode('`,`', $ids);
|
$ids = implode('`,`', $ids);
|
||||||
$list = Db::query("OPTIMIZE TABLE `{$ids}`");
|
$list = Db::query("OPTIMIZE TABLE {$ids}");
|
||||||
return $list ? app("json")->success("数据表优化完成",'code') : app("json")->fail("数据表优化出错请重试");
|
return $list ? app("json")->success("数据表优化完成",'code') : app("json")->fail("数据表优化出错请重试");
|
||||||
} else {
|
} else {
|
||||||
$list = Db::query("OPTIMIZE TABLE `{$ids}`");
|
$list = Db::query("OPTIMIZE TABLE {$ids}");
|
||||||
return $list ? app("json")->success("数据表'{$ids}'优化完成",'code') : app("json")->fail("数据表'{$ids}'优化出错请重试");
|
return $list ? app("json")->success("数据表'{$ids}'优化完成",'code') : app("json")->fail("数据表'{$ids}'优化出错请重试");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -152,10 +152,10 @@ class Databases extends AuthController
|
||||||
$ids = $data['ids'];
|
$ids = $data['ids'];
|
||||||
if(is_array($ids)){
|
if(is_array($ids)){
|
||||||
$ids = implode('`,`', $ids);
|
$ids = implode('`,`', $ids);
|
||||||
$list = Db::query("REPAIR TABLE `{$ids}`");
|
$list = Db::query("REPAIR TABLE {$ids}");
|
||||||
return $list ? app("json")->success("数据表修复完成",'code') : app("json")->fail("数据表修复出错请重试");
|
return $list ? app("json")->success("数据表修复完成",'code') : app("json")->fail("数据表修复出错请重试");
|
||||||
} else {
|
} else {
|
||||||
$list = Db::query("REPAIR TABLE `{$ids}`");
|
$list = Db::query("REPAIR TABLE {$ids}");
|
||||||
return $list ? app("json")->success("数据表'{$ids}'修复完成",'code') : app("json")->fail("数据表'{$ids}'修复出错请重试");
|
return $list ? app("json")->success("数据表'{$ids}'修复完成",'code') : app("json")->fail("数据表'{$ids}'修复出错请重试");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -202,14 +202,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#btn-optimize").click(function () {
|
$("#btn-optimize").click(function () {
|
||||||
var checkID = "";
|
var checkID = [];
|
||||||
var selectedItem = $('#tb_departments').bootstrapTable('getAllSelections');
|
var selectedItem = $('#tb_departments').bootstrapTable('getAllSelections');
|
||||||
if (selectedItem=="") return lightyear.notify("没有选中项", 'danger', 3000, 'mdi mdi-emoticon-neutral', 'top', 'center');
|
if (selectedItem.length == 0) return lightyear.notify("没有选中项", 'danger', 3000, 'mdi mdi-emoticon-neutral', 'top', 'center');
|
||||||
for (var i = 0 ; i< selectedItem.length; i++)
|
for (var i = 0 ; i< selectedItem.length; i++)
|
||||||
{
|
{
|
||||||
checkID += selectedItem[i]['name']+",";
|
checkID.push(selectedItem[i]['name'])
|
||||||
}
|
}
|
||||||
if (checkID=="") return lightyear.notify("没有选中项", 'danger', 3000, 'mdi mdi-emoticon-neutral', 'top', 'center');
|
if (checkID.length == 0) return lightyear.notify("没有选中项", 'danger', 3000, 'mdi mdi-emoticon-neutral', 'top', 'center');
|
||||||
$.confirm({
|
$.confirm({
|
||||||
title: '重要提醒!',
|
title: '重要提醒!',
|
||||||
content: '您确认要执行该操作吗?',
|
content: '您确认要执行该操作吗?',
|
||||||
|
|
@ -219,8 +219,8 @@
|
||||||
text: '确认',
|
text: '确认',
|
||||||
btnClass: 'btn-danger',
|
btnClass: 'btn-danger',
|
||||||
action: function () {
|
action: function () {
|
||||||
$.post("/admin/databases/optimize",data={ids:checkID},function (res) {
|
$.post("/admin/databases/optimize",data={ids:checkID.toString()},function (res) {
|
||||||
if (res.status == 200) {lightyear.notify(res.msg, 'success', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');location.reload();}
|
if (res.code == 200) {lightyear.notify(res.msg, 'success', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');location.reload();}
|
||||||
else lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-neutral', 'top', 'center');
|
else lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-neutral', 'top', 'center');
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -234,14 +234,14 @@
|
||||||
})
|
})
|
||||||
|
|
||||||
$("#btn-repair").click(function () {
|
$("#btn-repair").click(function () {
|
||||||
var checkID = "";
|
var checkID = [];
|
||||||
var selectedItem = $('#tb_departments').bootstrapTable('getAllSelections');
|
var selectedItem = $('#tb_departments').bootstrapTable('getAllSelections');
|
||||||
if (selectedItem=="") return lightyear.notify("没有选中项", 'danger', 3000, 'mdi mdi-emoticon-neutral', 'top', 'center');
|
if (selectedItem.length == 0) return lightyear.notify("没有选中项", 'danger', 3000, 'mdi mdi-emoticon-neutral', 'top', 'center');
|
||||||
for (var i = 0 ; i< selectedItem.length; i++)
|
for (var i = 0 ; i< selectedItem.length; i++)
|
||||||
{
|
{
|
||||||
checkID += selectedItem[i]['name']+",";
|
checkID.push(selectedItem[i]['name'])
|
||||||
}
|
}
|
||||||
if (checkID=="") return lightyear.notify("没有选中项", 'danger', 3000, 'mdi mdi-emoticon-neutral', 'top', 'center');
|
if (checkID.length == 0) return lightyear.notify("没有选中项", 'danger', 3000, 'mdi mdi-emoticon-neutral', 'top', 'center');
|
||||||
$.confirm({
|
$.confirm({
|
||||||
title: '重要提醒!',
|
title: '重要提醒!',
|
||||||
content: '您确认要执行该操作吗?',
|
content: '您确认要执行该操作吗?',
|
||||||
|
|
@ -251,8 +251,8 @@
|
||||||
text: '确认',
|
text: '确认',
|
||||||
btnClass: 'btn-danger',
|
btnClass: 'btn-danger',
|
||||||
action: function () {
|
action: function () {
|
||||||
$.post("/admin/databases/repair",data={ids:checkID},function (res) {
|
$.post("/admin/databases/repair",data={ids:checkID.toString()},function (res) {
|
||||||
if (res.status == 200) {lightyear.notify(res.msg, 'success', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');location.reload();}
|
if (res.code == 200) {lightyear.notify(res.msg, 'success', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');location.reload();}
|
||||||
else lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-neutral', 'top', 'center');
|
else lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-neutral', 'top', 'center');
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue