浏览代码

优化后台返回处理

邹景立 3 年之前
父节点
当前提交
843463f12e
共有 3 个文件被更改,包括 18 次插入14 次删除
  1. 13 2
      app/admin/controller/Index.php
  2. 4 12
      app/admin/controller/Menu.php
  3. 1 0
      app/admin/controller/User.php

+ 13 - 2
app/admin/controller/Index.php

@@ -55,7 +55,7 @@ class Index extends Controller
     /**
      * 修改用户资料
      * @login true
-     * @param integer $id 用户ID
+     * @param mixed $id 用户ID
      * @throws \think\db\exception\DataNotFoundException
      * @throws \think\db\exception\DbException
      * @throws \think\db\exception\ModelNotFoundException
@@ -71,9 +71,20 @@ class Index extends Controller
     }
 
     /**
+     * 资料修改后处理
+     * @param bool $status
+     */
+    protected function _info_form_result(bool $status)
+    {
+        if ($status) {
+            $this->success('用户资料修改成功!', 'javascript:location.reload()');
+        }
+    }
+
+    /**
      * 修改当前用户密码
      * @login true
-     * @param integer $id
+     * @param mixed $id
      * @throws \think\db\exception\DataNotFoundException
      * @throws \think\db\exception\DbException
      * @throws \think\db\exception\ModelNotFoundException

+ 4 - 12
app/admin/controller/Menu.php

@@ -138,17 +138,6 @@ class Menu extends Controller
     }
 
     /**
-     * 菜单编辑成功后刷新页面
-     * @param bool $state
-     */
-    protected function _form_result(bool $state)
-    {
-        if ($state) {
-            $this->success('系统菜单修改成功!', 'javascript:location.reload()');
-        }
-    }
-
-    /**
      * 修改菜单状态
      * @auth true
      * @throws \think\db\exception\DbException
@@ -182,6 +171,7 @@ class Menu extends Controller
         if ($result) {
             $id = $this->app->db->name($this->table)->getLastInsID();
             sysoplog('系统菜单管理', "添加系统菜单[{$id}]成功");
+            $this->success('系统菜单添加成功!', 'javascript:location.reload()');
         }
     }
 
@@ -194,6 +184,7 @@ class Menu extends Controller
         if ($result) {
             $id = input('id') ?: 0;
             sysoplog('系统菜单管理', "修改系统菜单[{$id}]成功");
+            $this->success('系统菜单修改成功!', 'javascript:location.reload()');
         }
     }
 
@@ -206,6 +197,7 @@ class Menu extends Controller
         if ($result) {
             [$id, $state] = [input('id'), input('status')];
             sysoplog('系统菜单管理', ($state ? '激活' : '禁用') . "系统菜单[{$id}]成功");
+            $this->success('系统菜单修改成功!', 'javascript:location.reload()');
         }
     }
 
@@ -218,7 +210,7 @@ class Menu extends Controller
         if ($result) {
             $id = input('id') ?: 0;
             sysoplog('系统菜单管理', "删除系统菜单[{$id}]成功");
+            $this->success('系统菜单删除成功!', 'javascript:location.reload()');
         }
     }
-
 }

+ 1 - 0
app/admin/controller/User.php

@@ -201,6 +201,7 @@ class User extends Controller
         if ($result) {
             $id = input('id') ?: 0;
             sysoplog('系统用户管理', "修改系统用户[{$id}]成功");
+            $this->success('用户资料修改成功!', 'javascript:location.reload()');
         }
     }