1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-22 19:44:02 +08:00

优化直播测试的streamName解析

This commit is contained in:
xiaochong0302 2023-09-04 10:53:18 +08:00
parent 241d802fe1
commit 0dec52806b

View File

@ -99,11 +99,15 @@ class ChapterLive extends Model
public static function generateStreamName($id) public static function generateStreamName($id)
{ {
if ($id == 'test') return $id;
return sprintf('chapter-%03d', $id); return sprintf('chapter-%03d', $id);
} }
public static function parseFromStreamName($streamName) public static function parseFromStreamName($streamName)
{ {
if ($streamName == 'test') return $streamName;
return (int)str_replace('chapter-', '', $streamName); return (int)str_replace('chapter-', '', $streamName);
} }