1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-23 03:50:56 +08:00

Merge branch 'develop' into demo

This commit is contained in:
xiaochong0302 2020-09-18 16:48:41 +08:00
commit 0e65a72de2
22 changed files with 71 additions and 67 deletions

View File

@ -1,6 +1,5 @@
本软件是强业务类型的,并非框架类库,不适合衍生发布。 使用协议
前提条件:不衍生发布,不去除相关版权标识 1. 本系统属于强业务类型,非通用类库框架,不适合再次衍生发布。
2. 在保留我们版权标识的前提下,用户可以修改以满足自己的需求,可以用于商业用途。
1. 在满足前提条件下免费使用,可以二次开发,可以用于商业行为。 3. 有限社区支持,用户对自己的行为负责。
2. 用户对自己行为负责,有限社区支持,无个体服务。

View File

@ -1,4 +1,4 @@
# 酷瓜云课堂 ## 酷瓜云课堂
#### 项目介绍 #### 项目介绍
@ -6,18 +6,18 @@
#### 系统功能 #### 系统功能
都有些什么功能?我也不想写一大堆,自己体验吧! 实现了点播、直播、专栏、会员、微聊等,是一个完整的产品,具体功能我也不想写一大堆,自己体验吧!
- [前台演示](https://ctc.koogua.com) - [前台演示](https://ctc.koogua.com)
- [后台演示](https://ctc.koogua.com/admin) - [后台演示](https://ctc.koogua.com/admin)
帐号100015@163.com / 123456 (前后台通用,请不要修改密码) 帐号100015@163.com / 123456 (前后台通用)
友情提示: 友情提示:
- 系统配置低1核 1G 1M 跑多个容器),手下留情 - 系统配置低1核 1G 1M 跑多个容器),切莫压测
- 课程数据来源于网络(无实质内容),切莫购买 - 课程数据来源于网络(无实质内容),切莫购买
- 管理后台已禁止提交(私密配置已过滤) - 管理后台已禁止数据提交,私密配置已过滤
#### 项目组件 #### 项目组件
@ -48,7 +48,7 @@
#### 意见反馈 #### 意见反馈
- [在线反馈](https://gitee.com/koogua/course-tencent-cloud/issues) - [在线反馈](https://gitee.com/koogua/course-tencent-cloud/issues)(推荐)
- QQ邮箱: 76632555@qq.com - QQ邮箱: 76632555@qq.com
- QQ群组: 787363898 - QQ群组: 787363898

View File

@ -2,7 +2,7 @@
namespace App\Console\Tasks; namespace App\Console\Tasks;
use App\Library\SiteMap; use App\Library\Sitemap;
use App\Models\Course as CourseModel; use App\Models\Course as CourseModel;
use App\Models\Help as HelpModel; use App\Models\Help as HelpModel;
use App\Models\ImGroup as ImGroupModel; use App\Models\ImGroup as ImGroupModel;
@ -12,7 +12,7 @@ use App\Models\User as UserModel;
use App\Services\Service as AppService; use App\Services\Service as AppService;
use Phalcon\Mvc\Model\Resultset; use Phalcon\Mvc\Model\Resultset;
class SiteMapTask extends Task class SitemapTask extends Task
{ {
/** /**
@ -21,15 +21,15 @@ class SiteMapTask extends Task
protected $siteUrl; protected $siteUrl;
/** /**
* @var SiteMap * @var Sitemap
*/ */
protected $siteMap; protected $sitemap;
public function mainAction() public function mainAction()
{ {
$this->siteUrl = $this->getSiteUrl(); $this->siteUrl = $this->getSiteUrl();
$this->siteMap = new SiteMap(); $this->sitemap = new Sitemap();
$filename = public_path('sitemap.xml'); $filename = public_path('sitemap.xml');
@ -42,7 +42,7 @@ class SiteMapTask extends Task
$this->addPages(); $this->addPages();
$this->addOthers(); $this->addOthers();
$this->siteMap->build($filename); $this->sitemap->build($filename);
} }
protected function getSiteUrl() protected function getSiteUrl()
@ -56,7 +56,7 @@ class SiteMapTask extends Task
protected function addIndex() protected function addIndex()
{ {
$this->siteMap->addItem($this->siteUrl, 1); $this->sitemap->addItem($this->siteUrl, 1);
} }
protected function addCourses() protected function addCourses()
@ -70,7 +70,7 @@ class SiteMapTask extends Task
foreach ($courses as $course) { foreach ($courses as $course) {
$loc = sprintf('%s/course/%s', $this->siteUrl, $course->id); $loc = sprintf('%s/course/%s', $this->siteUrl, $course->id);
$this->siteMap->addItem($loc, 0.8); $this->sitemap->addItem($loc, 0.8);
} }
} }
@ -85,7 +85,7 @@ class SiteMapTask extends Task
foreach ($teachers as $teacher) { foreach ($teachers as $teacher) {
$loc = sprintf('%s/teacher/%s', $this->siteUrl, $teacher->id); $loc = sprintf('%s/teacher/%s', $this->siteUrl, $teacher->id);
$this->siteMap->addItem($loc, 0.6); $this->sitemap->addItem($loc, 0.6);
} }
} }
@ -100,7 +100,7 @@ class SiteMapTask extends Task
foreach ($topics as $topic) { foreach ($topics as $topic) {
$loc = sprintf('%s/topic/%s', $this->siteUrl, $topic->id); $loc = sprintf('%s/topic/%s', $this->siteUrl, $topic->id);
$this->siteMap->addItem($loc, 0.6); $this->sitemap->addItem($loc, 0.6);
} }
} }
@ -115,7 +115,7 @@ class SiteMapTask extends Task
foreach ($groups as $group) { foreach ($groups as $group) {
$loc = sprintf('%s/im/group/%s', $this->siteUrl, $group->id); $loc = sprintf('%s/im/group/%s', $this->siteUrl, $group->id);
$this->siteMap->addItem($loc, 0.6); $this->sitemap->addItem($loc, 0.6);
} }
} }
@ -130,7 +130,7 @@ class SiteMapTask extends Task
foreach ($pages as $page) { foreach ($pages as $page) {
$loc = sprintf('%s/page/%s', $this->siteUrl, $page->id); $loc = sprintf('%s/page/%s', $this->siteUrl, $page->id);
$this->siteMap->addItem($loc, 0.7); $this->sitemap->addItem($loc, 0.7);
} }
} }
@ -145,18 +145,18 @@ class SiteMapTask extends Task
foreach ($helps as $help) { foreach ($helps as $help) {
$loc = sprintf('%s/help/%s', $this->siteUrl, $help->id); $loc = sprintf('%s/help/%s', $this->siteUrl, $help->id);
$this->siteMap->addItem($loc, 0.7); $this->sitemap->addItem($loc, 0.7);
} }
} }
protected function addOthers() protected function addOthers()
{ {
$this->siteMap->addItem('/course/list', 0.6); $this->sitemap->addItem('/course/list', 0.6);
$this->siteMap->addItem('/im/group/list', 0.6); $this->sitemap->addItem('/im/group/list', 0.6);
$this->siteMap->addItem('/teacher/list', 0.6); $this->sitemap->addItem('/teacher/list', 0.6);
$this->siteMap->addItem('/vip', 0.6); $this->sitemap->addItem('/vip', 0.6);
$this->siteMap->addItem('/help', 0.6); $this->sitemap->addItem('/help', 0.6);
$this->siteMap->addItem('/search', 0.6); $this->sitemap->addItem('/search', 0.6);
} }
} }

View File

@ -12,7 +12,7 @@ class HelpController extends Controller
{ {
/** /**
* @Get("/", name="home.help.index") * @Get("/index", name="home.help.index")
*/ */
public function indexAction() public function indexAction()
{ {

View File

@ -24,7 +24,7 @@ class ImController extends Controller
} }
/** /**
* @Get("/", name="home.im.index") * @Get("/index", name="home.im.index")
*/ */
public function indexAction() public function indexAction()
{ {

View File

@ -5,7 +5,7 @@
<div class="breadcrumb"> <div class="breadcrumb">
<span class="layui-breadcrumb"> <span class="layui-breadcrumb">
<a href="/">首页</a> <a href="/">首页</a>
<a><cite>帮助</cite></a> <a><cite>帮助中心</cite></a>
</span> </span>
</div> </div>

View File

@ -5,13 +5,12 @@
<div class="breadcrumb"> <div class="breadcrumb">
<span class="layui-breadcrumb"> <span class="layui-breadcrumb">
<a href="/">首页</a> <a href="/">首页</a>
<a href="{{ url({'for':'home.help.index'}) }}">帮助</a> <a href="{{ url({'for':'home.help.index'}) }}">帮助中心</a>
<a><cite>{{ help.title }}</cite></a> <a><cite>{{ help.title }}</cite></a>
</span> </span>
</div> </div>
<div class="page-info wrap"> <div class="page-info wrap">
<div class="title">{{ help.title }}</div>
<div class="content" id="preview">{{ help.content }}</div> <div class="content" id="preview">{{ help.content }}</div>
</div> </div>

View File

@ -27,7 +27,13 @@ class CsrfToken
public function getToken() public function getToken()
{ {
$text = implode($this->delimiter, [time(), $this->fixed, Text::random(8)]); $content = [
time() + $this->lifetime,
$this->fixed,
Text::random(8),
];
$text = implode($this->delimiter, $content);
return $this->crypt->encryptBase64($text); return $this->crypt->encryptBase64($text);
} }
@ -40,15 +46,11 @@ class CsrfToken
$params = explode($this->delimiter, $text); $params = explode($this->delimiter, $text);
if (!isset($params[0]) || !isset($params[1]) || !isset($params[2])) { if (count($params) != 3) {
return false; return false;
} }
if ($params[0] != intval($params[0]) || $params[1] != $this->fixed || strlen($params[2]) != 8) { if ($params[0] < time() || $params[1] != $this->fixed || strlen($params[2]) != 8) {
return false;
}
if (time() - $params[0] > $this->lifetime) {
return false; return false;
} }

View File

@ -59,7 +59,7 @@ class XunSearch extends PaginatorAdapter
$this->config = $config; $this->config = $config;
$this->_page = $config['page'] ?? 1; $this->_page = $config['page'] ?? 1;
$this->_limitRows = $config['limit'] ?? 15; $this->_limitRows = $config['limit'] ?? 12;
$query = new PaginatorQuery(); $query = new PaginatorQuery();

View File

@ -42,12 +42,12 @@ class Query
public function getSort() public function getSort()
{ {
return $this->request->getQuery('sort', ['trim', 'string'], ''); return $this->request->getQuery('sort', ['trim', 'string']);
} }
public function getBaseUrl() public function getBaseUrl()
{ {
return $this->request->getQuery('_url', ['trim', 'string'], ''); return $this->request->getQuery('_url', ['trim', 'string']);
} }
public function getParams(array $whitelist = []) public function getParams(array $whitelist = [])

View File

@ -2,7 +2,7 @@
namespace App\Library; namespace App\Library;
class SiteMap class Sitemap
{ {
/** /**

View File

@ -128,8 +128,6 @@ class LiveNotify extends Service
protected function sendBeginNotify(ChapterModel $chapter) protected function sendBeginNotify(ChapterModel $chapter)
{ {
$cache = $this->getCache();
$redis = $this->getRedis(); $redis = $this->getRedis();
$key = $this->getNotifyKey(); $key = $this->getNotifyKey();
@ -141,7 +139,7 @@ class LiveNotify extends Service
protected function getChapter($streamId) protected function getChapter($streamId)
{ {
$id = (int)str_replace('chapter_', '', $streamId); $id = str_replace('chapter_', '', $streamId);
$chapterRepo = new ChapterRepo(); $chapterRepo = new ChapterRepo();
@ -164,13 +162,9 @@ class LiveNotify extends Service
*/ */
protected function checkSign($sign, $time) protected function checkSign($sign, $time)
{ {
if (empty($sign) || empty($time)) { if (!$sign || !$time) return false;
return false;
}
if ($time < time()) { if ($time < time()) return false;
return false;
}
$notify = $this->getSettings('live.notify'); $notify = $this->getSettings('live.notify');

View File

@ -49,6 +49,10 @@ Abstract class Smser extends Service
$result = $content['result'] == 0; $result = $content['result'] == 0;
if ($result == false) {
$this->logger->error('Send Message Failed ' . $response);
}
} catch (\Exception $e) { } catch (\Exception $e) {
$this->logger->error('Send Message Exception ' . kg_json_encode([ $this->logger->error('Send Message Exception ' . kg_json_encode([
@ -71,7 +75,7 @@ Abstract class Smser extends Service
{ {
$template = json_decode($this->settings['template'], true); $template = json_decode($this->settings['template'], true);
return $template[$code]['id'] ?? null; return $template[$code] ?? null;
} }
protected function getSignature() protected function getSignature()

View File

@ -21,6 +21,19 @@
color: rgba(255, 255, 255, .7); color: rgba(255, 255, 255, .7);
} }
.layui-main .vditor-reset {
font: 14px Helvetica Neue, Helvetica, PingFang SC, Tahoma, Arial, sans-serif;
color: #666;
}
.vditor-reset ul > li {
list-style: disc;
}
.vditor-reset ol > li {
list-style: decimal;
}
.kg-body { .kg-body {
padding: 15px; padding: 15px;
} }

View File

@ -94,7 +94,6 @@
.layui-main .vditor-reset { .layui-main .vditor-reset {
font: 14px Helvetica Neue, Helvetica, PingFang SC, Tahoma, Arial, sans-serif; font: 14px Helvetica Neue, Helvetica, PingFang SC, Tahoma, Arial, sans-serif;
color: #666;
} }
.vditor-reset ul > li { .vditor-reset ul > li {

View File

@ -5,7 +5,7 @@ layui.use(['jquery', 'helper'], function () {
var interval = null; var interval = null;
var intervalTime = 15000; var intervalTime = 15000;
var userId = window.koogua.user.id; var userId = window.user.id;
var chapterId = $('input[name="chapter.id"]').val(); var chapterId = $('input[name="chapter.id"]').val();
var planId = $('input[name="chapter.plan_id"]').val(); var planId = $('input[name="chapter.plan_id"]').val();
var learningUrl = $('input[name="chapter.learning_url"]').val(); var learningUrl = $('input[name="chapter.learning_url"]').val();

View File

@ -1,7 +1,6 @@
layui.use(['jquery', 'layer'], function () { layui.use(['jquery'], function () {
var $ = layui.jquery; var $ = layui.jquery;
var layer = layui.layer;
var element = document.getElementById('preview'); var element = document.getElementById('preview');
var markdown = element.innerHTML; var markdown = element.innerHTML;
var options = { var options = {
@ -14,13 +13,8 @@ layui.use(['jquery', 'layer'], function () {
Vditor.preview(element, markdown, options); Vditor.preview(element, markdown, options);
layer.ready(function () {
layer.load(1);
});
setTimeout(function () { setTimeout(function () {
$(element).removeClass('layui-hide'); $(element).removeClass('layui-hide');
layer.closeAll(); }, 500);
}, 1000);
}); });

View File

@ -52,7 +52,7 @@ $scheduler->php($script, $bin, ['--task' => 'revoke_vip', '--action' => 'main'])
$scheduler->php($script, $bin, ['--task' => 'clean_token', '--action' => 'main']) $scheduler->php($script, $bin, ['--task' => 'clean_token', '--action' => 'main'])
->daily(3, 17); ->daily(3, 17);
$scheduler->php($script, $bin, ['--task' => 'site_map', '--action' => 'main']) $scheduler->php($script, $bin, ['--task' => 'sitemap', '--action' => 'main'])
->daily(4, 3); ->daily(4, 3);
$scheduler->run(); $scheduler->run();