爬虫开发
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

48
app/Models/CrawlAlert.php Normal file
View File

@@ -0,0 +1,48 @@
<?php
declare(strict_types=1);
namespace App\Models;
use App\Enums\CrawlAlertSeverity;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class CrawlAlert extends Model
{
use HasFactory;
protected $fillable = [
'run_id',
'rule_id',
'severity',
'type',
'message',
'context',
'is_resolved',
'resolved_by',
'resolved_at',
];
protected function casts(): array
{
return [
'severity' => CrawlAlertSeverity::class,
'context' => 'array',
'is_resolved' => 'boolean',
'resolved_at' => 'datetime',
];
}
public function run(): BelongsTo
{
return $this->belongsTo(CrawlRun::class, 'run_id');
}
public function rule(): BelongsTo
{
return $this->belongsTo(CrawlRule::class, 'rule_id');
}
}