소스 검색

[智价云] 管理员操作日志列表

tangyuanwang 8 시간 전
부모
커밋
c4cb6cf994
3개의 변경된 파일57개의 추가작업 그리고 0개의 파일을 삭제
  1. 54 0
      app/Http/Controllers/Manager/AdminHistory.php
  2. 1 0
      app/Http/Requests/Manager/AdminHistory.php
  3. 2 0
      routes/manager.php

+ 54 - 0
app/Http/Controllers/Manager/AdminHistory.php

@@ -70,4 +70,58 @@ class AdminHistory extends Controller
         // 加载模板
         return        json_send(['code' => 'success', 'msg' => '获取成功', 'data' => $result]);
     }
+
+    /**
+     * 管理员操作日志列表
+     * @author    唐远望
+     * @version   1.0
+     * @date      2026-04-20
+     * 
+     */
+    public function admin_history_list(Request $request, AdminHistoryModel $AdminHistoryModel, AdminUserModel $AdminUserModel, EmployeeModel $EmployeeModel)
+    {
+        $request->scene('admin_history_list')->validate();
+        $company_id = request('access_token.company_id', '0');
+        $is_admin = request('access_token.is_admin', '0');//是否管理员操作 0=是1=否
+        // 查询条件
+        $map  = [];
+        $limit = request('limit', config('page_num', 10));
+        $start_time = request('start_time', '');
+        $end_time = request('end_time', '');
+        $module_menu_name = request('module_menu_name', '');
+        $general_description = request('general_description', '');
+        $notes_type = request('notes_type', '');
+        // 时间条件
+        if ($start_time) $map[] = ['insert_time', '>=', strtotime($start_time)];
+        if ($end_time) $map[]   = ['insert_time', '<=', strtotime($end_time)];
+        // 其他条件
+        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];
+        // 查询数据
+        if ($is_admin != 1){
+             return json_send(['code' => 'error', 'msg' => '无权限获取', 'data' => []]);
+        }else{
+            $map[] = ['company_id', '=', $company_id];
+        }
+        $result = $AdminHistoryModel
+            ->where($map)
+            ->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 == '1') {
+                    $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' => []]);
+        // 加载模板
+        return        json_send(['code' => 'success', 'msg' => '获取成功', 'data' => $result]);
+    }
 }

+ 1 - 0
app/Http/Requests/Manager/AdminHistory.php

@@ -47,6 +47,7 @@ class AdminHistory extends BaseRequest
         'edit'                  => ['id','name'],
         'set_status'              => ['id', 'status'],
         'delete'                  => ['id'],
+        'admin_history_list'        => ['page', 'limit'],
     ];
 
     /**

+ 2 - 0
routes/manager.php

@@ -304,6 +304,8 @@ Route::any('upload/uploadimg',[App\Http\Controllers\Manager\Upload::class,'uploa
 
 // 操作日志-列表
 Route::any('operation_log/list', [App\Http\Controllers\Manager\AdminHistory::class, 'list']);
+// 操作日志-管理员操作日志列表
+Route::any('operation_log/admin_history_list', [App\Http\Controllers\Manager\AdminHistory::class, 'admin_history_list']);
 
 //数据分析-禁止挂网链接数统计
 Route::any('statistics/overview_panel/get_violation_link_count', [App\Http\Controllers\Manager\Statistics\OverviewPanel::class, 'getViolationLinkCount']);