爬虫开发
Some checks failed
Tests / PHP 8.2 (push) Has been cancelled
Tests / PHP 8.3 (push) Has been cancelled
Tests / PHP 8.4 (push) Has been cancelled

This commit is contained in:
cjd
2026-02-18 12:56:36 +08:00
parent a98bc6f13c
commit 260460df03
45 changed files with 4091 additions and 8 deletions

View File

@@ -0,0 +1,74 @@
@extends('layouts.admin')
@section('title', '采集规则')
@section('head')
@include('admin.partials.modern-index-head')
@endsection
@section('page_actions')
<a class="btn btn-success" href="{{ route('admin.crawlers.create') }}"><i class="bi bi-plus-circle me-1"></i>新建规则</a>
@endsection
@section('content')
<div class="card modern-index-toolbar mb-3">
<div class="card-body d-flex flex-column flex-lg-row gap-3 align-items-lg-center justify-content-between">
<form method="get" action="{{ route('admin.crawlers.index') }}" class="d-flex flex-column flex-md-row gap-2 w-100">
<input class="form-control" type="text" name="q" value="{{ $filters['q'] ?? '' }}" placeholder="搜索规则名称">
<button class="btn btn-primary" type="submit"><i class="bi bi-search me-1"></i>搜索</button>
</form>
</div>
<div class="card-footer bg-transparent border-0 pt-0">
<div class="toolbar-meta"> {{ number_format($items->total()) }} 条规则</div>
</div>
</div>
<div class="card modern-index-card">
<div class="table-responsive">
<table class="table table-vcenter card-table modern-index-table">
<thead>
<tr>
<th>规则</th>
<th>目标模块</th>
<th>Cron</th>
<th>状态</th>
<th>最近运行</th>
<th class="text-end">操作</th>
</tr>
</thead>
<tbody>
@forelse($items as $item)
<tr>
<td>
<div class="modern-index-title">{{ $item->name }}</div>
<div class="modern-index-summary">运行次数:{{ $item->runs_count }} / 下次:{{ $item->next_run_at?->format('Y-m-d H:i') ?? '-' }}</div>
</td>
<td>{{ $item->target_module?->label() ?? '-' }}</td>
<td><code>{{ $item->cron_expression }}</code></td>
<td>
@if($item->enabled)
<span class="badge bg-green-lt text-green-fg">启用</span>
@else
<span class="badge bg-gray-200 text-dark">停用</span>
@endif
</td>
<td>{{ $item->last_run_at?->format('Y-m-d H:i') ?? '-' }}</td>
<td class="text-end d-flex justify-content-end gap-2">
<form method="post" action="{{ route('admin.crawlers.run', $item) }}">
@csrf
<button class="btn btn-sm btn-outline-success" type="submit">立即执行</button>
</form>
<a class="btn btn-sm btn-outline-primary" href="{{ route('admin.crawlers.edit', $item) }}">编辑</a>
</td>
</tr>
@empty
<tr>
<td colspan="6" class="text-center text-muted py-5">暂无采集规则</td>
</tr>
@endforelse
</tbody>
</table>
</div>
<div class="card-footer">{{ $items->links() }}</div>
</div>
@endsection