diff --git a/LICENSE b/LICENSE index 8d97e6ed..c5017de7 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,5 @@ -本软件是强业务类型的,并非框架类库,不适合衍生发布。 +使用协议 -前提条件:不衍生发布,不去除相关版权标识 - -1. 在满足前提条件下免费使用,可以二次开发,可以用于商业行为。 -2. 用户对自己行为负责,有限社区支持,无个体服务。 \ No newline at end of file +1. 本系统属于强业务类型,非通用类库框架,不适合再次衍生发布。 +2. 在保留我们版权标识的前提下,用户可以修改以满足自己的需求,可以用于商业用途。 +3. 有限社区支持,用户对自己的行为负责。 \ No newline at end of file diff --git a/README.md b/README.md index a97005b5..22a6034c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# 酷瓜云课堂 +## 酷瓜云课堂 #### 项目介绍 @@ -6,18 +6,18 @@ #### 系统功能 -都有些什么功能?我也不想写一大堆,自己体验吧! +实现了点播、直播、专栏、会员、微聊等,是一个完整的产品,具体功能我也不想写一大堆,自己体验吧! - [前台演示](https://ctc.koogua.com) - [后台演示](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群组: 787363898 diff --git a/app/Console/Tasks/SiteMapTask.php b/app/Console/Tasks/SitemapTask.php similarity index 79% rename from app/Console/Tasks/SiteMapTask.php rename to app/Console/Tasks/SitemapTask.php index d78ce46d..e955055c 100644 --- a/app/Console/Tasks/SiteMapTask.php +++ b/app/Console/Tasks/SitemapTask.php @@ -2,7 +2,7 @@ namespace App\Console\Tasks; -use App\Library\SiteMap; +use App\Library\Sitemap; use App\Models\Course as CourseModel; use App\Models\Help as HelpModel; use App\Models\ImGroup as ImGroupModel; @@ -12,7 +12,7 @@ use App\Models\User as UserModel; use App\Services\Service as AppService; use Phalcon\Mvc\Model\Resultset; -class SiteMapTask extends Task +class SitemapTask extends Task { /** @@ -21,15 +21,15 @@ class SiteMapTask extends Task protected $siteUrl; /** - * @var SiteMap + * @var Sitemap */ - protected $siteMap; + protected $sitemap; public function mainAction() { $this->siteUrl = $this->getSiteUrl(); - $this->siteMap = new SiteMap(); + $this->sitemap = new Sitemap(); $filename = public_path('sitemap.xml'); @@ -42,7 +42,7 @@ class SiteMapTask extends Task $this->addPages(); $this->addOthers(); - $this->siteMap->build($filename); + $this->sitemap->build($filename); } protected function getSiteUrl() @@ -56,7 +56,7 @@ class SiteMapTask extends Task protected function addIndex() { - $this->siteMap->addItem($this->siteUrl, 1); + $this->sitemap->addItem($this->siteUrl, 1); } protected function addCourses() @@ -70,7 +70,7 @@ class SiteMapTask extends Task foreach ($courses as $course) { $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) { $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) { $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) { $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) { $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) { $loc = sprintf('%s/help/%s', $this->siteUrl, $help->id); - $this->siteMap->addItem($loc, 0.7); + $this->sitemap->addItem($loc, 0.7); } } protected function addOthers() { - $this->siteMap->addItem('/course/list', 0.6); - $this->siteMap->addItem('/im/group/list', 0.6); - $this->siteMap->addItem('/teacher/list', 0.6); - $this->siteMap->addItem('/vip', 0.6); - $this->siteMap->addItem('/help', 0.6); - $this->siteMap->addItem('/search', 0.6); + $this->sitemap->addItem('/course/list', 0.6); + $this->sitemap->addItem('/im/group/list', 0.6); + $this->sitemap->addItem('/teacher/list', 0.6); + $this->sitemap->addItem('/vip', 0.6); + $this->sitemap->addItem('/help', 0.6); + $this->sitemap->addItem('/search', 0.6); } } diff --git a/app/Http/Admin/Views/carousel/add.volt b/app/Http/Admin/Views/slide/add.volt similarity index 100% rename from app/Http/Admin/Views/carousel/add.volt rename to app/Http/Admin/Views/slide/add.volt diff --git a/app/Http/Admin/Views/carousel/edit.volt b/app/Http/Admin/Views/slide/edit.volt similarity index 100% rename from app/Http/Admin/Views/carousel/edit.volt rename to app/Http/Admin/Views/slide/edit.volt diff --git a/app/Http/Admin/Views/carousel/list.volt b/app/Http/Admin/Views/slide/list.volt similarity index 100% rename from app/Http/Admin/Views/carousel/list.volt rename to app/Http/Admin/Views/slide/list.volt diff --git a/app/Http/Home/Controllers/HelpController.php b/app/Http/Home/Controllers/HelpController.php index 57e4be9c..d525a80a 100644 --- a/app/Http/Home/Controllers/HelpController.php +++ b/app/Http/Home/Controllers/HelpController.php @@ -12,7 +12,7 @@ class HelpController extends Controller { /** - * @Get("/", name="home.help.index") + * @Get("/index", name="home.help.index") */ public function indexAction() { diff --git a/app/Http/Home/Controllers/ImController.php b/app/Http/Home/Controllers/ImController.php index d23fd030..9de0c1e9 100644 --- a/app/Http/Home/Controllers/ImController.php +++ b/app/Http/Home/Controllers/ImController.php @@ -24,7 +24,7 @@ class ImController extends Controller } /** - * @Get("/", name="home.im.index") + * @Get("/index", name="home.im.index") */ public function indexAction() { diff --git a/app/Http/Home/Views/help/index.volt b/app/Http/Home/Views/help/index.volt index 5a9eb40b..116d9891 100644 --- a/app/Http/Home/Views/help/index.volt +++ b/app/Http/Home/Views/help/index.volt @@ -5,7 +5,7 @@ diff --git a/app/Http/Home/Views/help/show.volt b/app/Http/Home/Views/help/show.volt index bf7cca48..79acca71 100644 --- a/app/Http/Home/Views/help/show.volt +++ b/app/Http/Home/Views/help/show.volt @@ -5,13 +5,12 @@
-
{{ help.title }}
{{ help.content }}
diff --git a/app/Library/CsrfToken.php b/app/Library/CsrfToken.php index 2ef2a861..213d3d27 100644 --- a/app/Library/CsrfToken.php +++ b/app/Library/CsrfToken.php @@ -27,7 +27,13 @@ class CsrfToken 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); } @@ -40,15 +46,11 @@ class CsrfToken $params = explode($this->delimiter, $text); - if (!isset($params[0]) || !isset($params[1]) || !isset($params[2])) { + if (count($params) != 3) { return false; } - if ($params[0] != intval($params[0]) || $params[1] != $this->fixed || strlen($params[2]) != 8) { - return false; - } - - if (time() - $params[0] > $this->lifetime) { + if ($params[0] < time() || $params[1] != $this->fixed || strlen($params[2]) != 8) { return false; } diff --git a/app/Library/Paginator/Adapter/XunSearch.php b/app/Library/Paginator/Adapter/XunSearch.php index c8c93639..9f939263 100644 --- a/app/Library/Paginator/Adapter/XunSearch.php +++ b/app/Library/Paginator/Adapter/XunSearch.php @@ -59,7 +59,7 @@ class XunSearch extends PaginatorAdapter $this->config = $config; $this->_page = $config['page'] ?? 1; - $this->_limitRows = $config['limit'] ?? 15; + $this->_limitRows = $config['limit'] ?? 12; $query = new PaginatorQuery(); diff --git a/app/Library/Paginator/Query.php b/app/Library/Paginator/Query.php index 6b00c357..d73a7709 100644 --- a/app/Library/Paginator/Query.php +++ b/app/Library/Paginator/Query.php @@ -42,12 +42,12 @@ class Query public function getSort() { - return $this->request->getQuery('sort', ['trim', 'string'], ''); + return $this->request->getQuery('sort', ['trim', 'string']); } public function getBaseUrl() { - return $this->request->getQuery('_url', ['trim', 'string'], ''); + return $this->request->getQuery('_url', ['trim', 'string']); } public function getParams(array $whitelist = []) diff --git a/app/Library/SiteMap.php b/app/Library/Sitemap.php similarity index 99% rename from app/Library/SiteMap.php rename to app/Library/Sitemap.php index 1d4ad0b7..26dd7728 100644 --- a/app/Library/SiteMap.php +++ b/app/Library/Sitemap.php @@ -2,7 +2,7 @@ namespace App\Library; -class SiteMap +class Sitemap { /** diff --git a/app/Services/LiveNotify.php b/app/Services/LiveNotify.php index daffe209..c2c8daee 100644 --- a/app/Services/LiveNotify.php +++ b/app/Services/LiveNotify.php @@ -128,8 +128,6 @@ class LiveNotify extends Service protected function sendBeginNotify(ChapterModel $chapter) { - $cache = $this->getCache(); - $redis = $this->getRedis(); $key = $this->getNotifyKey(); @@ -141,7 +139,7 @@ class LiveNotify extends Service protected function getChapter($streamId) { - $id = (int)str_replace('chapter_', '', $streamId); + $id = str_replace('chapter_', '', $streamId); $chapterRepo = new ChapterRepo(); @@ -164,13 +162,9 @@ class LiveNotify extends Service */ protected function checkSign($sign, $time) { - if (empty($sign) || empty($time)) { - return false; - } + if (!$sign || !$time) return false; - if ($time < time()) { - return false; - } + if ($time < time()) return false; $notify = $this->getSettings('live.notify'); diff --git a/app/Services/Smser.php b/app/Services/Smser.php index 4dfde455..6a4d2efd 100644 --- a/app/Services/Smser.php +++ b/app/Services/Smser.php @@ -49,6 +49,10 @@ Abstract class Smser extends Service $result = $content['result'] == 0; + if ($result == false) { + $this->logger->error('Send Message Failed ' . $response); + } + } catch (\Exception $e) { $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); - return $template[$code]['id'] ?? null; + return $template[$code] ?? null; } protected function getSignature() diff --git a/app/Validators/Carousel.php b/app/Validators/Slide.php similarity index 100% rename from app/Validators/Carousel.php rename to app/Validators/Slide.php diff --git a/public/static/admin/css/common.css b/public/static/admin/css/common.css index 9ad13290..270217cc 100644 --- a/public/static/admin/css/common.css +++ b/public/static/admin/css/common.css @@ -21,6 +21,19 @@ 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 { padding: 15px; } diff --git a/public/static/home/css/common.css b/public/static/home/css/common.css index 557bacae..0e860da7 100644 --- a/public/static/home/css/common.css +++ b/public/static/home/css/common.css @@ -94,7 +94,6 @@ .layui-main .vditor-reset { font: 14px Helvetica Neue, Helvetica, PingFang SC, Tahoma, Arial, sans-serif; - color: #666; } .vditor-reset ul > li { diff --git a/public/static/home/js/chapter.read.js b/public/static/home/js/chapter.read.js index a7934a95..df0769de 100644 --- a/public/static/home/js/chapter.read.js +++ b/public/static/home/js/chapter.read.js @@ -5,7 +5,7 @@ layui.use(['jquery', 'helper'], function () { var interval = null; var intervalTime = 15000; - var userId = window.koogua.user.id; + var userId = window.user.id; var chapterId = $('input[name="chapter.id"]').val(); var planId = $('input[name="chapter.plan_id"]').val(); var learningUrl = $('input[name="chapter.learning_url"]').val(); diff --git a/public/static/home/js/markdown.preview.js b/public/static/home/js/markdown.preview.js index 33c0a30e..107427ec 100644 --- a/public/static/home/js/markdown.preview.js +++ b/public/static/home/js/markdown.preview.js @@ -1,7 +1,6 @@ -layui.use(['jquery', 'layer'], function () { +layui.use(['jquery'], function () { var $ = layui.jquery; - var layer = layui.layer; var element = document.getElementById('preview'); var markdown = element.innerHTML; var options = { @@ -14,13 +13,8 @@ layui.use(['jquery', 'layer'], function () { Vditor.preview(element, markdown, options); - layer.ready(function () { - layer.load(1); - }); - setTimeout(function () { $(element).removeClass('layui-hide'); - layer.closeAll(); - }, 1000); + }, 500); }); \ No newline at end of file diff --git a/scheduler.php b/scheduler.php index d99cfc46..ddc820e2 100644 --- a/scheduler.php +++ b/scheduler.php @@ -52,7 +52,7 @@ $scheduler->php($script, $bin, ['--task' => 'revoke_vip', '--action' => 'main']) $scheduler->php($script, $bin, ['--task' => 'clean_token', '--action' => 'main']) ->daily(3, 17); -$scheduler->php($script, $bin, ['--task' => 'site_map', '--action' => 'main']) +$scheduler->php($script, $bin, ['--task' => 'sitemap', '--action' => 'main']) ->daily(4, 3); $scheduler->run(); \ No newline at end of file