This commit is contained in:
Your Name
2026-04-19 20:50:02 +08:00
parent d469c4b93d
commit 53a1d7e4fd
12 changed files with 801 additions and 91 deletions

View File

@@ -6,12 +6,12 @@ namespace app\common\helper;
class DomainExternalSeoSnapshotRunIndexHelper
{
protected static function publicRelativePath(string $strPath): string
protected static function storageRelativePath(string $strPath): string
{
$strPublicRoot = str_replace('\\', '/', rtrim(dirname(__DIR__, 3) . '/public', '/'));
$strStorageRoot = str_replace('\\', '/', rtrim(dirname(__DIR__, 3) . '/storage', '/'));
$strPath = str_replace('\\', '/', $strPath);
if (str_starts_with($strPath, $strPublicRoot . '/')) {
return substr($strPath, strlen($strPublicRoot . '/'));
if (str_starts_with($strPath, $strStorageRoot . '/')) {
return substr($strPath, strlen($strStorageRoot . '/'));
}
return $strPath;
@@ -60,7 +60,7 @@ class DomainExternalSeoSnapshotRunIndexHelper
$arrItems[] = [
'run_id' => basename($strRunRoot),
'run_root_public' => self::publicRelativePath($strRunRoot),
'run_root_public' => self::storageRelativePath($strRunRoot),
'source' => (string)($arrSummary['source'] ?? ''),
'received_count' => $intReceivedCount,
'inserted_count' => (int)($arrSummary['inserted_count'] ?? 0),
@@ -82,9 +82,9 @@ class DomainExternalSeoSnapshotRunIndexHelper
'post_ingest_snapshot_trend' => (array)($arrSummary['post_ingest_snapshot_trend'] ?? []),
'post_ingest_health_label' => (string)(($arrSummary['post_ingest_overview']['health_label'] ?? '')),
'post_ingest_trend_label' => (string)(($arrSummary['post_ingest_snapshot_trend']['success_trend']['label'] ?? '')),
'summary_json_path' => self::publicRelativePath($strSummaryPath),
'summary_html_path' => self::publicRelativePath($strRunRoot . '/snapshot-ingest.summary.html'),
'payload_json_path' => self::publicRelativePath($strRunRoot . '/snapshots.payload.json'),
'summary_json_path' => self::storageRelativePath($strSummaryPath),
'summary_html_path' => self::storageRelativePath($strRunRoot . '/snapshot-ingest.summary.html'),
'payload_json_path' => self::storageRelativePath($strRunRoot . '/snapshots.payload.json'),
'updated_at' => date(DATE_ATOM, (int)(filemtime($strSummaryPath) ?: time())),
];
}

View File

@@ -6,12 +6,12 @@ namespace app\common\helper;
class DomainExternalSeoSnapshotValidateRunIndexHelper
{
protected static function publicRelativePath(string $strPath): string
protected static function storageRelativePath(string $strPath): string
{
$strPublicRoot = str_replace('\\', '/', rtrim(dirname(__DIR__, 3) . '/public', '/'));
$strStorageRoot = str_replace('\\', '/', rtrim(dirname(__DIR__, 3) . '/storage', '/'));
$strPath = str_replace('\\', '/', $strPath);
if (str_starts_with($strPath, $strPublicRoot . '/')) {
return substr($strPath, strlen($strPublicRoot . '/'));
if (str_starts_with($strPath, $strStorageRoot . '/')) {
return substr($strPath, strlen($strStorageRoot . '/'));
}
return $strPath;
@@ -50,7 +50,7 @@ class DomainExternalSeoSnapshotValidateRunIndexHelper
$arrItems[] = [
'run_id' => basename($strRunRoot),
'run_root_public' => self::publicRelativePath($strRunRoot),
'run_root_public' => self::storageRelativePath($strRunRoot),
'received_count' => $intReceivedCount,
'valid_count' => (int)($arrSummary['valid_count'] ?? 0),
'error_count' => $intErrorCount,
@@ -63,9 +63,9 @@ class DomainExternalSeoSnapshotValidateRunIndexHelper
'warnings' => (array)($arrSummary['warnings'] ?? []),
'error_buckets' => (array)($arrSummary['error_buckets'] ?? []),
'warning_buckets' => (array)($arrSummary['warning_buckets'] ?? []),
'summary_json_path' => self::publicRelativePath($strSummaryPath),
'summary_html_path' => self::publicRelativePath($strRunRoot . '/snapshot-validate.summary.html'),
'payload_json_path' => self::publicRelativePath($strRunRoot . '/snapshots.payload.json'),
'summary_json_path' => self::storageRelativePath($strSummaryPath),
'summary_html_path' => self::storageRelativePath($strRunRoot . '/snapshot-validate.summary.html'),
'payload_json_path' => self::storageRelativePath($strRunRoot . '/snapshots.payload.json'),
'updated_at' => date(DATE_ATOM, (int)(filemtime($strSummaryPath) ?: time())),
];
}

View File

@@ -1710,7 +1710,13 @@ class SiteStyle
{
if (!$domainRow) return null;
$raw = is_array($domainRow) ? ($domainRow['t_cfg'] ?? null) : ($domainRow->t_cfg ?? null);
return $raw ? json_decode($raw, true) : null;
if (is_array($raw)) {
return $raw;
}
if (!is_string($raw) || trim($raw) === '') {
return null;
}
return json_decode($raw, true);
}
private static function writeDbConfig($domainRow, array $cfg): void