1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-28 21:31:37 +08:00
jacky huang 3cca7661cb
v1.2.1阶段性合并 (#13)
* !6 develop->master 1.1.0
* 更新版本号
* 完善后台今日统计,增加权限白名单,增加后台首页菜单,调整后台登录页样式
* Merge branch 'koogua/I1XFCF' of https://gitee.com/koogua/course-tencen…
* 前台学习资料部分完成
* !2 后台运营统计合并
* 后台学习资料部分完成
* Merge branch 'master' into develop
* Merge branch 'master' of https://github.com/xiaochong0302/course-tencent-cloud
* 1.增加changelog.md
* 1.简化部分路由地址
* Merge pull request #2 from xiaochong0302/dependabot/composer/symfony/h…
* Bump symfony/http-foundation from 4.3.4 to 5.1.6

* !7 纠正迁移文件和代码实际使用字段不一致
* 纠正迁移文件和时间代码中字段不一致
* 更新版本号
* 完善后台今日统计,增加权限白名单,增加后台首页菜单,调整后台登录页样式
* Merge branch 'koogua/I1XFCF' of https://gitee.com/koogua/course-tencen…
* 前台学习资料部分完成
* !2 后台运营统计合并
* 后台学习资料部分完成
* Merge branch 'master' into develop
* Merge branch 'master' of https://github.com/xiaochong0302/course-tencent-cloud
* 1.增加changelog.md
* 1.简化部分路由地址
* Merge pull request #2 from xiaochong0302/dependabot/composer/symfony/h…
* Bump symfony/http-foundation from 4.3.4 to 5.1.6

* !9 修正插入数据不一致以及后台菜单参数类型报错
* 1.修正插入的管理帐号数据
* 纠正迁移文件和时间代码中字段不一致
* 更新版本号
* 完善后台今日统计,增加权限白名单,增加后台首页菜单,调整后台登录页样式
* Merge branch 'koogua/I1XFCF' of https://gitee.com/koogua/course-tencen…
* 前台学习资料部分完成
* !2 后台运营统计合并
* 后台学习资料部分完成
* Merge branch 'master' into develop
* Merge branch 'master' of https://github.com/xiaochong0302/course-tencent-cloud
* 1.增加changelog.md
* 1.简化部分路由地址
* Merge pull request #2 from xiaochong0302/dependabot/composer/symfony/h…
* Bump symfony/http-foundation from 4.3.4 to 5.1.6

* !12 修正退款项目空白以及弹窗自适应
* 修复退款项目空白,以及弹窗高度自适应

* !13 修正退款项目空白以及弹窗自适应
* 修复退款项目空白,以及弹窗高度自适应

* !14 修正点击退款404
* 修复退款项目空白,以及弹窗高度自适应,取消退款内部错误

* 删除文件 LICENSE

* add LICENSE.

* update app/Http/Admin/Controllers/UploadController.php.
去除重复的signatureAction方法

* !19 v1.2.0阶段性合并
* 增加微信H5支付需要的Referer头信息

* 更新H5支付方式

* 更新H5支付方式

* 更新H5支付方式

* !23 修复添加课时后进入编辑页面500错误 
* 修复添加课时后进入编辑页面500错误

* !24 修复添加课时后进入编辑页面500错误
* 修复添加课时后进入编辑页面500错误

* !33 开放登录阶段性合并
* Merge remote-tracking branch 'gitee/xiaochong0302/I280IZ' into xiaocho…
* 初步完成开放登录,待线上测试7
* Merge branch 'demo' of gitee.com:koogua/course-tencent-cloud into xiao…
* 初步完成开放登录,待线上测试6
* !30 开放登录线上测试5
* !29 开放登录线上测试5
* 初步完成开放登录,待线上测试5
* !28 开放登录线上测试4
* 初步完成开放登录,待线上测试4
* !27 开放登录线上测试3
* 初步完成开放登录,待线上测试3
* !26 开放登录线上测试2
* 初步完成开放登录,待线上测试2
* !25 开放登录线上测试
* 初步完成开放登录,待线上测试
* !22 验证更新h5支付
* Merge remote-tracking branch 'remotes/gitee/develop' into demo
* !20 验证更新h5支付
* Merge branch 'develop' of https://gitee.com/koogua/course-tencent-clou…
* !16 v1.2.0阶段性合并
* 删除调试断点代码
* 删除重复的signature方法
* Merge branch 'develop' of https://gitee.com/koogua/course-tencent-clou…
* demo后台增加统计
* !5 更新版本号1.1.0
* !4 v1.1.0版本develop->demo
* Merge branch 'develop' into demo
* 1.增加changelog.md
* Merge branch 'develop' into demo
* Merge branch 'develop' into demo
* Merge branch 'develop' into demo
* !1 精简优化代码
* Merge branch 'develop' into demo
* 合并修改

* !34 修复创建课时相关属性表数据未生成的问题 
* 修复创建课时相关属性表数据未生成的问题

* !35 修复腾讯云回调数据结构改变导致的错误
* 修复腾讯云回调数据结构改变导致的错误,缩短vod_event计划任务时间

* !36 修复添加课程后进入列表500错误
* 修复未填充教师和分类的列表错误

* 优化第三方登录,修复注册密码加密问题

* !38 修复课程分类未过滤
* 过滤课程分类

* !39 修复课程分类未过滤
* 过滤课程分类

* !40 修复课程分类未过滤2
* 过滤课程分类
* 过滤课程分类

* !41 修复课程分类未过滤2
* 过滤课程分类
* 过滤课程分类

* 优化开发登录,计划任务执行路径,周期
2020-12-09 18:07:24 +08:00

235 lines
6.5 KiB
PHP

<?php
namespace App\Http\Admin\Controllers;
use App\Http\Admin\Services\Chapter as ChapterService;
use App\Http\Admin\Services\ChapterContent as ChapterContentService;
use App\Http\Admin\Services\Course as CourseService;
use App\Models\ChapterLive as ChapterLiveModel;
use App\Models\Course as CourseModel;
use Phalcon\Mvc\View;
/**
* @RoutePrefix("/admin/chapter")
*/
class ChapterController extends Controller
{
/**
* @Get("/{id:[0-9]+}/resources", name="admin.chapter.resources")
*/
public function resourcesAction($id)
{
$chapterService = new ChapterService();
$resources = $chapterService->getResources($id);
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
$this->view->setVar('resources', $resources);
}
/**
* @Get("/{id:[0-9]+}/lessons", name="admin.chapter.lessons")
*/
public function lessonsAction($id)
{
$courseService = new CourseService();
$chapterService = new ChapterService();
$chapter = $chapterService->getChapter($id);
$lessons = $chapterService->getLessons($chapter->id);
$course = $courseService->getCourse($chapter->course_id);
$this->view->setVar('chapter', $chapter);
$this->view->setVar('lessons', $lessons);
$this->view->setVar('course', $course);
}
/**
* @Get("/add", name="admin.chapter.add")
*/
public function addAction()
{
$courseId = $this->request->getQuery('course_id', 'int');
$parentId = $this->request->getQuery('parent_id', 'int');
$type = $this->request->getQuery('type', 'string', 'chapter');
$courseService = new CourseService();
$course = $courseService->getCourse($courseId);
$chapters = $courseService->getChapters($courseId);
$this->view->pick('chapter/add_chapter');
if ($type == 'lesson') {
$this->view->pick('chapter/add_lesson');
}
$this->view->setVar('course', $course);
$this->view->setVar('parent_id', $parentId);
$this->view->setVar('chapters', $chapters);
}
/**
* @Post("/create", name="admin.chapter.create")
*/
public function createAction()
{
$chapterService = new ChapterService();
$chapter = $chapterService->createChapter();
$location = $this->url->get([
'for' => 'admin.course.chapters',
'id' => $chapter->course_id,
]);
$content = [
'location' => $location,
'msg' => '创建章节成功',
];
return $this->jsonSuccess($content);
}
/**
* @Get("/{id:[0-9]+}/edit", name="admin.chapter.edit")
*/
public function editAction($id)
{
$contentService = new ChapterContentService();
$chapterService = new ChapterService();
$courseService = new CourseService();
$chapter = $chapterService->getChapter($id);
$course = $courseService->getCourse($chapter->course_id);
$this->view->pick('chapter/edit_chapter');
if ($chapter->parent_id > 0) {
$this->view->pick('chapter/edit_lesson');
$cos = $chapterService->getSettings('cos');
$this->view->setVar('cos', $cos);
switch ($course->model) {
case CourseModel::MODEL_VOD:
$vod = $contentService->getChapterVod($chapter->id);
$playUrls = $contentService->getPlayUrls($chapter->id);
$this->view->setVar('vod', $vod);
$this->view->setVar('play_urls', $playUrls);
break;
case CourseModel::MODEL_LIVE:
$live = $contentService->getChapterLive($chapter->id);
$streamName = ChapterLiveModel::generateStreamName($chapter->id);
$this->view->setVar('live', $live);
$this->view->setVar('stream_name', $streamName);
break;
case CourseModel::MODEL_READ:
$read = $contentService->getChapterRead($chapter->id);
$this->view->setVar('read', $read);
break;
}
}
$this->view->setVar('chapter', $chapter);
$this->view->setVar('course', $course);
}
/**
* @Post("/{id:[0-9]+}/update", name="admin.chapter.update")
*/
public function updateAction($id)
{
$chapterService = new ChapterService();
$chapter = $chapterService->updateChapter($id);
if ($chapter->parent_id > 0) {
$location = $this->url->get([
'for' => 'admin.chapter.lessons',
'id' => $chapter->parent_id,
]);
} else {
$location = $this->url->get([
'for' => 'admin.course.chapters',
'id' => $chapter->course_id,
]);
}
$content = [
'location' => $location,
'msg' => '更新章节成功',
];
return $this->jsonSuccess($content);
}
/**
* @Post("/{id:[0-9]+}/delete", name="admin.chapter.delete")
*/
public function deleteAction($id)
{
$chapterService = new ChapterService();
$chapterService->deleteChapter($id);
$location = $this->request->getHTTPReferer();
$content = [
'location' => $location,
'msg' => '删除章节成功',
];
return $this->jsonSuccess($content);
}
/**
* @Post("/{id:[0-9]+}/restore", name="admin.chapter.restore")
*/
public function restoreAction($id)
{
$chapterService = new ChapterService();
$chapterService->restoreChapter($id);
$location = $this->request->getHTTPReferer();
$content = [
'location' => $location,
'msg' => '删除章节成功',
];
return $this->jsonSuccess($content);
}
/**
* @Post("/{id:[0-9]+}/content", name="admin.chapter.content")
*/
public function contentAction($id)
{
$contentService = new ChapterContentService();
$contentService->updateChapterContent($id);
$chapterService = new ChapterService();
$chapter = $chapterService->getChapter($id);
$location = $this->url->get([
'for' => 'admin.chapter.lessons',
'id' => $chapter->parent_id,
]);
$content = [
'location' => $location,
'msg' => '更新课时内容成功',
];
return $this->jsonSuccess($content);
}
}