From 15b1f564e26e6f37d7dad0ed226a6d2e8d834e56 Mon Sep 17 00:00:00 2001 From: liyukun <1099438829@qq.com> Date: Sun, 28 Nov 2021 02:15:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/Databases.php | 8 ++++---- app/admin/view/databases/export.html | 24 ++++++++++++------------ 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/app/admin/controller/Databases.php b/app/admin/controller/Databases.php index 2ca20d2..ce3ca05 100644 --- a/app/admin/controller/Databases.php +++ b/app/admin/controller/Databases.php @@ -130,10 +130,10 @@ class Databases extends AuthController $ids = $data['ids']; if(is_array($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("数据表优化出错请重试"); } else { - $list = Db::query("OPTIMIZE TABLE `{$ids}`"); + $list = Db::query("OPTIMIZE TABLE {$ids}"); return $list ? app("json")->success("数据表'{$ids}'优化完成",'code') : app("json")->fail("数据表'{$ids}'优化出错请重试"); } } @@ -152,10 +152,10 @@ class Databases extends AuthController $ids = $data['ids']; if(is_array($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("数据表修复出错请重试"); } else { - $list = Db::query("REPAIR TABLE `{$ids}`"); + $list = Db::query("REPAIR TABLE {$ids}"); return $list ? app("json")->success("数据表'{$ids}'修复完成",'code') : app("json")->fail("数据表'{$ids}'修复出错请重试"); } } diff --git a/app/admin/view/databases/export.html b/app/admin/view/databases/export.html index b9ea2eb..460ef87 100644 --- a/app/admin/view/databases/export.html +++ b/app/admin/view/databases/export.html @@ -202,14 +202,14 @@ } $("#btn-optimize").click(function () { - var checkID = ""; + var checkID = []; 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++) { - 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({ title: '重要提醒!', content: '您确认要执行该操作吗?', @@ -219,8 +219,8 @@ text: '确认', btnClass: 'btn-danger', action: function () { - $.post("/admin/databases/optimize",data={ids:checkID},function (res) { - if (res.status == 200) {lightyear.notify(res.msg, 'success', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');location.reload();} + $.post("/admin/databases/optimize",data={ids:checkID.toString()},function (res) { + 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'); }) } @@ -234,14 +234,14 @@ }) $("#btn-repair").click(function () { - var checkID = ""; + var checkID = []; 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++) { - 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({ title: '重要提醒!', content: '您确认要执行该操作吗?', @@ -251,8 +251,8 @@ text: '确认', btnClass: 'btn-danger', action: function () { - $.post("/admin/databases/repair",data={ids:checkID},function (res) { - if (res.status == 200) {lightyear.notify(res.msg, 'success', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');location.reload();} + $.post("/admin/databases/repair",data={ids:checkID.toString()},function (res) { + 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'); }) }