Quellcode durchsuchen

[智价云] 员工登录&操作记录

tangyuanwang vor 2 Monaten
Ursprung
Commit
ca0ff5821b

+ 18 - 7
app/Helpers/functions.php

@@ -197,14 +197,25 @@ function resize( $filename, $width=null, $height=null) {
  * @param string     $module  模块
  * 
  */
-function is_super($uid,$module='manager'){
-    switch ($module){
-        case 'manager':
-            $AdminUserModel      = new App\Models\Manager\AdminUser();
-            break;
+function is_super($uid,$is_admin,$module='manager'){
+    if ($is_admin == '0') {
+        switch ($module) {
+            case 'manager':
+                $AdminUserModel      = new App\Models\Manager\AdminUser();
+                break;
+        }
+        // 返回结果
+        $isSuper                    = $AdminUserModel->query()->where([['uid', '=', $uid]])->value('is_super');
+    }else{
+        switch ($module) {
+            case 'manager':
+                $AdminUserModel      = new App\models\Manager\Personnel\Employee();
+                break;
+        }
+        // 返回结果
+        $isSuper                    = $AdminUserModel->query()->where([['id', '=', $uid]])->value('is_super');
     }
-    // 返回结果
-    $isSuper                    = $AdminUserModel->query()->where([['uid','=',$uid]])->value('is_super');
+   
     // 默认无权限
     return                      $isSuper ? true : false;
 }

+ 2 - 2
app/Http/Controllers/Controller.php

@@ -54,11 +54,11 @@ class Controller extends BaseController
      * @param   String       $general_description    操作描述
      *
      */
-    protected function addAdminHistory($admin_menu_name, $uid, $table, $type, $oldData, $newData, $general_description ='')
+    protected function addAdminHistory($admin_menu_name, $uid, $is_admin, $table, $type, $oldData, $newData, $general_description = '')
     {
         //记录详细操作历史
         $AdminHistory            = (new AdminHistory());
         // 记录数据
-        $AdminHistory->addAll($admin_menu_name, $uid, $table, $type, $oldData, $newData, $general_description);
+        $AdminHistory->addAll($admin_menu_name, $uid, $is_admin, $table, $type, $oldData, $newData, $general_description);
     }
 }

+ 22 - 10
app/Http/Controllers/Manager/AdminHistory.php

@@ -5,6 +5,8 @@ namespace App\Http\Controllers\manager;
 use App\Http\Controllers\Controller;
 use App\Http\Requests\Manager\AdminHistory as Request;
 use App\Models\Manager\AdminHistory as AdminHistoryModel;
+use App\Models\Manager\AdminUser as AdminUserModel;
+use App\Models\Manager\Personnel\Employee as EmployeeModel;
 
 /**
  * 操作日志记录
@@ -21,7 +23,7 @@ class AdminHistory extends Controller
      * @date      2025-12-24
      * 
      */
-    public function list(Request $request, AdminHistoryModel $AdminHistoryModel)
+    public function list(Request $request, AdminHistoryModel $AdminHistoryModel, AdminUserModel $AdminUserModel, EmployeeModel $EmployeeModel)
     {
         $request->scene('list')->validate();
         // 查询条件
@@ -33,18 +35,28 @@ class AdminHistory extends Controller
         $general_description = request('general_description', '');
         $notes_type = request('notes_type', '');
         // 时间条件
-        if ($start_time) $map[] = ['admin_history.insert_time', '>=', strtotime($start_time)];
-        if ($end_time) $map[]   = ['admin_history.insert_time', '<=', strtotime($end_time)];
+        if ($start_time) $map[] = ['insert_time', '>=', strtotime($start_time)];
+        if ($end_time) $map[]   = ['insert_time', '<=', strtotime($end_time)];
         // 其他条件
-        if ($module_menu_name) $map[] = ['admin_history.module_menu_name', 'like', "%$module_menu_name%"];
-        if ($general_description) $map[] = ['admin_history.general_description', 'like', "%$general_description%"];
-        if ($notes_type) $map[] = ['admin_history.notes_type', '=', $notes_type];
+        if ($module_menu_name) $map[] = ['module_menu_name', 'like', "%$module_menu_name%"];
+        if ($general_description) $map[] = ['general_description', 'like', "%$general_description%"];
+        if ($notes_type) $map[] = ['notes_type', '=', $notes_type];
         // 查询数据
-        $result = $AdminHistoryModel->join('admin', 'admin.uid', '=', 'admin_history.admin_uid')
+        $result = $AdminHistoryModel
             ->where($map)
-            ->select(['admin_history.id','admin.username','admin_history.admin_uid','admin_history.module_menu_name','admin_history.notes_type','admin_history.general_description','admin_history.insert_time'])
-            ->orderByDesc('admin_history.id')
-            ->paginate($limit);
+            ->select(['id', 'admin_uid', 'is_admin', 'module_menu_name', 'notes_type', 'general_description', 'insert_time'])
+            ->orderByDesc('id')
+            ->paginate($limit)->toarray();
+        if (isset($result['data']) && count($result['data']) > 0) {
+            foreach ($result['data'] as $key => $value) {
+                $is_admin = $value['is_admin'];
+                if ($is_admin == '0') {
+                    $result['data'][$key]['username'] = $AdminUserModel->where('uid', $value['admin_uid'])->value('username');
+                } else {
+                    $result['data'][$key]['username'] = $EmployeeModel->where('id', $value['admin_uid'])->value('name');
+                }
+            }
+        }
         // 分配数据
         if (!$result)  return json_send(['code' => 'success', 'msg' => '获取成功', 'data' => []]);
         // 加载模板

+ 30 - 13
app/Http/Controllers/Manager/AdminUser.php

@@ -6,6 +6,7 @@ use App\Http\Requests\Manager\AdminUser as Request;
 use App\Models\Manager\AdminUser as Model;
 use App\Models\Manager\AuthGroupAccess;
 use App\Models\Manager\AuthGroup;
+use App\Models\Manager\Personnel\Employee as EmployeeModel;
 
 /**
  * 系统用户
@@ -225,26 +226,42 @@ class AdminUser extends Manager
      * @version   1.0
      * @date      2025-12-02
      */
-    public function alter_password(Request $request, Model $Model)
+    public function alter_password(Request $request, Model $Model,EmployeeModel $EmployeeModel)
     {
         // 验证参数
         $request->scene('alter_password')->validate();
         // 获取参数
         $uid             = request('access_token.uid', 0);
+        $is_admin        = request('access_token.is_admin', '');
         $oldpass         = request('oldpass', '');
         $password         = request('password', '');
-        // 查询用户
-        $oldData         = $Model->getOne($uid);
-        // 如果用户不存在
-        if (!$oldData)     return json_send(['code' => 'error', 'msg' => '用户不存在']);
-        // 比对密码
-        if (md5($oldpass) != $oldData['password']) return json_send(['code' => 'error', 'msg' => '原密码有误,请核对密码']);
-        // 执行修改
-        $result             = $Model->edit($uid, ['password' => md5($password)]);
-        // 提示新增失败
-        if (!$result)     return json_send(['code' => 'error', 'msg' => '修改失败']);
-        // 退出登录
-        $Model->LoginOut($uid, 'manager');
+        if ($is_admin == '0') {
+            // 查询用户
+            $oldData         = $Model->getOne($uid);
+            // 如果用户不存在
+            if (!$oldData)     return json_send(['code' => 'error', 'msg' => '用户不存在']);
+            // 比对密码
+            if (md5($oldpass) != $oldData['password']) return json_send(['code' => 'error', 'msg' => '原密码有误,请核对密码']);
+            // 执行修改
+            $result             = $Model->edit($uid, ['password' => md5($password)]);
+            // 提示新增失败
+            if (!$result)     return json_send(['code' => 'error', 'msg' => '修改失败']);
+            // 退出登录
+            $Model->LoginOut($uid, 'manager');
+        }else{
+            // 查询用户
+            $oldData         = $EmployeeModel->getOne($uid);
+            // 如果用户不存在
+            if (!$oldData)     return json_send(['code' => 'error', 'msg' => '用户不存在']);
+            // 比对密码
+            if (md5($oldpass) != $oldData['password']) return json_send(['code' => 'error', 'msg' => '原密码有误,请核对密码']);
+            // 执行修改
+            $result             = $EmployeeModel->edit($uid, ['password' => md5($password)]);
+            // 提示新增失败
+            if (!$result)     return json_send(['code' => 'error', 'msg' => '修改失败']);
+            // 退出登录
+            $EmployeeModel->LoginOut($uid, 'manager');
+        }
         // 告知结果
         return           json_send(['code' => 'success', 'msg' => '修改成功', 'data' => ['uid' => $uid]]);
     }

+ 8 - 4
app/Http/Controllers/Manager/Collect/Product.php

@@ -116,9 +116,10 @@ class Product extends Controller
         if (!$result)     return json_send(['code' => 'error', 'msg' => '新增失败']);
         // 记录行为
         $admin_id   = request('access_token.uid', 0); //用户ID
+        $is_admin   = request('access_token.is_admin', 0); //是否管理员操作 0=是1=否
         $table_name = $ProductModel->getTable();
         $notes_type = 1; //操作类型,1添加,2修改,3=删除
-        $this->addAdminHistory('采集配置-商品管理', $admin_id, $table_name, $notes_type, [], $all_data, '新增了商品' . $all_data['product_name'] . '信息');
+        $this->addAdminHistory('采集配置-商品管理', $admin_id, $is_admin, $table_name, $notes_type, [], $all_data, '新增了商品' . $all_data['product_name'] . '信息');
         // 告知结果
         return json_send(['code' => 'success', 'msg' => '新增成功']);
     }
@@ -165,9 +166,10 @@ class Product extends Controller
         if (!$result)     return json_send(['code' => 'error', 'msg' => '修改失败']);
         // 记录行为
         $admin_id   = request('access_token.uid', 0); //用户ID
+        $is_admin   = request('access_token.is_admin', 0); //是否管理员操作 0=是1=否
         $table_name = $ProductModel->getTable();
         $notes_type = 2; //操作类型,1添加,2修改,3=删除
-        $this->addAdminHistory('采集配置-商品管理', $admin_id, $table_name, $notes_type, $oldData, $all_data, '修改了商品' . $oldData['product_name'] . '信息');
+        $this->addAdminHistory('采集配置-商品管理', $admin_id, $is_admin, $table_name, $notes_type, $oldData, $all_data, '修改了商品' . $oldData['product_name'] . '信息');
         // 告知结果
         return json_send(['code' => 'success', 'msg' => '修改成功']);
     }
@@ -204,9 +206,10 @@ class Product extends Controller
         if (!$result)    return json_send(['code' => 'error', 'msg' => '设置失败']);
         // 记录行为
         $admin_id   = request('access_token.uid', 0); //用户ID
+        $is_admin   = request('access_token.is_admin', 0); //是否管理员操作 0=是1=否
         $table_name = $ProductModel->getTable();
         $notes_type = 2; //操作类型,1添加,2修改,3=删除
-        $this->addAdminHistory('采集配置-商品管理', $admin_id, $table_name, $notes_type, [], ['status' => $status], '修改了商品' . $Product->product_name . '状态');
+        $this->addAdminHistory('采集配置-商品管理', $admin_id, $is_admin, $table_name, $notes_type, [], ['status' => $status], '修改了商品' . $Product->product_name . '状态');
         // 告知结果
         return             json_send(['code' => 'success', 'msg' => '设置成功']);
     }
@@ -237,9 +240,10 @@ class Product extends Controller
             $Product->delete();
             // 记录行为
             $admin_id   = request('access_token.uid', 0); //用户ID
+            $is_admin   = request('access_token.is_admin', 0); //是否管理员操作 0=是1=否
             $table_name = $ProductModel->getTable();
             $notes_type = 3; //操作类型,1添加,2修改,3=删除
-            $this->addAdminHistory('采集配置-商品管理', $admin_id, $table_name, $notes_type, $Product->toarray(), [], '删除了商品' . $Product->product_name . '信息');
+            $this->addAdminHistory('采集配置-商品管理', $admin_id, $is_admin, $table_name, $notes_type, $Product->toarray(), [], '删除了商品' . $Product->product_name . '信息');
             // 告知结果
             DB::commit();
             return             json_send(['code' => 'success', 'msg' => '删除成功']);

+ 52 - 26
app/Http/Controllers/Manager/Login.php

@@ -6,6 +6,7 @@ use App\Models\Manager\AdminUser;
 use App\Http\Requests\Manager\Login as Request;
 use App\Models\Manager\AuthRule;
 use App\Facades\Servers\Encrypts\AccessToken;
+use App\Models\Manager\Personnel\Employee as EmployeeModel;
 
 /**
  * 管理后台登录控制器
@@ -26,7 +27,7 @@ class Login extends Manager
 	 * @param string 	password	登录密码
 	 * 
 	 * */
-	public function index(Request $Request, AdminUser $AdminUser, AuthRule $AuthRule)
+	public function index(Request $Request, AdminUser $AdminUser, AuthRule $AuthRule, EmployeeModel $EmployeeModel)
 	{
 		// 验证规则
 		$Request->scene('login')->validate();
@@ -34,24 +35,44 @@ class Login extends Manager
 		$username    = $Request->input('username', '');
 		// 接收数据
 		$password    = $Request->input('password', '');
-		// 查询用户
-		$admin    	= $AdminUser->orWhere('username', $username)->first(['uid', 'username', 'phone', 'status', 'password', 'insert_time', 'update_time']);
-		// 用户不存在
-		if (!$admin || $admin['status'])	return json_send(['code' => 'error', 'msg' => '密码错误或账号不存在']);
-		// 用户不存在
-		if ($admin['status']) 				return json_send(['code' => 'error', 'msg' => '该账号已停用']);
-		// 转数组
-		$admin    	= $admin->toArray();
-		// 比对密码
-		if (md5($password) != $admin['password']) return json_send(['code' => 'error', 'msg' => '密码错误或账号不存在']);
-		// 登录
-		$accessToken 						= $AdminUser->Login($admin['uid'], 'manager');
-		// 比对密码
-		if (isset($accessToken['error'])) 	return json_send(['code' => 'error', 'msg' => '登录失败', 'data' => $accessToken['data']]);
-		// 获取权限列表
-		$accessToken['username']			= $admin['username'];
-		// 获取权限列表
-		$accessToken['auth_rules']			= $AuthRule->getAuthList($admin['uid'], 'manager');;
+		if (strtolower($username) == 'admin') {
+			// 查询用户
+			$admin    	= $AdminUser->orWhere('username', $username)->first(['uid', 'username', 'phone', 'status', 'password', 'insert_time', 'update_time']);
+			// 用户不存在
+			if (!$admin || $admin['status'])	return json_send(['code' => 'error', 'msg' => '密码错误或账号不存在']);
+			// 用户不存在
+			if ($admin['status']) 				return json_send(['code' => 'error', 'msg' => '该账号已停用']);
+			// 转数组
+			$admin    	= $admin->toArray();
+			// 比对密码
+			if (md5($password) != $admin['password']) return json_send(['code' => 'error', 'msg' => '密码错误或账号不存在']);
+			// 登录
+			$accessToken 						= $AdminUser->Login($admin['uid'],'manager');
+			// 比对密码
+			if (isset($accessToken['error'])) 	return json_send(['code' => 'error', 'msg' => '登录失败', 'data' => $accessToken['data']]);
+			// 获取权限列表
+			$accessToken['username']			= $admin['username'];
+			// 获取权限列表
+			$accessToken['auth_rules']			= $AuthRule->getAuthList($admin['uid'], 'manager');
+		} else {
+			$admin    	= $EmployeeModel->where('employee_code', $username)->first(['id as uid', 'name as username', 'mobile as phone', 'status', 'password', 'insert_time', 'update_time']);
+			// 用户不存在
+			if (!$admin || $admin['status'])	return json_send(['code' => 'error', 'msg' => '密码错误或账号不存在']);
+			// 用户不存在
+			if ($admin['status']) 				return json_send(['code' => 'error', 'msg' => '该账号已停用']);
+			// 转数组
+			$admin    	= $admin->toArray();
+			// 比对密码
+			if (md5($password) != $admin['password']) return json_send(['code' => 'error', 'msg' => '密码错误或账号不存在']);
+			// 登录
+			$accessToken 						= $EmployeeModel->Login($admin['uid'],'manager');
+			// 比对密码
+			if (isset($accessToken['error'])) 	return json_send(['code' => 'error', 'msg' => '登录失败', 'data' => $accessToken['data']]);
+			// 获取权限列表
+			$accessToken['username']			= $admin['username'];
+			$accessToken['auth_rules']			= $AuthRule->getAuthList($admin['uid'], 'manager');
+		}
+		
 		// 表单令牌
 		return    	json_send(['code' => 'success', 'msg' => '登录成功', 'data' => $accessToken]);
 	}
@@ -67,15 +88,21 @@ class Login extends Manager
 	 * @param string 	password	登录密码
 	 * 
 	 * */
-	public function out(Request $Request, AdminUser $AdminUser)
+	public function out(Request $Request, AdminUser $AdminUser, EmployeeModel $EmployeeModel)
 	{
 		$token  = $Request->input('access_token_manager', '');
 		// 解码
 		$userInfo                       = AccessToken::decode($token);
 		// 验证规则
 		$uid     	= $userInfo['uid'];
-		// 退出登录
-		$AdminUser->LoginOut($uid, 'manager');
+		$is_admin   = $userInfo['is_admin'];
+		if ($is_admin == '0') {
+			// 退出登录
+			$AdminUser->LoginOut($uid, 'manager');
+		}else{
+			$EmployeeModel->LoginOut($uid, 'manager');
+		}
+		
 		// 表单令牌
 		return    	json_send(['code' => 'success', 'msg' => '退出成功', 'data' => '']);
 	}
@@ -90,7 +117,7 @@ class Login extends Manager
 	 * @param string 	password	登录密码
 	 * 
 	 */
-	public function mobile(Request $Request, AdminUser $AdminUser, AuthRule $AuthRule)
+	public function mobile(Request $Request,AuthRule $AuthRule, EmployeeModel $EmployeeModel)
 	{
 		// 验证规则
 		$Request->scene('mobile')->validate();
@@ -99,7 +126,7 @@ class Login extends Manager
 		// 接收数据
 		$password    = $Request->input('password', '');
 		// 查询用户
-		$admin    	= $AdminUser->where('phone', $phone)->first(['uid', 'username', 'phone', 'status', 'password', 'insert_time', 'update_time']);
+		$admin    	= $EmployeeModel->where('mobile', $phone)->first(['id as uid', 'name as username', 'mobile as phone', 'status', 'password', 'insert_time', 'update_time']);
 		// 用户不存在
 		if (!$admin || $admin['status'])	return json_send(['code' => 'error', 'msg' => '密码错误或账号不存在']);
 		// 用户不存在
@@ -109,7 +136,7 @@ class Login extends Manager
 		// 比对密码
 		if (md5($password) != $admin['password']) return json_send(['code' => 'error', 'msg' => '密码错误或账号不存在']);
 		// 登录
-		$accessToken 						= $AdminUser->Login($admin['uid'], 'manager');
+		$accessToken 						= $EmployeeModel->Login($admin['uid'], 'manager');
 		// 比对密码
 		if (isset($accessToken['error'])) 	return json_send(['code' => 'error', 'msg' => '登录失败', 'data' => $accessToken['data']]);
 		// 获取权限列表
@@ -118,6 +145,5 @@ class Login extends Manager
 		$accessToken['auth_rules']			= $AuthRule->getAuthList($admin['uid'], 'manager');;
 		// 表单令牌
 		return    	json_send(['code' => 'success', 'msg' => '登录成功', 'data' => $accessToken]);
-
 	}
 }

+ 8 - 4
app/Http/Controllers/Manager/Personnel/Department.php

@@ -123,9 +123,10 @@ class Department extends Controller
         if (!$result)     return json_send(['code' => 'error', 'msg' => '新增失败']);
         // 记录行为
         $admin_id   = request('access_token.uid', 0); //用户ID
+        $is_admin   = request('access_token.is_admin', 0); //是否管理员操作 0=是1=否
         $table_name = $DepartmentModel->getTable();
         $notes_type = 1; //操作类型,1添加,2修改,3=删除
-        $this->addAdminHistory('人员信息管理-部门管理', $admin_id, $table_name, $notes_type, [], $all_data, '新增了部门' . $all_data['name'] . '信息');
+        $this->addAdminHistory('人员信息管理-部门管理', $admin_id, $is_admin, $table_name, $notes_type, [], $all_data, '新增了部门' . $all_data['name'] . '信息');
         // 告知结果
         return json_send(['code' => 'success', 'msg' => '新增成功']);
     }
@@ -160,9 +161,10 @@ class Department extends Controller
         if (!$result)     return json_send(['code' => 'error', 'msg' => '修改失败']);
         // 记录行为
         $admin_id   = request('access_token.uid', 0); //用户ID
+        $is_admin   = request('access_token.is_admin', 0); //是否管理员操作 0=是1=否
         $table_name = $DepartmentModel->getTable();
         $notes_type = 2; //操作类型,1添加,2修改,3=删除
-        $this->addAdminHistory('人员信息管理-部门管理', $admin_id, $table_name, $notes_type,$oldData, $all_data, '修改了部门' . $oldData['name'] . '信息');
+        $this->addAdminHistory('人员信息管理-部门管理', $admin_id, $is_admin, $table_name, $notes_type,$oldData, $all_data, '修改了部门' . $oldData['name'] . '信息');
         // 告知结果
         return json_send(['code' => 'success', 'msg' => '修改成功']);
     }
@@ -199,9 +201,10 @@ class Department extends Controller
         if (!$result)    return json_send(['code' => 'error', 'msg' => '设置失败']);
         // 记录行为
         $admin_id   = request('access_token.uid', 0); //用户ID
+        $is_admin   = request('access_token.is_admin', 0); //是否管理员操作 0=是1=否
         $table_name = $DepartmentModel->getTable();
         $notes_type = 2; //操作类型,1添加,2修改,3=删除
-        $this->addAdminHistory('人员信息管理-部门管理', $admin_id, $table_name, $notes_type, [], ['status' => $status], '修改了部门' . $Department->name . '状态');
+        $this->addAdminHistory('人员信息管理-部门管理', $admin_id, $is_admin, $table_name, $notes_type, [], ['status' => $status], '修改了部门' . $Department->name . '状态');
         // 告知结果
         return             json_send(['code' => 'success', 'msg' => '设置成功']);
     }
@@ -235,9 +238,10 @@ class Department extends Controller
         if (!$result)    return json_send(['code' => 'error', 'msg' => '删除失败']);
         // 记录行为
         $admin_id   = request('access_token.uid', 0); //用户ID
+        $is_admin   = request('access_token.is_admin', 0); //是否管理员操作 0=是1=否
         $table_name = $DepartmentModel->getTable();
         $notes_type = 3; //操作类型,1添加,2修改,3=删除
-        $this->addAdminHistory('人员信息管理-部门管理', $admin_id, $table_name, $notes_type, $Department->toArray(), [], '删除了部门' . $Department->name . '信息');
+        $this->addAdminHistory('人员信息管理-部门管理', $admin_id, $is_admin, $table_name, $notes_type, $Department->toArray(), [], '删除了部门' . $Department->name . '信息');
         // 告知结果
         return             json_send(['code' => 'success', 'msg' => '删除成功']);
     }

+ 8 - 4
app/Http/Controllers/Manager/Personnel/Employee.php

@@ -246,9 +246,10 @@ class Employee extends Controller
         if (!$result)     return json_send(['code' => 'error', 'msg' => '新增失败']);
         // 记录行为
         $admin_id   = request('access_token.uid', 0); //用户ID
+        $is_admin   = request('access_token.is_admin', 0); //是否管理员操作 0=是1=否
         $table_name = $EmployeeModel->getTable();
         $notes_type = 1; //操作类型,1添加,2修改,3=删除
-        $this->addAdminHistory('人员信息管理-员工管理', $admin_id, $table_name, $notes_type, [], $all_data, '新增了员工' . $all_data['name'] . '信息');
+        $this->addAdminHistory('人员信息管理-员工管理', $admin_id, $is_admin, $table_name, $notes_type, [], $all_data, '新增了员工' . $all_data['name'] . '信息');
         // 告知结果
         return json_send(['code' => 'success', 'msg' => '新增成功']);
     }
@@ -289,9 +290,10 @@ class Employee extends Controller
         if (!$result)     return json_send(['code' => 'error', 'msg' => '修改失败']);
         // 记录行为
         $admin_id   = request('access_token.uid', 0); //用户ID
+        $is_admin   = request('access_token.is_admin', 0); //是否管理员操作 0=是1=否
         $table_name = $EmployeeModel->getTable();
         $notes_type = 2; //操作类型,1添加,2修改,3=删除
-        $this->addAdminHistory('人员信息管理-员工管理', $admin_id, $table_name, $notes_type,$oldData, $all_data, '修改了员工' .$oldData['name'] . '信息');
+        $this->addAdminHistory('人员信息管理-员工管理', $admin_id, $is_admin, $table_name, $notes_type,$oldData, $all_data, '修改了员工' .$oldData['name'] . '信息');
         // 告知结果
         return json_send(['code' => 'success', 'msg' => '修改成功']);
     }
@@ -324,9 +326,10 @@ class Employee extends Controller
         if (!$result)    return json_send(['code' => 'error', 'msg' => '设置失败']);
         // 记录行为
         $admin_id   = request('access_token.uid', 0); //用户ID
+        $is_admin   = request('access_token.is_admin', 0); //是否管理员操作 0=是1=否
         $table_name = $EmployeeModel->getTable();
         $notes_type = 2; //操作类型,1添加,2修改,3=删除
-        $this->addAdminHistory('人员信息管理-员工管理', $admin_id, $table_name, $notes_type, [], ['status' => $status], '修改了员工' . $Employee->name . '状态');
+        $this->addAdminHistory('人员信息管理-员工管理', $admin_id, $is_admin, $table_name, $notes_type, [], ['status' => $status], '修改了员工' . $Employee->name . '状态');
         // 告知结果
         return             json_send(['code' => 'success', 'msg' => '设置成功']);
     }
@@ -357,9 +360,10 @@ class Employee extends Controller
         if (!$result)    return json_send(['code' => 'error', 'msg' => '删除失败']);
         // 记录行为
         $admin_id   = request('access_token.uid', 0); //用户ID
+        $is_admin   = request('access_token.is_admin', 0); //是否管理员操作 0=是1=否
         $table_name = $EmployeeModel->getTable();
         $notes_type = 3; //操作类型,1添加,2修改,3=删除
-        $this->addAdminHistory('人员信息管理-员工管理', $admin_id, $table_name, $notes_type, $Employee->toarray(), [], '删除了员工' . $Employee->name . '信息');
+        $this->addAdminHistory('人员信息管理-员工管理', $admin_id, $is_admin, $table_name, $notes_type, $Employee->toarray(), [], '删除了员工' . $Employee->name . '信息');
         // 告知结果
         return             json_send(['code' => 'success', 'msg' => '删除成功']);
     }

+ 8 - 4
app/Http/Controllers/Manager/Personnel/Roles.php

@@ -122,9 +122,10 @@ class Roles extends Controller
         if (!$result)     return json_send(['code' => 'error', 'msg' => '新增失败']);
         // 记录行为
         $admin_id   = request('access_token.uid', 0); //用户ID
+        $is_admin   = request('access_token.is_admin', 0); //是否管理员操作 0=是1=否
         $table_name = $RolesModel->getTable();
         $notes_type = 1; //操作类型,1添加,2修改,3=删除
-        $this->addAdminHistory('人员信息管理-角色管理', $admin_id, $table_name, $notes_type, [], $all_data, '新增了角色' . $all_data['name'] . '信息');
+        $this->addAdminHistory('人员信息管理-角色管理', $admin_id, $is_admin, $table_name, $notes_type, [], $all_data, '新增了角色' . $all_data['name'] . '信息');
         // 告知结果
         return json_send(['code' => 'success', 'msg' => '新增成功']);
     }
@@ -159,9 +160,10 @@ class Roles extends Controller
         if (!$result)     return json_send(['code' => 'error', 'msg' => '修改失败']);
         // 记录行为
         $admin_id   = request('access_token.uid', 0); //用户ID
+        $is_admin   = request('access_token.is_admin', 0); //是否管理员操作 0=是1=否
         $table_name = $RolesModel->getTable();
         $notes_type = 2; //操作类型,1添加,2修改,3=删除
-        $this->addAdminHistory('人员信息管理-角色管理', $admin_id, $table_name, $notes_type,$oldData, $all_data, '修改了角色' . $oldData['name'] . '信息');
+        $this->addAdminHistory('人员信息管理-角色管理', $admin_id, $is_admin, $table_name, $notes_type,$oldData, $all_data, '修改了角色' . $oldData['name'] . '信息');
         // 告知结果
         return json_send(['code' => 'success', 'msg' => '修改成功']);
     }
@@ -199,9 +201,10 @@ class Roles extends Controller
         if (!$result)    return json_send(['code' => 'error', 'msg' => '设置失败']);
         // 记录行为
         $admin_id   = request('access_token.uid', 0); //用户ID
+        $is_admin   = request('access_token.is_admin', 0); //是否管理员操作 0=是1=否
         $table_name = $RolesModel->getTable();
         $notes_type = 2; //操作类型,1添加,2修改,3=删除
-        $this->addAdminHistory('人员信息管理-角色管理', $admin_id, $table_name, $notes_type, [], ['status' => $status], '修改了角色' . $Roles->name . '状态');
+        $this->addAdminHistory('人员信息管理-角色管理', $admin_id, $is_admin, $table_name, $notes_type, [], ['status' => $status], '修改了角色' . $Roles->name . '状态');
         // 告知结果
         return             json_send(['code' => 'success', 'msg' => '设置成功']);
     }
@@ -237,9 +240,10 @@ class Roles extends Controller
         if (!$result)    return json_send(['code' => 'error', 'msg' => '删除失败']);
         // 记录行为
         $admin_id   = request('access_token.uid', 0); //用户ID
+        $is_admin   = request('access_token.is_admin', 0); //是否管理员操作 0=是1=否
         $table_name = $RolesModel->getTable();
         $notes_type = 3; //操作类型,1添加,2修改,3=删除
-        $this->addAdminHistory('人员信息管理-角色管理', $admin_id, $table_name, $notes_type, $Roles->toarray(), [], '删除了角色' . $Roles->name . '信息');
+        $this->addAdminHistory('人员信息管理-角色管理', $admin_id, $is_admin, $table_name, $notes_type, $Roles->toarray(), [], '删除了角色' . $Roles->name . '信息');
         // 告知结果
         return             json_send(['code' => 'success', 'msg' => '删除成功']);
     }

+ 8 - 4
app/Http/Controllers/Manager/WashConfig/CompanyCategory.php

@@ -122,9 +122,10 @@ class CompanyCategory extends Controller
         if (!$result)     return json_send(['code' => 'error', 'msg' => '新增失败']);
         // 记录行为
         $admin_id   = request('access_token.uid', 0); //用户ID
+        $is_admin   = request('access_token.is_admin', 0); //是否管理员操作 0=是1=否
         $table_name = $CompanyCategoryModel->getTable();
         $notes_type = 1; //操作类型,1添加,2修改,3=删除
-        $this->addAdminHistory('清洗配置-公司分类管理', $admin_id, $table_name, $notes_type,[],$all_data, '新增了分类' . $all_data['name'] . '信息');
+        $this->addAdminHistory('清洗配置-公司分类管理', $admin_id, $is_admin, $table_name, $notes_type,[],$all_data, '新增了分类' . $all_data['name'] . '信息');
         // 告知结果
         return json_send(['code' => 'success', 'msg' => '新增成功']);
     }
@@ -159,9 +160,10 @@ class CompanyCategory extends Controller
         if (!$result)     return json_send(['code' => 'error', 'msg' => '修改失败']);
         // 记录行为
         $admin_id   = request('access_token.uid', 0); //用户ID
+        $is_admin   = request('access_token.is_admin', 0); //是否管理员操作 0=是1=否
         $table_name = $CompanyCategoryModel->getTable();
         $notes_type = 2; //操作类型,1添加,2修改,3=删除
-        $this->addAdminHistory('清洗配置-公司分类管理', $admin_id, $table_name, $notes_type,$oldData,$all_data, '修改了分类' .$oldData['name'] . '信息');
+        $this->addAdminHistory('清洗配置-公司分类管理', $admin_id, $is_admin, $table_name, $notes_type,$oldData,$all_data, '修改了分类' .$oldData['name'] . '信息');
         // 告知结果
         return json_send(['code' => 'success', 'msg' => '修改成功']);
     }
@@ -197,9 +199,10 @@ class CompanyCategory extends Controller
         if (!$result)    return json_send(['code' => 'error', 'msg' => '设置失败']);
         // 记录行为
         $admin_id   = request('access_token.uid', 0); //用户ID
+        $is_admin   = request('access_token.is_admin', 0); //是否管理员操作 0=是1=否
         $table_name = $CompanyCategoryModel->getTable();
         $notes_type = 2; //操作类型,1添加,2修改,3=删除
-        $this->addAdminHistory('清洗配置-公司分类管理', $admin_id, $table_name, $notes_type,[], ['status' => $status], '修改了分类' .$CompanyCategory->name . '状态');
+        $this->addAdminHistory('清洗配置-公司分类管理', $admin_id, $is_admin, $table_name, $notes_type,[], ['status' => $status], '修改了分类' .$CompanyCategory->name . '状态');
         // 告知结果
         return             json_send(['code' => 'success', 'msg' => '设置成功']);
     }
@@ -232,9 +235,10 @@ class CompanyCategory extends Controller
         if (!$result)    return json_send(['code' => 'error', 'msg' => '删除失败']);
         // 记录行为
         $admin_id   = request('access_token.uid', 0); //用户ID
+        $is_admin   = request('access_token.is_admin', 0); //是否管理员操作 0=是1=否
         $table_name = $CompanyCategoryModel->getTable();
         $notes_type = 3; //操作类型,1添加,2修改,3=删除
-        $this->addAdminHistory('清洗配置-公司分类管理', $admin_id, $table_name, $notes_type, $CompanyCategory->toArray(), [], '删除了分类' .$CompanyCategory->name . '信息');
+        $this->addAdminHistory('清洗配置-公司分类管理', $admin_id, $is_admin, $table_name, $notes_type, $CompanyCategory->toArray(), [], '删除了分类' .$CompanyCategory->name . '信息');
         // 告知结果
         return             json_send(['code' => 'success', 'msg' => '删除成功']);
     }

+ 8 - 4
app/Http/Controllers/Manager/WashConfig/LowPriceGoods.php

@@ -161,9 +161,10 @@ class LowPriceGoods extends Controller
         if (!$result)     return json_send(['code' => 'error', 'msg' => '新增失败']);
         // 记录行为
         $admin_id   = request('access_token.uid', 0); //用户ID
+        $is_admin   = request('access_token.is_admin', 0); //是否管理员操作 0=是1=否
         $table_name = $LowPriceGoodsModel->getTable();
         $notes_type = 1; //操作类型,1添加,2修改,3=删除
-        $this->addAdminHistory('清洗配置-低价商品管理', $admin_id, $table_name, $notes_type, [], $all_data, '新增了低价商品' . $all_data['product_name'] . '信息');
+        $this->addAdminHistory('清洗配置-低价商品管理', $admin_id, $is_admin, $table_name, $notes_type, [], $all_data, '新增了低价商品' . $all_data['product_name'] . '信息');
         // 告知结果
         return json_send(['code' => 'success', 'msg' => '新增成功']);
     }
@@ -204,9 +205,10 @@ class LowPriceGoods extends Controller
         if (!$result)     return json_send(['code' => 'error', 'msg' => '修改失败']);
         // 记录行为
         $admin_id   = request('access_token.uid', 0); //用户ID
+        $is_admin   = request('access_token.is_admin', 0); //是否管理员操作 0=是1=否
         $table_name = $LowPriceGoodsModel->getTable();
         $notes_type = 2; //操作类型,1添加,2修改,3=删除
-        $this->addAdminHistory('清洗配置-低价商品管理', $admin_id, $table_name, $notes_type,$oldData, $all_data, '修改了低价商品' . $oldData['product_name'] . '信息');
+        $this->addAdminHistory('清洗配置-低价商品管理', $admin_id, $is_admin, $table_name, $notes_type,$oldData, $all_data, '修改了低价商品' . $oldData['product_name'] . '信息');
         // 告知结果
         return json_send(['code' => 'success', 'msg' => '修改成功']);
     }
@@ -247,9 +249,10 @@ class LowPriceGoods extends Controller
         if (!$result)    return json_send(['code' => 'error', 'msg' => '设置失败']);
         // 记录行为
         $admin_id   = request('access_token.uid', 0); //用户ID
+        $is_admin   = request('access_token.is_admin', 0); //是否管理员操作 0=是1=否
         $table_name = $LowPriceGoodsModel->getTable();
         $notes_type = 2; //操作类型,1添加,2修改,3=删除
-        $this->addAdminHistory('清洗配置-低价商品管理', $admin_id, $table_name, $notes_type, [], ['status' => $status], '修改了低价商品' . $LowProduct->product_name . '状态');
+        $this->addAdminHistory('清洗配置-低价商品管理', $admin_id, $is_admin, $table_name, $notes_type, [], ['status' => $status], '修改了低价商品' . $LowProduct->product_name . '状态');
         // 告知结果
         return             json_send(['code' => 'success', 'msg' => '设置成功']);
     }
@@ -285,9 +288,10 @@ class LowPriceGoods extends Controller
             $LowProduct->delete();
             // 记录行为
             $admin_id   = request('access_token.uid', 0); //用户ID
+            $is_admin   = request('access_token.is_admin', 0); //是否管理员操作 0=是1=否
             $table_name = $LowPriceGoodsModel->getTable();
             $notes_type = 3; //操作类型,1添加,2修改,3=删除
-            $this->addAdminHistory('清洗配置-低价商品管理', $admin_id, $table_name, $notes_type, $LowProduct->toarray(), [], '删除了低价商品' . $LowProduct->product_name . '状态');
+            $this->addAdminHistory('清洗配置-低价商品管理', $admin_id, $is_admin, $table_name, $notes_type, $LowProduct->toarray(), [], '删除了低价商品' . $LowProduct->product_name . '状态');
             DB::commit();
             // 告知结果
             return             json_send(['code' => 'success', 'msg' => '删除成功']);

+ 8 - 4
app/Http/Controllers/Manager/WashConfig/ProductCategory.php

@@ -122,9 +122,10 @@ class ProductCategory extends Controller
         if (!$result)     return json_send(['code' => 'error', 'msg' => '新增失败']);
         // 记录行为
         $admin_id   = request('access_token.uid', 0); //用户ID
+        $is_admin   = request('access_token.is_admin', 0); //是否管理员操作 0=是1=否
         $table_name = $ProductCategoryModel->getTable();
         $notes_type = 1; //操作类型,1添加,2修改,3=删除
-        $this->addAdminHistory('清洗配置-商品分类管理', $admin_id, $table_name,$notes_type, [], $all_data, '新增了商品分类' . $all_data['name'] . '信息');
+        $this->addAdminHistory('清洗配置-商品分类管理', $admin_id, $is_admin, $table_name,$notes_type, [], $all_data, '新增了商品分类' . $all_data['name'] . '信息');
         // 告知结果
         return json_send(['code' => 'success', 'msg' => '新增成功']);
     }
@@ -159,9 +160,10 @@ class ProductCategory extends Controller
         if (!$result)     return json_send(['code' => 'error', 'msg' => '修改失败']);
         // 记录行为
         $admin_id   = request('access_token.uid', 0); //用户ID
+        $is_admin   = request('access_token.is_admin', 0); //是否管理员操作 0=是1=否
         $table_name = $ProductCategoryModel->getTable();
         $notes_type = 2; //操作类型,1添加,2修改,3=删除
-        $this->addAdminHistory('清洗配置-商品分类管理', $admin_id, $table_name, $notes_type,$oldData, $all_data, '修改了商品分类' .$oldData['name'] . '信息');
+        $this->addAdminHistory('清洗配置-商品分类管理', $admin_id, $is_admin, $table_name, $notes_type,$oldData, $all_data, '修改了商品分类' .$oldData['name'] . '信息');
         // 告知结果
         return json_send(['code' => 'success', 'msg' => '修改成功']);
     }
@@ -201,9 +203,10 @@ class ProductCategory extends Controller
         if (!$result)    return json_send(['code' => 'error', 'msg' => '设置失败']);
         // 记录行为
         $admin_id   = request('access_token.uid', 0); //用户ID
+        $is_admin   = request('access_token.is_admin', 0); //是否管理员操作 0=是1=否
         $table_name = $ProductCategoryModel->getTable();
         $notes_type = 2; //操作类型,1添加,2修改,3=删除
-        $this->addAdminHistory('清洗配置-商品分类管理', $admin_id, $table_name, $notes_type, [], ['status' => $status], '修改了商品分类' . $ProductCategory->name . '状态');
+        $this->addAdminHistory('清洗配置-商品分类管理', $admin_id, $is_admin, $table_name, $notes_type, [], ['status' => $status], '修改了商品分类' . $ProductCategory->name . '状态');
         // 告知结果
         return             json_send(['code' => 'success', 'msg' => '设置成功']);
     }
@@ -242,9 +245,10 @@ class ProductCategory extends Controller
         if (!$result)    return json_send(['code' => 'error', 'msg' => '删除失败']);
         // 记录行为
         $admin_id   = request('access_token.uid', 0); //用户ID
+        $is_admin   = request('access_token.is_admin', 0); //是否管理员操作 0=是1=否
         $table_name = $ProductCategoryModel->getTable();
         $notes_type = 3; //操作类型,1添加,2修改,3=删除
-        $this->addAdminHistory('清洗配置-商品分类管理', $admin_id, $table_name, $notes_type, $ProductCategory->toarray(), [], '删除了商品分类' . $ProductCategory->name . '信息');
+        $this->addAdminHistory('清洗配置-商品分类管理', $admin_id, $is_admin, $table_name, $notes_type, $ProductCategory->toarray(), [], '删除了商品分类' . $ProductCategory->name . '信息');
         // 告知结果
         return             json_send(['code' => 'success', 'msg' => '删除成功']);
     }

+ 8 - 4
app/Http/Controllers/Manager/WashConfig/ViolationProduct.php

@@ -161,9 +161,10 @@ class ViolationProduct extends Controller
         if (!$result)     return json_send(['code' => 'error', 'msg' => '新增失败']);
         // 记录行为
         $admin_id   = request('access_token.uid', 0); //用户ID
+        $is_admin   = request('access_token.is_admin', 0); //是否管理员操作 0=是1=否
         $table_name = $ViolationProductModel->getTable();
         $notes_type = 1; //操作类型,1添加,2修改,3=删除
-        $this->addAdminHistory('清洗配置-禁止商品管理', $admin_id, $table_name, $notes_type, [], $all_data, '新增了禁止商品' . $all_data['product_name'] . '信息');
+        $this->addAdminHistory('清洗配置-禁止商品管理', $admin_id, $is_admin, $table_name, $notes_type, [], $all_data, '新增了禁止商品' . $all_data['product_name'] . '信息');
         // 告知结果
         return json_send(['code' => 'success', 'msg' => '新增成功']);
     }
@@ -204,9 +205,10 @@ class ViolationProduct extends Controller
         if (!$result)     return json_send(['code' => 'error', 'msg' => '修改失败']);
         // 记录行为
         $admin_id   = request('access_token.uid', 0); //用户ID
+        $is_admin   = request('access_token.is_admin', 0); //是否管理员操作 0=是1=否
         $table_name = $ViolationProductModel->getTable();
         $notes_type = 2; //操作类型,1添加,2修改,3=删除
-        $this->addAdminHistory('清洗配置-禁止商品管理', $admin_id, $table_name, $notes_type,$oldData, $all_data, '修改了禁止商品' . $oldData['product_name'] . '信息');
+        $this->addAdminHistory('清洗配置-禁止商品管理', $admin_id, $is_admin, $table_name, $notes_type,$oldData, $all_data, '修改了禁止商品' . $oldData['product_name'] . '信息');
         // 告知结果
         return json_send(['code' => 'success', 'msg' => '修改成功']);
     }
@@ -247,9 +249,10 @@ class ViolationProduct extends Controller
         if (!$result)    return json_send(['code' => 'error', 'msg' => '设置失败']);
         // 记录行为
         $admin_id   = request('access_token.uid', 0); //用户ID
+        $is_admin   = request('access_token.is_admin', 0); //是否管理员操作 0=是1=否
         $table_name = $ViolationProductModel->getTable();
         $notes_type = 2; //操作类型,1添加,2修改,3=删除
-        $this->addAdminHistory('清洗配置-禁止商品管理', $admin_id, $table_name, $notes_type,[],['status'=> $status], '修改了禁止商品' . $ViolationProduct->product_name . '状态');
+        $this->addAdminHistory('清洗配置-禁止商品管理', $admin_id, $is_admin, $table_name, $notes_type,[],['status'=> $status], '修改了禁止商品' . $ViolationProduct->product_name . '状态');
         // 告知结果
         return             json_send(['code' => 'success', 'msg' => '设置成功']);
     }
@@ -285,9 +288,10 @@ class ViolationProduct extends Controller
             $ViolationProduct->delete();
             // 记录行为
             $admin_id   = request('access_token.uid', 0); //用户ID
+            $is_admin   = request('access_token.is_admin', 0); //是否管理员操作 0=是1=否
             $table_name = $ViolationProductModel->getTable();
             $notes_type = 3; //操作类型,1添加,2修改,3=删除
-            $this->addAdminHistory('清洗配置-禁止商品管理', $admin_id, $table_name, $notes_type, $ViolationProduct->toarray(), [], '删除了禁止商品' . $ViolationProduct->product_name . '信息');
+            $this->addAdminHistory('清洗配置-禁止商品管理', $admin_id, $is_admin, $is_admin, $table_name, $notes_type, $ViolationProduct->toarray(), [], '删除了禁止商品' . $ViolationProduct->product_name . '信息');
             // 告知结果
             DB::commit();
             return             json_send(['code' => 'success', 'msg' => '删除成功']);

+ 8 - 4
app/Http/Controllers/Manager/WashConfig/ViolationStore.php

@@ -174,9 +174,10 @@ class ViolationStore extends Controller
         if (!$result)     return json_send(['code' => 'error', 'msg' => '新增失败']);
         // 记录行为
         $admin_id   = request('access_token.uid', 0); //用户ID
+        $is_admin   = request('access_token.is_admin', 0); //是否管理员操作 0=是1=否
         $table_name = $ViolationStoreModel->getTable();
         $notes_type = 1; //操作类型,1添加,2修改,3=删除
-        $this->addAdminHistory('清洗配置-公司管理', $admin_id, $table_name, $notes_type, [], $all_data, '新增了公司' . $all_data['company_name'] . '信息');
+        $this->addAdminHistory('清洗配置-公司管理', $admin_id, $is_admin, $table_name, $notes_type, [], $all_data, '新增了公司' . $all_data['company_name'] . '信息');
         // 告知结果
         return json_send(['code' => 'success', 'msg' => '新增成功']);
     }
@@ -221,9 +222,10 @@ class ViolationStore extends Controller
         if (!$result)     return json_send(['code' => 'error', 'msg' => '修改失败']);
         // 记录行为
         $admin_id   = request('access_token.uid', 0); //用户ID
+        $is_admin   = request('access_token.is_admin', 0); //是否管理员操作 0=是1=否
         $table_name = $ViolationStoreModel->getTable();
         $notes_type = 2; //操作类型,1添加,2修改,3=删除
-        $this->addAdminHistory('清洗配置-公司管理', $admin_id, $table_name, $notes_type, $oldData, $all_data, '修改了公司' . $oldData['company_name'] . '信息');
+        $this->addAdminHistory('清洗配置-公司管理', $admin_id, $is_admin, $table_name, $notes_type, $oldData, $all_data, '修改了公司' . $oldData['company_name'] . '信息');
         // 告知结果
         return json_send(['code' => 'success', 'msg' => '修改成功']);
     }
@@ -252,9 +254,10 @@ class ViolationStore extends Controller
         if (!$result)    return json_send(['code' => 'error', 'msg' => '设置失败']);
         // 记录行为
         $admin_id   = request('access_token.uid', 0); //用户ID
+        $is_admin   = request('access_token.is_admin', 0); //是否管理员操作 0=是1=否
         $table_name = $ViolationStoreModel->getTable();
         $notes_type = 2; //操作类型,1添加,2修改,3=删除
-        $this->addAdminHistory('清洗配置-公司管理', $admin_id, $table_name, $notes_type, [], ['status' => $status], '修改了公司' . $ViolationStore->company_name . '状态');
+        $this->addAdminHistory('清洗配置-公司管理', $admin_id, $is_admin, $table_name, $notes_type, [], ['status' => $status], '修改了公司' . $ViolationStore->company_name . '状态');
         // 告知结果
         return             json_send(['code' => 'success', 'msg' => '设置成功']);
     }
@@ -292,9 +295,10 @@ class ViolationStore extends Controller
         if (!$result)    return json_send(['code' => 'error', 'msg' => '删除失败']);
         // 记录行为
         $admin_id   = request('access_token.uid', 0); //用户ID
+        $is_admin   = request('access_token.is_admin', 0); //是否管理员操作 0=是1=否
         $table_name = $ViolationStoreModel->getTable();
         $notes_type = 3; //操作类型,1添加,2修改,3=删除
-        $this->addAdminHistory('清洗配置-公司管理', $admin_id, $table_name, $notes_type, $ViolationStore->toarray(), [], '删除了公司' . $ViolationStore->company_name . '信息');
+        $this->addAdminHistory('清洗配置-公司管理', $admin_id, $is_admin, $table_name, $notes_type, $ViolationStore->toarray(), [], '删除了公司' . $ViolationStore->company_name . '信息');
         // 告知结果
         return             json_send(['code' => 'success', 'msg' => '删除成功']);
     }

+ 1 - 1
app/Http/Middleware/Manager/Expire.php

@@ -6,7 +6,7 @@ use Closure;
 use Illuminate\Http\Request;
 
 /**
- * 商户账户过期验证
+ * 账户过期验证
  *
  */
 class Expire

+ 2 - 7
app/Http/Middleware/Manager/Login.php

@@ -55,14 +55,9 @@ class Login
             $userInfo                       = AccessToken::decode($token);
             // 判断登录时效
             if (isset($userInfo['error']))  return json_send(['code' => 'no_login', 'msg' => '请您登录', 'data' => $userInfo['error']]);
-            if ($userInfo['type'] != 'manager') return json_send(['code' => 'no_login', 'msg' => '请您登录', 'data' => '登录失效']);
-            if ($userInfo['expire'] < time()) return json_send(['code' => 'no_login', 'msg' => '登录失效,请您重新登录', 'data' => '登录失效']);
-            // 获取就得令牌
-            // $oldToken                       = (new AdminUser())->getLogin($userInfo['uid'],'manager');
-            // 比对令牌
-            // if( $oldToken != md5($token) )  return json_send(['code'=>'no_login','msg'=>'登录失效,请重新登录']);
+            if ($userInfo['type'] != 'manager' || $userInfo['expire'] < time()) return json_send(['code' => 'no_login', 'msg' => '请您登录', 'data' => '登录失效']);
             // 是否是超管
-            $userInfo['is_super']            = is_super($userInfo['uid'], 'manager') ? 1 : 0;
+            $userInfo['is_super']            = is_super($userInfo['uid'],$userInfo['is_admin'], 'manager') ? 1 : 0;
             // 追加入
             $request['access_token']         = $userInfo;
         }

+ 3 - 1
app/Models/Manager/AdminHistory.php

@@ -31,7 +31,7 @@ class AdminHistory extends Model
      * @param   String       $general_description    操作描述
      * 
      */
-    public function addAll($admin_menu_name, $uid, $table,$type, $oldData, $newData, $general_description = '')
+    public function addAll($admin_menu_name, $uid, $is_admin, $table, $type, $oldData, $newData, $general_description = '')
     {
         $insert_data =  [
             // 模块菜单名称
@@ -44,6 +44,8 @@ class AdminHistory extends Model
             'table_name'    => $table,
             // 操作用户
             'admin_uid'     => $uid,
+            // 是否是管理员
+            'is_admin'      => $is_admin,
             // 操作之前
             'before_value'  => json_encode($oldData),
             // 操作之后

+ 1 - 1
app/Models/Manager/AdminUser.php

@@ -110,7 +110,7 @@ class AdminUser extends Model
      */
     public function Login($uid,$module='manager'){
         // 组合数据
-		$jwtData							= ['uid'=>$uid,'type'=>$module,'expire'=>time()+3600*8];
+		$jwtData							= ['uid'=>$uid, 'is_admin' => '0','type'=>$module,'expire'=>time()+3600*8];
 		// 登录成功
 		$token              				= AccessToken::encode($jwtData);
         // 如果异常的话

+ 99 - 1
app/Models/Manager/Personnel/Employee.php

@@ -7,6 +7,7 @@ use Illuminate\Database\Eloquent\Model;
 use Illuminate\Support\Facades\DB;
 use App\Models\Manager\Personnel\EmployeeArea as EmployeeAreaModel;
 use App\Models\Manager\Personnel\EmployeeDepartment as EmployeeDepartmentModel;
+use App\Facades\Servers\Encrypts\AccessToken;
 
 /**
  * 员工模型
@@ -226,7 +227,8 @@ class Employee extends Model
             // 成功处理...
         } catch (\Exception $e) {
             DB::rollBack();
-            print_r($e->getMessage());exit;
+            print_r($e->getMessage());
+            exit;
             // 错误处理...
             return false;
         }
@@ -270,4 +272,100 @@ class Employee extends Model
         $Employee->delete();
         return true;
     }
+
+    /**
+     * 添加数据
+     * 
+     */
+    public function edit($id,$data)
+    {
+        // 更新时间
+        $data['update_time']                = time();
+        // 写入数据表
+        $result						        = $this->query()->where(['id'=>$id])->update($data);
+        // 如果操作失败
+        if( !$result )                      return 0;
+        // 更新缓存
+        $this->getList(true);
+        // 返回结果
+        return                              $id;
+    }
+
+    /**
+     * 获取列表
+     * @param   Bool    $force  是否强制更新
+     * 
+     */
+    public function getList($force = false)
+    {
+        // 结果数据
+        $list                  = $force ? [] : cache('manager:admin:employee:list');
+        // 不存在数据
+        if ( !$list ) {
+            // 从数据库获取数据
+            $data              = $this->query()->get(['id','name','mobile','status','password','status','insert_time','update_time'])->toArray();
+            // 循环处理数据
+            $list              = [];
+            // 进行更新
+            foreach ($data as $value) {
+                // 重组数据
+                $list[$value['id']] = $value;
+            }
+            // 存起来
+            cache(['manager:admin:employee:list'=>$list]);
+        }
+        // 返回结果
+        return                  $list;
+    }
+
+    /**
+     * 获取配置平台对应的应用数据
+     * 
+     * @param   int      用户ID
+     * @param   string     指定字段
+     * 
+     */
+    public function getOne($id,$field='')
+    {
+        // 获取列表数据
+        $list                   = $this->getList();
+        // 获取数据
+        $one                    = isset($list[$id]) ? $list[$id] : [];
+        // 返回值
+        return                  empty($field) ? $one : ( isset($one[$field]) ? $one[$field] : null);
+    }
+
+    /**
+     * 登录
+     * 
+     * @param   int      用户ID
+     * 
+     */
+    public function Login($uid, $module = 'manager')
+    {
+        // 组合数据
+        $jwtData                            = ['uid' => $uid, 'is_admin' => '1', 'type' => $module, 'expire' => time() + 3600 * 8];
+        // 登录成功
+        $token                              = AccessToken::encode($jwtData);
+        // 如果异常的话
+        if (isset($token['error']))        return $token;
+        // 登录成功
+        cache([$module . ':employee:access_token:' . $uid => md5($token)], 3600 * 8);
+        // 返回结果
+        return                              ['access_token_' . $module => $token, 'expire' => 3600 * 8];
+    }
+
+    /**
+     * 退出登录
+     * 
+     * @param   int      用户ID
+     * 
+     */
+    public function LoginOut($uid, $module = 'manager')
+    {
+        // 删除缓存
+        cache([$module . ':employee:access_token:' . $uid => null]);
+        // 返回结果
+        return                              true;
+    }
 }