deploy: auto commit repo-root changes 2026-06-21 19:30:16

This commit is contained in:
hajimi
2026-06-21 19:30:17 +08:00
parent 980b019809
commit f6d967869d
4 changed files with 186 additions and 130 deletions
+9 -13
View File
@@ -17,7 +17,7 @@ use app\common\service\match\MatchLiveService;
class MatchController extends BaseApiController
{
public array $notNeedLogin = ['lists', 'detail', 'leagues', 'sportTypes', 'liveText', 'lineup', 'worldCupStandings', 'worldCupRankings', 'worldCupSchedule'];
public array $notNeedLogin = ['lists', 'detail', 'leagues', 'sportTypes', 'liveText', 'lineup', 'worldCupStandings', 'worldCupRankings', 'worldCupSchedule', 'worldCupLiveCards'];
protected int $worldCupSeasonId = 26123;
protected string $worldCupLeagueName = '世界杯';
@@ -428,20 +428,10 @@ class MatchController extends BaseApiController
->order('id asc')
->select()
->toArray();
$liveMap = MatchLiveService::getLiveMapForApi(array_column($rows, 'id'));
$scheduleMap = [];
foreach ($rows as $row) {
$roundName = $row['round_name'] ?: '未分轮次';
$liveList = $liveMap[(int) $row['id']] ?? [];
$defaultLiveUrl = '';
foreach ($liveList as $line) {
$candidate = trim((string) ($line['default_play_url'] ?? ''));
if ($candidate !== '') {
$defaultLiveUrl = $candidate;
break;
}
}
if (!isset($scheduleMap[$roundName])) {
$scheduleMap[$roundName] = [
'round_name' => $roundName,
@@ -466,8 +456,6 @@ class MatchController extends BaseApiController
'match_time' => (int) $row['match_time'],
'current_minute' => $row['current_minute'],
'half_score' => $row['half_score'],
'live_list' => $liveList,
'default_live_url' => $defaultLiveUrl,
];
}
@@ -515,4 +503,12 @@ class MatchController extends BaseApiController
'schedule_rounds' => $scheduleRounds,
]);
}
public function worldCupLiveCards()
{
return $this->data([
'season_id' => $this->worldCupSeasonId,
'list' => MatchLiveService::getWorldCupLiveCards(),
]);
}
}
@@ -96,4 +96,89 @@ class MatchLiveService
return '';
}
public static function getWorldCupLiveCards(): array
{
$rows = MatchLive::alias('live')
->join('match m', 'm.id = live.match_id')
->where(['m.is_show' => 1])
->where([['m.status', '<>', 2]])
->where(function ($query) {
$query->where('m.league_name', '世界杯')
->whereOr('m.competition_id', 61);
})
->field([
'live.id as live_id',
'live.match_id',
'live.title',
'live.source_url',
'live.play_url_m3u8',
'live.play_url_hd_m3u8',
'live.play_url_flv',
'live.play_url_hd_flv',
'live.fetch_status',
'live.last_fetch_at',
'live.update_time as live_update_time',
'm.id',
'm.match_id as third_match_id',
'm.competition_id',
'm.league_name',
'm.round_name',
'm.stage',
'm.home_team',
'm.home_icon',
'm.home_score',
'm.away_team',
'm.away_icon',
'm.away_score',
'm.status',
'm.match_time',
'm.current_minute',
'm.half_score',
])
->order('m.match_time', 'asc')
->order('live.create_time', 'asc')
->order('live.id', 'asc')
->select()
->toArray();
$cards = [];
foreach ($rows as $row) {
$row['stream_options'] = self::buildStreamOptions($row);
$row['default_play_url'] = self::resolveDefaultPlayUrl($row);
if ($row['default_play_url'] === '') {
continue;
}
$cards[] = [
'live_id' => (int) $row['live_id'],
'match_id' => (int) $row['match_id'],
'title' => (string) ($row['title'] ?? ''),
'source_url' => (string) ($row['source_url'] ?? ''),
'play_url' => (string) $row['default_play_url'],
'default_play_url' => (string) $row['default_play_url'],
'stream_options' => $row['stream_options'],
'fetch_status' => $row['fetch_status'] ?? '',
'last_fetch_at' => $row['last_fetch_at'] ?? '',
'update_time' => $row['live_update_time'] ?? '',
'id' => (int) $row['id'],
'competition_id' => (int) ($row['competition_id'] ?? 0),
'league_name' => (string) ($row['league_name'] ?? ''),
'round_name' => (string) ($row['round_name'] ?? ''),
'stage' => (string) ($row['stage'] ?? ''),
'home_team' => (string) ($row['home_team'] ?? ''),
'home_icon' => (string) ($row['home_icon'] ?? ''),
'home_score' => (int) ($row['home_score'] ?? 0),
'away_team' => (string) ($row['away_team'] ?? ''),
'away_icon' => (string) ($row['away_icon'] ?? ''),
'away_score' => (int) ($row['away_score'] ?? 0),
'status' => (int) ($row['status'] ?? 0),
'match_time' => (int) ($row['match_time'] ?? 0),
'current_minute' => $row['current_minute'] ?? '',
'half_score' => (string) ($row['half_score'] ?? ''),
];
}
return $cards;
}
}