mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-25 12:09:09 +08:00
Merge branch 'develop' into demo
This commit is contained in:
commit
cf239e70a0
@ -5,6 +5,7 @@ namespace App\Http\Admin\Controllers;
|
|||||||
use App\Http\Admin\Services\Chapter as ChapterService;
|
use App\Http\Admin\Services\Chapter as ChapterService;
|
||||||
use App\Http\Admin\Services\ChapterContent as ChapterContentService;
|
use App\Http\Admin\Services\ChapterContent as ChapterContentService;
|
||||||
use App\Http\Admin\Services\Course as CourseService;
|
use App\Http\Admin\Services\Course as CourseService;
|
||||||
|
use App\Models\ChapterLive as ChapterLiveModel;
|
||||||
use App\Models\Course as CourseModel;
|
use App\Models\Course as CourseModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -104,7 +105,9 @@ class ChapterController extends Controller
|
|||||||
break;
|
break;
|
||||||
case CourseModel::MODEL_LIVE:
|
case CourseModel::MODEL_LIVE:
|
||||||
$live = $contentService->getChapterLive($chapter->id);
|
$live = $contentService->getChapterLive($chapter->id);
|
||||||
|
$streamName = ChapterLiveModel::generateStreamName($chapter->id);
|
||||||
$this->view->setVar('live', $live);
|
$this->view->setVar('live', $live);
|
||||||
|
$this->view->setVar('stream_name', $streamName);
|
||||||
break;
|
break;
|
||||||
case CourseModel::MODEL_READ:
|
case CourseModel::MODEL_READ:
|
||||||
$read = $contentService->getChapterRead($chapter->id);
|
$read = $contentService->getChapterRead($chapter->id);
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<label class="layui-form-label">Stream Name</label>
|
<label class="layui-form-label">Stream Name</label>
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
<input class="layui-input" type="text" name="stream_name" value="chapter_{{ chapter.id }}" readonly="readonly">
|
<input class="layui-input" type="text" name="stream_name" value="{{ stream_name }}" readonly="readonly">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
|
@ -50,11 +50,11 @@ class ChapterController extends Controller
|
|||||||
$this->view->pick('chapter/read');
|
$this->view->pick('chapter/read');
|
||||||
} elseif ($chapter['model'] == CourseModel::MODEL_LIVE) {
|
} elseif ($chapter['model'] == CourseModel::MODEL_LIVE) {
|
||||||
if ($chapter['status'] == LiveModel::STATUS_ACTIVE) {
|
if ($chapter['status'] == LiveModel::STATUS_ACTIVE) {
|
||||||
$this->view->pick('chapter/live_active');
|
$this->view->pick('chapter/live/active');
|
||||||
} elseif ($chapter['status'] == LiveModel::STATUS_INACTIVE) {
|
} elseif ($chapter['status'] == LiveModel::STATUS_INACTIVE) {
|
||||||
$this->view->pick('chapter/live_inactive');
|
$this->view->pick('chapter/live/inactive');
|
||||||
} elseif ($chapter['status'] == LiveModel::STATUS_FORBID) {
|
} elseif ($chapter['status'] == LiveModel::STATUS_FORBID) {
|
||||||
$this->view->pick('chapter/live_forbid');
|
$this->view->pick('chapter/live/forbid');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
namespace App\Http\Home\Controllers;
|
namespace App\Http\Home\Controllers;
|
||||||
|
|
||||||
use App\Http\Home\Services\Live as LiveService;
|
use App\Http\Home\Services\ChapterLive as ChapterLiveService;
|
||||||
use App\Traits\Response as ResponseTrait;
|
use App\Traits\Response as ResponseTrait;
|
||||||
use Phalcon\Mvc\View;
|
use Phalcon\Mvc\View;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @RoutePrefix("/live")
|
* @RoutePrefix("/live")
|
||||||
*/
|
*/
|
||||||
class LiveController extends Controller
|
class ChapterLiveController extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
use ResponseTrait;
|
use ResponseTrait;
|
||||||
@ -19,12 +19,12 @@ class LiveController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function chatsAction($id)
|
public function chatsAction($id)
|
||||||
{
|
{
|
||||||
$service = new LiveService();
|
$service = new ChapterLiveService();
|
||||||
|
|
||||||
$chats = $service->getRecentChats($id);
|
$chats = $service->getRecentChats($id);
|
||||||
|
|
||||||
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
|
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
|
||||||
$this->view->pick('chapter/live_chats');
|
$this->view->pick('chapter/live/chats');
|
||||||
$this->view->setVar('chats', $chats);
|
$this->view->setVar('chats', $chats);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ class LiveController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function statsAction($id)
|
public function statsAction($id)
|
||||||
{
|
{
|
||||||
$service = new LiveService();
|
$service = new ChapterLiveService();
|
||||||
|
|
||||||
$stats = $service->getStats($id);
|
$stats = $service->getStats($id);
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ class LiveController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function statusAction($id)
|
public function statusAction($id)
|
||||||
{
|
{
|
||||||
$service = new LiveService();
|
$service = new ChapterLiveService();
|
||||||
|
|
||||||
$status = $service->getStatus($id);
|
$status = $service->getStatus($id);
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ class LiveController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function bindUserAction($id)
|
public function bindUserAction($id)
|
||||||
{
|
{
|
||||||
$service = new LiveService();
|
$service = new ChapterLiveService();
|
||||||
|
|
||||||
$service->bindUser($id);
|
$service->bindUser($id);
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ class LiveController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function sendMessageAction($id)
|
public function sendMessageAction($id)
|
||||||
{
|
{
|
||||||
$service = new LiveService();
|
$service = new ChapterLiveService();
|
||||||
|
|
||||||
$response = $service->sendMessage($id);
|
$response = $service->sendMessage($id);
|
||||||
|
|
@ -5,7 +5,7 @@ namespace App\Http\Home\Services;
|
|||||||
use App\Services\Logic\ChapterTrait;
|
use App\Services\Logic\ChapterTrait;
|
||||||
use GatewayClient\Gateway;
|
use GatewayClient\Gateway;
|
||||||
|
|
||||||
class Live extends Service
|
class ChapterLive extends Service
|
||||||
{
|
{
|
||||||
|
|
||||||
use ChapterTrait;
|
use ChapterTrait;
|
||||||
@ -140,12 +140,12 @@ class Live extends Service
|
|||||||
|
|
||||||
protected function getRecentChatKey($id)
|
protected function getRecentChatKey($id)
|
||||||
{
|
{
|
||||||
return "chapter_recent_chat:{$id}";
|
return "recent_live_chat:{$id}";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getGroupName($id)
|
protected function getGroupName($id)
|
||||||
{
|
{
|
||||||
return "chapter_{$id}";
|
return "live_{$id}";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,25 +0,0 @@
|
|||||||
{% extends 'templates/main.volt' %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
|
|
||||||
{% if chapter.status == 'active' %}
|
|
||||||
{{ partial('live/live_active') }}
|
|
||||||
{% elseif chapter.status == 'inactive' %}
|
|
||||||
{{ partial('live/live_inactive') }}
|
|
||||||
{% elseif chapter.status =='forbid' %}
|
|
||||||
{{ partial('live/live_forbid') }}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block include_js %}
|
|
||||||
|
|
||||||
{% if chapter.status == 'active' %}
|
|
||||||
{{ js_include('https://imgcache.qq.com/open/qcloud/video/vcplayer/TcPlayer-2.3.3.js', false) }}
|
|
||||||
{{ js_include('home/js/chapter.live.player.js') }}
|
|
||||||
{{ js_include('home/js/chapter.live.chat.js') }}
|
|
||||||
{{ js_include('home/js/chapter.action.js') }}
|
|
||||||
{{ js_include('home/js/course.share.js') }}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% endblock %}
|
|
@ -12,4 +12,9 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="preview">
|
||||||
|
<div class="icon"><i class="layui-icon layui-icon-face-cry"></i></div>
|
||||||
|
<div class="tips">直播已禁止,谢谢关注!</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -2,22 +2,31 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
|
{% set course_url = url({'for':'home.course.show','id':chapter.course.id}) %}
|
||||||
{% set live_status_url = url({'for':'home.live.status','id':chapter.id}) %}
|
{% set live_status_url = url({'for':'home.live.status','id':chapter.id}) %}
|
||||||
|
|
||||||
|
<div class="breadcrumb">
|
||||||
|
<span class="layui-breadcrumb">
|
||||||
|
<a href="{{ course_url }}"><i class="layui-icon layui-icon-return"></i> 返回课程</a>
|
||||||
|
<a><cite>{{ chapter.course.title }}</cite></a>
|
||||||
|
<a><cite>{{ chapter.title }}</cite></a>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
{% if time() < chapter.start_time %}
|
{% if time() < chapter.start_time %}
|
||||||
<div class="countdown">
|
<div class="preview countdown">
|
||||||
<div class="icon"><i class="layui-icon layui-icon-time"></i></div>
|
<div class="icon"><i class="layui-icon layui-icon-time"></i></div>
|
||||||
<div class="timer"></div>
|
<div class="timer"></div>
|
||||||
<div class="tips">直播倒计时开始啦,敬请关注!</div>
|
<div class="tips">直播倒计时开始啦,敬请关注!</div>
|
||||||
</div>
|
</div>
|
||||||
{% elseif chapter.start_time < time() and chapter.end_time > time() %}
|
{% elseif chapter.start_time < time() and chapter.end_time > time() %}
|
||||||
<div class="countdown">
|
<div class="preview countdown">
|
||||||
<div class="icon"><i class="layui-icon layui-icon-face-surprised"></i></div>
|
<div class="icon"><i class="layui-icon layui-icon-face-surprised"></i></div>
|
||||||
<div class="timer"></div>
|
<div class="timer"></div>
|
||||||
<div class="tips">直播时间到了,主播去哪了?</div>
|
<div class="tips">直播时间到了,老师去哪了?</div>
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="countdown">
|
<div class="preview">
|
||||||
<div class="icon"><i class="layui-icon layui-icon-tree"></i></div>
|
<div class="icon"><i class="layui-icon layui-icon-tree"></i></div>
|
||||||
<div class="tips">直播已结束,谢谢关注!</div>
|
<div class="tips">直播已结束,谢谢关注!</div>
|
||||||
</div>
|
</div>
|
@ -4,7 +4,7 @@
|
|||||||
{% elseif value == '2' %}
|
{% elseif value == '2' %}
|
||||||
<span class="layui-badge layui-bg-blue">直播</span>
|
<span class="layui-badge layui-bg-blue">直播</span>
|
||||||
{% elseif value == '3' %}
|
{% elseif value == '3' %}
|
||||||
<span class="layui-badge layui-bg-black">图文</span>
|
<span class="layui-badge layui-bg-black">专栏</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{%- endmacro %}
|
{%- endmacro %}
|
||||||
|
|
||||||
|
@ -92,4 +92,14 @@ class ChapterLive extends Model
|
|||||||
$this->update_time = time();
|
$this->update_time = time();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function generateStreamName($id)
|
||||||
|
{
|
||||||
|
return "chapter_{$id}";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function parseFromStreamName($streamName)
|
||||||
|
{
|
||||||
|
return str_replace('chapter_', '', $streamName);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -137,9 +137,9 @@ class LiveNotify extends Service
|
|||||||
$redis->expire($key, 86400);
|
$redis->expire($key, 86400);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getChapter($streamId)
|
protected function getChapter($streamName)
|
||||||
{
|
{
|
||||||
$id = str_replace('chapter_', '', $streamId);
|
$id = ChapterLiveModel::parseFromStreamName($streamName);
|
||||||
|
|
||||||
$chapterRepo = new ChapterRepo();
|
$chapterRepo = new ChapterRepo();
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
namespace App\Services\Logic\Chapter;
|
namespace App\Services\Logic\Chapter;
|
||||||
|
|
||||||
use App\Models\Chapter as ChapterModel;
|
use App\Models\Chapter as ChapterModel;
|
||||||
|
use App\Models\ChapterLive as ChapterLiveModel;
|
||||||
use App\Models\Course as CourseModel;
|
use App\Models\Course as CourseModel;
|
||||||
use App\Repos\Chapter as ChapterRepo;
|
use App\Repos\Chapter as ChapterRepo;
|
||||||
use App\Services\ChapterVod as ChapterVodService;
|
use App\Services\ChapterVod as ChapterVodService;
|
||||||
@ -79,9 +80,9 @@ class BasicInfo extends Service
|
|||||||
{
|
{
|
||||||
$liveService = new LiveService();
|
$liveService = new LiveService();
|
||||||
|
|
||||||
$stream = $this->getStreamName($chapter->id);
|
$streamName = ChapterLiveModel::generateStreamName($chapter->id);
|
||||||
|
|
||||||
$playUrls = $liveService->getPullUrls($stream);
|
$playUrls = $liveService->getPullUrls($streamName);
|
||||||
|
|
||||||
$chapterRepo = new ChapterRepo();
|
$chapterRepo = new ChapterRepo();
|
||||||
|
|
||||||
|
@ -26,11 +26,6 @@ trait ChapterTrait
|
|||||||
*/
|
*/
|
||||||
protected $chapterUser;
|
protected $chapterUser;
|
||||||
|
|
||||||
public function getStreamName($id)
|
|
||||||
{
|
|
||||||
return "chapter_{$id}";
|
|
||||||
}
|
|
||||||
|
|
||||||
public function checkChapterVod($id)
|
public function checkChapterVod($id)
|
||||||
{
|
{
|
||||||
$validator = new ChapterValidator();
|
$validator = new ChapterValidator();
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Services\Logic\Teacher\Console;
|
namespace App\Services\Logic\Teacher\Console;
|
||||||
|
|
||||||
|
use App\Models\ChapterLive as ChapterLiveModel;
|
||||||
use App\Services\Live as LiveService;
|
use App\Services\Live as LiveService;
|
||||||
use App\Services\Logic\ChapterTrait;
|
use App\Services\Logic\ChapterTrait;
|
||||||
use App\Services\Logic\Service;
|
use App\Services\Logic\Service;
|
||||||
@ -17,7 +18,7 @@ class LivePushUrl extends Service
|
|||||||
|
|
||||||
$service = new LiveService();
|
$service = new LiveService();
|
||||||
|
|
||||||
$steamName = $this->getStreamName($chapter->id);
|
$steamName = ChapterLiveModel::generateStreamName($chapter->id);
|
||||||
|
|
||||||
return $service->getPushUrl($steamName);
|
return $service->getPushUrl($steamName);
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ $config['metadata']['lifetime'] = 7 * 86400;
|
|||||||
/**
|
/**
|
||||||
* statsKey
|
* statsKey
|
||||||
*/
|
*/
|
||||||
$config['metadata']['statsKey'] = '_PH_METADATA_';
|
$config['metadata']['statsKey'] = '_METADATA_';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* redis库编号
|
* redis库编号
|
||||||
@ -130,7 +130,7 @@ $config['annotation']['lifetime'] = 7 * 86400;
|
|||||||
/**
|
/**
|
||||||
* statsKey
|
* statsKey
|
||||||
*/
|
*/
|
||||||
$config['annotation']['statsKey'] = '_PH_ANNOTATION_';
|
$config['annotation']['statsKey'] = '_ANNOTATION_';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 密钥
|
* 密钥
|
||||||
|
@ -30,10 +30,6 @@
|
|||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.padding20 {
|
|
||||||
padding: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.center {
|
.center {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
@ -77,6 +73,10 @@
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.layer .pager {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.loading {
|
.loading {
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@ -127,10 +127,6 @@
|
|||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.logo {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.top-nav {
|
.top-nav {
|
||||||
margin-left: 100px;
|
margin-left: 100px;
|
||||||
}
|
}
|
||||||
@ -897,21 +893,21 @@
|
|||||||
color: #666;
|
color: #666;
|
||||||
}
|
}
|
||||||
|
|
||||||
.countdown {
|
.preview {
|
||||||
color: #666;
|
color: #666;
|
||||||
margin-top: 30px;
|
margin-top: 30px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.countdown .icon {
|
.preview .icon {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.countdown .icon .layui-icon {
|
.preview .icon .layui-icon {
|
||||||
font-size: 150px;
|
font-size: 150px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.countdown .tips {
|
.preview .tips {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
margin: 20px 0;
|
margin: 20px 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user