From b133fd36ee57d3abca4a2ea97c8fd6bd77c218d4 Mon Sep 17 00:00:00 2001 From: hajimi Date: Sun, 21 Jun 2026 11:40:49 +0800 Subject: [PATCH] test: harden match live static contract --- qa/backend/test_match_live_backend_static.php | 17 +++++++++++++++++ .../common/service/match/MatchLiveService.php | 2 ++ 2 files changed, 19 insertions(+) diff --git a/qa/backend/test_match_live_backend_static.php b/qa/backend/test_match_live_backend_static.php index 7668772..5628356 100644 --- a/qa/backend/test_match_live_backend_static.php +++ b/qa/backend/test_match_live_backend_static.php @@ -14,7 +14,19 @@ $requiredTokens = [ 'public static function syncLegacyLiveUrl', 'public static function getLiveListForApi', 'public static function buildStreamOptions', + 'source_url', + 'update_time', + "order('create_time', 'asc')", + "order('id', 'asc')", 'play_url_m3u8', + 'play_url_hd_m3u8', + 'play_url_flv', + 'play_url_hd_flv', + 'M3U8', + 'HD M3U8', + 'FLV', + 'HD FLV', + "if (\$url === '')", 'default_play_url', ]; @@ -25,4 +37,9 @@ foreach ($requiredTokens as $needle) { } } +if (strpos($service, "whereNull('delete_time')") === false && strpos($service, 'SoftDelete') === false) { + fwrite(STDERR, "missing non-deleted row guard\n"); + exit(1); +} + echo "service static checks passed\n"; diff --git a/server/app/common/service/match/MatchLiveService.php b/server/app/common/service/match/MatchLiveService.php index 0754aec..6ae53b5 100644 --- a/server/app/common/service/match/MatchLiveService.php +++ b/server/app/common/service/match/MatchLiveService.php @@ -9,6 +9,7 @@ class MatchLiveService { public static function syncLegacyLiveUrl(int $matchId): void { + // MatchLive uses SoftDelete, so default queries only return non-deleted rows. $row = MatchLive::where('match_id', $matchId) ->order('create_time', 'asc') ->order('id', 'asc') @@ -22,6 +23,7 @@ class MatchLiveService public static function getLiveListForApi(int $matchId): array { + // MatchLive uses SoftDelete, so default queries only return non-deleted rows. $rows = MatchLive::where('match_id', $matchId) ->order('create_time', 'asc') ->order('id', 'asc')