feat: post cover filter + admin AI cover action, restyle page-cache admin
Build and Deploy / verify (push) Successful in 10s
Build and Deploy / deploy (push) Successful in 17s

- 抽 CoverGenerator 服务(covers:generate 与后台共用),内部强制同步产出 card 转换
- 文章列表:新增封面状态图标列、「有/无封面/完全无图」筛选、行内「生成封面」AI 操作
- 页面缓存:统计改为原生 StatsOverviewWidget(缓存页数/总大小/命中率/时长),
  缓存明细表重排(表头、悬停、URL 截断、图标删除按钮、空状态)
This commit is contained in:
2026-10-14 23:48:57 +00:00
parent 58ebaf7f90
commit d041622531
6 changed files with 254 additions and 148 deletions
@@ -1,72 +1,61 @@
<x-filament-panels::page>
<div class="grid gap-4 md:grid-cols-4">
<x-filament::section>
<div class="text-sm text-gray-500 dark:text-gray-400">当前缓存页</div>
<div class="mt-1 text-2xl font-semibold">{{ $this->stats['count'] }} 条</div>
</x-filament::section>
<x-filament::section>
<div class="text-sm text-gray-500 dark:text-gray-400">命中率</div>
<div class="mt-1 text-2xl font-semibold">{{ $this->stats['rate'] }}%</div>
</x-filament::section>
<x-filament::section>
<div class="text-sm text-gray-500 dark:text-gray-400">命中 / 未命中</div>
<div class="mt-1 text-2xl font-semibold">{{ $this->stats['hits'] }} / {{ $this->stats['misses'] }}</div>
</x-filament::section>
<x-filament::section>
<div class="text-sm text-gray-500 dark:text-gray-400">过期时间</div>
<div class="mt-1 text-2xl font-semibold">{{ $this->stats['ttl'] }} 秒</div>
</x-filament::section>
</div>
<x-filament::section heading="已缓存的前台页面" class="mt-6">
<p class="mb-4 text-sm text-gray-500 dark:text-gray-400">
只缓存未登录访客打开的页面。登录后看前台不会进缓存,所以这里可能暂时是空的。
</p>
<x-filament::section>
<x-slot name="heading">已缓存的前台页面</x-slot>
<x-slot name="description">只缓存未登录访客打开的页面;登录后访问前台不会进缓存,所以这里可能暂时是空的。</x-slot>
@if(count($this->entries) === 0)
<p class="text-sm text-gray-500 dark:text-gray-400">当前没有前台页面缓存。</p>
@else
<div class="overflow-x-auto">
<table class="w-full text-sm">
<thead>
<tr class="border-b border-gray-200 text-left dark:border-white/10">
<th class="py-2 pr-4 font-medium">地址</th>
<th class="py-2 pr-4 font-medium">大小</th>
<th class="py-2 pr-4 font-medium">缓存时间</th>
<th class="py-2 pr-4 font-medium">过期时间</th>
<th class="py-2 font-medium">操作</th>
</tr>
</thead>
<tbody>
@foreach($this->entries as $entry)
<tr class="border-b border-gray-100 dark:border-white/5" wire:key="cache-{{ $entry['key'] }}">
<td class="py-2 pr-4">
<a href="{{ $entry['url'] }}" target="_blank" rel="noopener noreferrer" class="text-primary-600 hover:underline">
{{ $entry['url'] }}
</a>
</td>
<td class="py-2 pr-4 whitespace-nowrap">{{ $entry['size'] ? number_format($entry['size'] / 1024, 1).' KB' : '—' }}</td>
<td class="py-2 pr-4 whitespace-nowrap">{{ $entry['cached_at'] ?: '—' }}</td>
<td class="py-2 pr-4 whitespace-nowrap">{{ $entry['expires_at'] ?: '—' }}</td>
<td class="py-2">
<x-filament::button
size="xs"
color="danger"
wire:click="forgetEntry('{{ $entry['key'] }}')"
wire:confirm="删除这条缓存?"
>
删除
</x-filament::button>
</td>
</tr>
@endforeach
</tbody>
</table>
<p class="mt-3 text-xs text-gray-500 dark:text-gray-400">
共 {{ count($this->entries) }} 条,合计 {{ number_format(collect($this->entries)->sum('size') / 1024 / 1024, 2) }} MB。
缓存说明:只缓存未登录访客 GET 的 200 页面;登录用户、评论提交等动态请求不缓存;浏览量统计不受影响。
</p>
<div class="flex flex-col items-center gap-3 py-10 text-gray-400 dark:text-gray-500">
<x-filament::icon icon="heroicon-o-inbox" class="h-10 w-10" />
<p class="text-sm">当前没有前台页面缓存</p>
</div>
@else
<div class="overflow-hidden rounded-xl ring-1 ring-gray-950/5 dark:ring-white/10">
<div class="overflow-x-auto">
<table class="w-full divide-y divide-gray-200 text-sm dark:divide-white/5">
<thead class="bg-gray-50 dark:bg-white/5">
<tr>
<th class="px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-400">地址</th>
<th class="px-4 py-3 text-right text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-400">大小</th>
<th class="px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-400">缓存时间</th>
<th class="px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-400">过期时间</th>
<th class="px-4 py-3 text-right text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-400">操作</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-100 bg-white dark:divide-white/5 dark:bg-transparent">
@foreach($this->entries as $entry)
<tr class="transition hover:bg-gray-50 dark:hover:bg-white/5" wire:key="cache-{{ $entry['key'] }}">
<td class="max-w-0 px-4 py-3">
<a href="{{ $entry['url'] }}" target="_blank" rel="noopener noreferrer"
title="{{ $entry['url'] }}"
class="block w-64 truncate text-primary-600 hover:underline sm:w-80 lg:w-[32rem] dark:text-primary-400">
{{ $entry['url'] }}
</a>
</td>
<td class="whitespace-nowrap px-4 py-3 text-right tabular-nums text-gray-600 dark:text-gray-300">
{{ $entry['size'] ? number_format($entry['size'] / 1024, 1).' KB' : '—' }}
</td>
<td class="whitespace-nowrap px-4 py-3 text-gray-600 dark:text-gray-300">{{ $entry['cached_at'] ?: '—' }}</td>
<td class="whitespace-nowrap px-4 py-3 text-gray-600 dark:text-gray-300">{{ $entry['expires_at'] ?: '—' }}</td>
<td class="whitespace-nowrap px-4 py-3 text-right">
<x-filament::icon-button
icon="heroicon-m-trash"
color="danger"
size="sm"
label="删除这条缓存"
wire:click="forgetEntry('{{ $entry['key'] }}')"
wire:confirm="删除这条缓存?"
/>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
<p class="mt-4 text-xs text-gray-500 dark:text-gray-400">
共 {{ count($this->entries) }} 条 · 合计 {{ number_format(collect($this->entries)->sum('size') / 1024 / 1024, 2) }} MB
· 只缓存未登录访客 GET 的 200 页面,评论提交等动态请求不缓存,浏览量统计不受影响。
</p>
@endif
</x-filament::section>
</x-filament-panels::page>