Files
chatroom/resources/views/admin/ops/index.blade.php
lkddi 783afe0677 重构:运维工具迁移为独立页面,侧边栏新增「运维工具」菜单
- 新建 OpsController,承接四项运维操作
- 新建 admin/ops/index.blade.php 独立页面(卡片式布局)
- admin 路由改为 /admin/ops/* -> admin.ops.*
- 侧边栏「AI 厂商配置」下方新增「🛠️ 运维工具」菜单入口
- SystemController 移除运维方法,职责回归纯参数配置
- system/edit 移除内嵌运维块,页面保持简洁
2026-03-03 15:07:36 +08:00

118 lines
6.1 KiB
PHP

@extends('admin.layouts.app')
@section('title', '运维工具')
@section('content')
<div class="bg-white rounded-xl shadow-sm border border-gray-100 overflow-hidden">
<div class="p-6 border-b border-gray-100 bg-gray-50">
<h2 class="text-lg font-bold text-gray-800">🛠️ 运维工具</h2>
<p class="text-xs text-gray-500 mt-1">仅站长可见。每项操作不可撤销,请确认后执行。</p>
</div>
{{-- 操作结果提示 --}}
@if (session('ops_success'))
<div class="mx-6 mt-5 p-4 bg-blue-50 border border-blue-200 rounded-lg text-blue-700 text-sm font-medium">
{{ session('ops_success') }}
</div>
@endif
<div class="p-6">
<div class="grid grid-cols-1 md:grid-cols-2 gap-5">
{{-- 应用缓存清理 --}}
<div class="border border-gray-200 rounded-xl p-5 hover:shadow-sm transition">
<div class="flex items-center gap-3 mb-2">
<span class="text-2xl">🗑️</span>
<div>
<div class="font-bold text-gray-800 text-sm">应用缓存清理</div>
<div class="text-xs text-gray-400">config:clear + cache:clear</div>
</div>
</div>
<p class="text-xs text-gray-500 mb-4 leading-relaxed">
清除 Laravel 配置和应用缓存。<br>
修改 <code class="bg-gray-100 px-1 rounded">.env</code> 后、部署新版本后建议执行。
</p>
<form action="{{ route('admin.ops.clear-cache') }}" method="POST"
onsubmit="return confirm('确定清理应用缓存?')">
@csrf
<button type="submit"
class="px-4 py-2 bg-amber-500 text-white rounded-lg text-sm font-bold hover:bg-amber-600 transition shadow-sm">
立即执行
</button>
</form>
</div>
{{-- 路由缓存清理 --}}
<div class="border border-gray-200 rounded-xl p-5 hover:shadow-sm transition">
<div class="flex items-center gap-3 mb-2">
<span class="text-2xl">🗺️</span>
<div>
<div class="font-bold text-gray-800 text-sm">路由缓存清理</div>
<div class="text-xs text-gray-400">route:clear</div>
</div>
</div>
<p class="text-xs text-gray-500 mb-4 leading-relaxed">
清除路由缓存文件。<br>
部署后出现 404 路由错误时执行。
</p>
<form action="{{ route('admin.ops.clear-routes') }}" method="POST"
onsubmit="return confirm('确定清理路由缓存?')">
@csrf
<button type="submit"
class="px-4 py-2 bg-amber-500 text-white rounded-lg text-sm font-bold hover:bg-amber-600 transition shadow-sm">
立即执行
</button>
</form>
</div>
{{-- 视图缓存清理 --}}
<div class="border border-gray-200 rounded-xl p-5 hover:shadow-sm transition">
<div class="flex items-center gap-3 mb-2">
<span class="text-2xl">🖼️</span>
<div>
<div class="font-bold text-gray-800 text-sm">视图缓存清理</div>
<div class="text-xs text-gray-400">view:clear</div>
</div>
</div>
<p class="text-xs text-gray-500 mb-4 leading-relaxed">
清除已编译的 Blade 视图缓存。<br>
页面样式或内容更新后未生效时执行。
</p>
<form action="{{ route('admin.ops.clear-views') }}" method="POST"
onsubmit="return confirm('确定清理视图缓存?')">
@csrf
<button type="submit"
class="px-4 py-2 bg-amber-500 text-white rounded-lg text-sm font-bold hover:bg-amber-600 transition shadow-sm">
立即执行
</button>
</form>
</div>
{{-- 房间在线名单清理 --}}
<div class="border border-red-100 rounded-xl p-5 bg-red-50 hover:shadow-sm transition">
<div class="flex items-center gap-3 mb-2">
<span class="text-2xl">👻</span>
<div>
<div class="font-bold text-red-700 text-sm">清理幽灵在线名单</div>
<div class="text-xs text-red-400">Redis room:*:users</div>
</div>
</div>
<p class="text-xs text-red-500 mb-4 leading-relaxed">
清空所有房间的 Redis 在线记录,解决在线人数虚高问题。<br>
<strong>执行后在线用户需重新进房才能出现在名单中。</strong>
</p>
<form action="{{ route('admin.ops.clear-room-online') }}" method="POST"
onsubmit="return confirm('确定清理所有房间在线名单?\n在线用户需重进房间才能重新出现在名单!')">
@csrf
<button type="submit"
class="px-4 py-2 bg-red-500 text-white rounded-lg text-sm font-bold hover:bg-red-600 transition shadow-sm">
立即执行
</button>
</form>
</div>
</div>
</div>
</div>
@endsection