cqp 3 сар өмнө
parent
commit
edeb248900

+ 4 - 0
app/Model/Employee.php

@@ -18,6 +18,10 @@ class Employee extends DataScopeBaseModel
     const IS_ADMIN_ZERO = 0;
     const IS_ADMIN_ONE = 1;
     const IS_ADMIN_TWO = 2;
+    const IS_ADMIN_TITLE_SIMPLE = [
+        self::IS_ADMIN_ZERO => '普通账号',
+        self::IS_ADMIN_ONE => '后台用户',
+    ];
     const IS_ADMIN_TITLE = [
         self::IS_ADMIN_ZERO => '普通账号(限制后台登录)',
         self::IS_ADMIN_ONE => '后台用户',

+ 1 - 0
app/Service/EmployeeService.php

@@ -313,6 +313,7 @@ class EmployeeService extends Service
         if(empty($data['state'])) return [false,'状态不能为空'];
         if(! isset(Employee::State_Type[$data['state']])) return [false,'状态不存在'];
         if(! empty($data['is_admin'])){
+            if(! isset(Employee::IS_ADMIN_TITLE_SIMPLE[$data['is_admin']])) return [false, 'is_admin类型不存在'];
             if(empty($data['password'])) return [false, '密码不能为空'];
             if(mb_strlen($data['password']) < 6) return [false, '密码长度不得小于6位长度'];
             if(empty($data['role'])) return [false, '角色不能为空'];