fix: preserve live streams on title edits
This commit is contained in:
@@ -49,21 +49,28 @@ class MatchLiveLogic extends BaseLogic
|
||||
$oldMatchId = (int) $live->match_id;
|
||||
$newMatchId = (int) $params['match_id'];
|
||||
$now = time();
|
||||
$sourceUrl = trim((string) $params['source_url']);
|
||||
$sourceUrlChanged = $sourceUrl !== trim((string) $live->source_url);
|
||||
|
||||
$live->save([
|
||||
$saveData = [
|
||||
'match_id' => $newMatchId,
|
||||
'title' => trim((string) $params['title']),
|
||||
'source_url' => trim((string) $params['source_url']),
|
||||
'play_url_m3u8' => '',
|
||||
'play_url_hd_m3u8' => '',
|
||||
'play_url_flv' => '',
|
||||
'play_url_hd_flv' => '',
|
||||
'fetch_status' => 0,
|
||||
'fetch_error' => '',
|
||||
'last_fetch_at' => 0,
|
||||
'next_fetch_at' => $now,
|
||||
'source_url' => $sourceUrl,
|
||||
'update_time' => $now,
|
||||
]);
|
||||
];
|
||||
|
||||
if ($sourceUrlChanged) {
|
||||
$saveData['play_url_m3u8'] = '';
|
||||
$saveData['play_url_hd_m3u8'] = '';
|
||||
$saveData['play_url_flv'] = '';
|
||||
$saveData['play_url_hd_flv'] = '';
|
||||
$saveData['fetch_status'] = 0;
|
||||
$saveData['fetch_error'] = '';
|
||||
$saveData['last_fetch_at'] = 0;
|
||||
$saveData['next_fetch_at'] = $now;
|
||||
}
|
||||
|
||||
$live->save($saveData);
|
||||
|
||||
if ($oldMatchId > 0 && $oldMatchId !== $newMatchId) {
|
||||
MatchLiveService::syncLegacyLiveUrl($oldMatchId);
|
||||
|
||||
Reference in New Issue
Block a user