Jonlin 6 năm trước cách đây
mục cha
commit
769b5345df
1 tập tin đã thay đổi với 5 bổ sung1 xóa
  1. 5 1
      application/admin/controller/Admins.php

+ 5 - 1
application/admin/controller/Admins.php

@@ -364,12 +364,16 @@ class Admins extends Base
         if (request()->isAjax()) {
             $id = input('param.id/d');
             //return $id;
+            $admins = db('admins')->where('group_id', $id)->select();
+            if(!empty($admins)){
+                return json(['code' => -1, 'data' => '', 'msg' => '请先移除该权限组下的管理员再删除']);
+            }
 
             try {
                 db('admingroup')->where('group_id', $id)->delete();
                 db('admingrouppower')->where('group_id', $id)->delete();
             } catch (\Exception $e) {
-                return json(['code' => -1, 'data' => '', 'msg' => $e->getMessage()]);
+                return json(['code' => -2, 'data' => '', 'msg' => $e->getMessage()]);
             }
 
             return json(['code' => 1, 'data' => '', 'msg' => '删除权限组成功']);