Implement creator studio and upload updates

This commit is contained in:
2026-04-04 10:12:02 +02:00
parent 1da7d3bf88
commit 0b216b7ecd
15107 changed files with 31206 additions and 626514 deletions

View File

@@ -0,0 +1,47 @@
<?php
namespace App\Services\Moderation;
use App\Data\Moderation\ModerationResultData;
class ModerationPriorityService
{
/**
* @param array<string, mixed> $context
* @param array<string, mixed> $policy
* @param array<string, mixed> $suggestion
*/
public function score(ModerationResultData $result, array $context = [], array $policy = [], array $suggestion = []): array
{
$score = $result->score;
$score += $result->isSuspicious() ? 10 : 0;
$score += $result->autoHideRecommended ? 25 : 0;
$score += max(0, (int) ($result->userRiskScore ?? 0) / 2);
$score += (int) ($policy['priority_bonus'] ?? 0);
$score += max(0, (int) (($suggestion['confidence'] ?? 0) / 5));
$score += ! empty($context['is_publicly_exposed']) ? 12 : 0;
$score += ! empty($result->matchedDomains) ? 10 : 0;
$score += isset($result->ruleHits['blocked_domain']) ? 18 : 0;
$score += isset($result->ruleHits['near_duplicate_campaign']) ? 14 : 0;
$bucket = match (true) {
$score >= 140 => 'urgent',
$score >= 95 => 'high',
$score >= 50 => 'priority',
default => 'standard',
};
$escalation = match ($bucket) {
'urgent' => 'urgent',
'high' => 'escalated',
'priority' => 'review_required',
default => 'none',
};
return [
'priority_score' => $score,
'review_bucket' => $bucket,
'escalation_status' => $escalation,
];
}
}