From e0587d7a5f97890f796cc7701e7c8a07fdf6bbe5 Mon Sep 17 00:00:00 2001 From: deatil <2217957370@qq.com> Date: Sun, 9 Jun 2024 12:22:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 2 +- resources/menus/menus.php | 32 +++++++++++++++--------------- resources/view/config/all.html | 5 +++-- resources/view/config/index.html | 14 ++++--------- src/Controller/Config.php | 34 ++++++++++++++++---------------- 5 files changed, 41 insertions(+), 46 deletions(-) diff --git a/composer.json b/composer.json index 1aa26e3..b699df8 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,7 @@ }, "laket" : { "title": "系统设置", - "version": "1.2.1", + "version": "1.2.3", "adaptation": "1.2.*" }, "extra": { diff --git a/resources/menus/menus.php b/resources/menus/menus.php index ca44bd1..8cac481 100644 --- a/resources/menus/menus.php +++ b/resources/menus/menus.php @@ -2,7 +2,7 @@ return [ "title" => "系统配置", - "url" => "admin/settings/setting", + "url" => "settings/setting", "method" => "GET", "slug" => $this->slug, "icon" => "icon-zidongxiufu", @@ -12,7 +12,7 @@ "children" => [ [ "title" => "系统设置", - "url" => "admin/settings/setting", + "url" => "settings/setting", "method" => "GET", "slug" => "admin.settings.setting", "icon" => "icon-setup", @@ -21,7 +21,7 @@ "children" => [ [ "title" => "系统设置", - "url" => "admin/settings/setting", + "url" => "settings/setting", "method" => "GET", "slug" => "admin.settings.setting", "menu_show" => 0, @@ -29,7 +29,7 @@ ], [ "title" => "系统设置", - "url" => "admin/settings/setting", + "url" => "settings/setting", "method" => "POST", "slug" => "admin.settings.setting-post", "menu_show" => 0, @@ -39,7 +39,7 @@ ], [ "title" => "配置管理", - "url" => "admin/settings/index", + "url" => "settings/index", "method" => "GET", "slug" => "admin.settings.index", "icon" => "icon-apartment", @@ -48,7 +48,7 @@ "children" => [ [ "title" => "系统设置", - "url" => "admin/settings/index", + "url" => "settings/index", "method" => "GET", "slug" => "admin.settings.index", "menu_show" => 0, @@ -56,7 +56,7 @@ ], [ "title" => "系统设置", - "url" => "admin/settings/index", + "url" => "settings/index", "method" => "POST", "slug" => "admin.settings.index-post", "menu_show" => 0, @@ -64,7 +64,7 @@ ], [ "title" => "全部配置", - "url" => "admin/settings/all", + "url" => "settings/all", "method" => "GET", "slug" => "admin.settings.all", "menu_show" => 0, @@ -72,7 +72,7 @@ ], [ "title" => "全部配置", - "url" => "admin/settings/all", + "url" => "settings/all", "method" => "POST", "slug" => "admin.settings.all-post", "menu_show" => 0, @@ -80,7 +80,7 @@ ], [ "title" => "新增配置", - "url" => "admin/settings/add", + "url" => "settings/add", "method" => "GET", "slug" => "admin.settings.add", "menu_show" => 0, @@ -88,7 +88,7 @@ ], [ "title" => "新增配置", - "url" => "admin/settings/add", + "url" => "settings/add", "method" => "POST", "slug" => "admin.settings.add-post", "menu_show" => 0, @@ -96,7 +96,7 @@ ], [ "title" => "编辑配置", - "url" => "admin/settings/edit", + "url" => "settings/edit", "method" => "GET", "slug" => "admin.settings.edit", "menu_show" => 0, @@ -104,7 +104,7 @@ ], [ "title" => "编辑配置", - "url" => "admin/settings/edit", + "url" => "settings/edit", "method" => "POST", "slug" => "admin.settings.edit-post", "menu_show" => 0, @@ -112,7 +112,7 @@ ], [ "title" => "删除配置", - "url" => "admin/settings/del", + "url" => "settings/del", "method" => "POST", "slug" => "admin.settings.del-post", "menu_show" => 0, @@ -120,7 +120,7 @@ ], [ "title" => "配置排序", - "url" => "admin/settings/listorder", + "url" => "settings/listorder", "method" => "POST", "slug" => "admin.settings.listorder-post", "menu_show" => 0, @@ -128,7 +128,7 @@ ], [ "title" => "设置状态", - "url" => "admin/settings/setstate", + "url" => "settings/setstate", "method" => "POST", "slug" => "admin.settings.setstate-post", "menu_show" => 0, diff --git a/resources/view/config/all.html b/resources/view/config/all.html index f9202e7..2196eb2 100644 --- a/resources/view/config/all.html +++ b/resources/view/config/all.html @@ -52,10 +52,11 @@ diff --git a/resources/view/config/index.html b/resources/view/config/index.html index ffa5fb9..6df3ea4 100644 --- a/resources/view/config/index.html +++ b/resources/view/config/index.html @@ -24,26 +24,20 @@ {/block} {block name="script"} - -{php} -$addSug = ['get:admin.settings.add', 'post:admin.settings.add-post']; -$editSug = ['get:admin.settings.edit', 'post:admin.settings.edit-post']; -$delSug = 'post:admin.settings.del-post'; -{/php} - + diff --git a/src/Controller/Config.php b/src/Controller/Config.php index d489790..852cc7b 100644 --- a/src/Controller/Config.php +++ b/src/Controller/Config.php @@ -204,10 +204,10 @@ public function add() $status = ConfigModel::create($data); if (false === $status) { - $this->error('配置添加失败!'); + return $this->error('配置添加失败!'); } - $this->success('配置添加成功!'); + return $this->success('配置添加成功!'); } else { // ['name,title,ifoption,ifstring'] $fieldType = ConfigModel::getFieldType(); @@ -247,21 +247,21 @@ public function edit() 'id' => $id, ])->find(); if (empty($info)) { - $this->error('信息不存在!'); + return $this->error('信息不存在!'); } $status = ConfigModel::update($data, [ 'id' => $id, ]); if ($status === false) { - $this->error('配置编辑失败!'); + return $this->error('配置编辑失败!'); } - $this->success('配置编辑成功!'); + return $this->success('配置编辑成功!'); } else { $id = $this->request->param('id'); if (empty($id) || strlen($id) != 32) { - $this->error('参数错误!'); + return $this->error('参数错误!'); } // ['name,title,ifoption,ifstring'] @@ -271,7 +271,7 @@ public function edit() 'id' => $id, ])->find(); if (empty($info)) { - $this->error('信息不存在!'); + return $this->error('信息不存在!'); } $this->assign([ @@ -291,24 +291,24 @@ public function del() { $id = $this->request->param('id'); if (empty($id) || strlen($id) != 32) { - $this->error('参数错误!'); + return $this->error('参数错误!'); } $info = ConfigModel::where([ 'id' => $id, ])->find(); if (empty($info)) { - $this->error('信息不存在!'); + return $this->error('信息不存在!'); } $re = ConfigModel::where([ 'id' => $id, ])->delete(); if ($re === false) { - $this->error('删除失败!'); + return $this->error('删除失败!'); } - $this->success('删除成功'); + return $this->success('删除成功'); } /** @@ -318,7 +318,7 @@ public function listorder() { $id = $this->request->param('id'); if (empty($id) || strlen($id) != 32) { - $this->error('参数不能为空!'); + return $this->error('参数不能为空!'); } $listorder = $this->request->param('value/d', 0); @@ -333,10 +333,10 @@ public function listorder() ]); if ($rs === false) { - $this->error("排序失败!"); + return $this->error("排序失败!"); } - $this->success("排序成功!"); + return $this->success("排序成功!"); } /** @@ -346,7 +346,7 @@ public function setstate($id, $status) { $id = $this->request->param('id'); if (empty($id) || strlen($id) != 32) { - $this->error('参数不能为空!'); + return $this->error('参数不能为空!'); } $status = $this->request->param('status/d'); @@ -360,10 +360,10 @@ public function setstate($id, $status) 'status' => $status, ]); if ($rs === false) { - $this->error('操作失败!'); + return $this->error('操作失败!'); } - $this->success('操作成功!'); + return $this->success('操作成功!'); } }