diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b08b97c..60ec1de8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,18 @@ +### [v1.7.8](https://gitee.com/koogua/course-tencent-cloud/releases/v1.7.8)(2025-06-20) + +- 移除ThrottleLimit +- 增加CloseLiveTask +- 增加搜索页图片alt属性striptags过滤 +- 后台增加返回顶部快捷方式 +- 前台fixbar增加联系电话 +- 优化安装脚本 +- 优化课时列表直播提示 +- 优化后台返回链接 +- 优化统计分析代码位置 +- 直播回调后更新课时缓存 +- 后台清空头像->上传头像 +- sitemap.xml直接写入网站根目录 + ### [v1.7.7](https://gitee.com/koogua/course-tencent-cloud/releases/v1.7.7)(2025-04-20) - 优化索引管理工具 diff --git a/app/Console/Migrations/Migration.php b/app/Console/Migrations/Migration.php index dab29370..061db96c 100644 --- a/app/Console/Migrations/Migration.php +++ b/app/Console/Migrations/Migration.php @@ -18,6 +18,13 @@ abstract class Migration abstract public function run(); + protected function saveSettings(array $settings) + { + foreach ($settings as $setting) { + $this->saveSetting($setting); + } + } + protected function saveSetting(array $setting) { $settingRepo = new SettingRepo(); @@ -32,4 +39,4 @@ abstract class Migration } } -} \ No newline at end of file +} diff --git a/app/Console/Tasks/CloseLiveTask.php b/app/Console/Tasks/CloseLiveTask.php new file mode 100644 index 00000000..8cfd3d86 --- /dev/null +++ b/app/Console/Tasks/CloseLiveTask.php @@ -0,0 +1,72 @@ +findChapterLives(); + + echo sprintf('pending lives: %s', $chapterLives->count()) . PHP_EOL; + + if ($chapterLives->count() == 0) return; + + echo '------ start close live task ------' . PHP_EOL; + + foreach ($chapterLives as $chapterLive) { + + $chapterLive->status = ChapterLiveModel::STATUS_INACTIVE; + + $chapterLive->update(); + + $chapterRepo = new ChapterRepo(); + + $chapter = $chapterRepo->findById($chapterLive->chapter_id); + + $attrs = $chapter->attrs; + $attrs['stream']['status'] = ChapterModel::SS_INACTIVE; + $chapter->attrs = $attrs; + + $chapter->update(); + + $cache = new CourseChapterListCache(); + + $cache->rebuild($chapterLive->course_id); + } + + echo '------ end close live task ------' . PHP_EOL; + } + + /** + * 查找待关闭直播 + * + * @param int $limit + * @return ResultsetInterface|Resultset|ChapterLiveModel[] + */ + protected function findChapterLives(int $limit = 100) + { + $status = ChapterLiveModel::STATUS_ACTIVE; + $endTime = time() - 3600; + + return ChapterLiveModel::query() + ->where('status = :status:', ['status' => $status]) + ->andWhere('end_time < :end_time:', ['end_time' => $endTime]) + ->limit($limit) + ->execute(); + } + +} diff --git a/app/Console/Tasks/SitemapTask.php b/app/Console/Tasks/SitemapTask.php index a9e3324e..f617f8be 100644 --- a/app/Console/Tasks/SitemapTask.php +++ b/app/Console/Tasks/SitemapTask.php @@ -37,7 +37,7 @@ class SitemapTask extends Task $this->sitemap = new Sitemap(); - $filename = tmp_path('sitemap.xml'); + $filename = public_path('sitemap.xml'); echo '------ start sitemap task ------' . PHP_EOL; diff --git a/app/Http/Admin/Views/category/list.volt b/app/Http/Admin/Views/category/list.volt index 7e2efff7..837e4f26 100644 --- a/app/Http/Admin/Views/category/list.volt +++ b/app/Http/Admin/Views/category/list.volt @@ -9,7 +9,7 @@
{% if parent.id > 0 %} - 返回 + 返回 {{ parent.name }} {% endif %} 分类管理 @@ -87,4 +87,4 @@ -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/app/Http/Admin/Views/chapter/lessons.volt b/app/Http/Admin/Views/chapter/lessons.volt index 3650915a..3e813758 100644 --- a/app/Http/Admin/Views/chapter/lessons.volt +++ b/app/Http/Admin/Views/chapter/lessons.volt @@ -43,7 +43,7 @@
- 返回 + 返回 {{ course.title }} {{ chapter.title }} 课时管理 @@ -126,4 +126,4 @@ -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/app/Http/Admin/Views/course/chapters.volt b/app/Http/Admin/Views/course/chapters.volt index 2622ee59..1a653fff 100644 --- a/app/Http/Admin/Views/course/chapters.volt +++ b/app/Http/Admin/Views/course/chapters.volt @@ -9,7 +9,7 @@
- 返回 + 返回 {{ course.title }} 章节管理 @@ -79,4 +79,4 @@ -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/app/Http/Admin/Views/nav/list.volt b/app/Http/Admin/Views/nav/list.volt index 28a6a367..cb0e2bd6 100644 --- a/app/Http/Admin/Views/nav/list.volt +++ b/app/Http/Admin/Views/nav/list.volt @@ -25,9 +25,7 @@
{% if parent.id > 0 %} - - 返回 - + 返回 {{ parent.name }} {% endif %} 导航管理 diff --git a/app/Http/Admin/Views/user/edit.volt b/app/Http/Admin/Views/user/edit.volt index 47946487..f6403ff2 100644 --- a/app/Http/Admin/Views/user/edit.volt +++ b/app/Http/Admin/Views/user/edit.volt @@ -21,12 +21,11 @@
- + -
- +
@@ -153,6 +152,12 @@ {% endblock %} +{% block include_js %} + + {{ js_include('admin/js/avatar.upload.js') }} + +{% endblock %} + {% block inline_js %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/app/Http/Home/Views/account/register_by_email.volt b/app/Http/Home/Views/account/register_by_email.volt index f6c486d9..9a171a8d 100644 --- a/app/Http/Home/Views/account/register_by_email.volt +++ b/app/Http/Home/Views/account/register_by_email.volt @@ -36,6 +36,6 @@ {% else %}
- 邮箱注册已关闭 + 邮箱注册已关闭
-{% endif %} \ No newline at end of file +{% endif %} diff --git a/app/Http/Home/Views/account/register_by_phone.volt b/app/Http/Home/Views/account/register_by_phone.volt index 6a9322f8..d0a80261 100644 --- a/app/Http/Home/Views/account/register_by_phone.volt +++ b/app/Http/Home/Views/account/register_by_phone.volt @@ -36,6 +36,6 @@ {% else %}
- 手机注册已关闭 + 手机注册已关闭
-{% endif %} \ No newline at end of file +{% endif %} diff --git a/app/Http/Home/Views/course/show_catalog.volt b/app/Http/Home/Views/course/show_catalog.volt index 70594315..22b06e18 100644 --- a/app/Http/Home/Views/course/show_catalog.volt +++ b/app/Http/Home/Views/course/show_catalog.volt @@ -98,7 +98,7 @@ {% if lesson.attrs.stream.status == 'active' %} 直播中 {% elseif lesson.attrs.start_time > time() %} - 倒计时 + 倒计时 {% elseif lesson.attrs.end_time < time() %} 已结束 {% elseif lesson.attrs.stream.status == 'inactive' %} @@ -110,7 +110,7 @@ {% if lesson.attrs.start_time < time() and lesson.attrs.end_time > time() %} 授课中 {% elseif lesson.attrs.start_time > time() %} - 未开始 + 未开始 {% elseif lesson.attrs.end_time < time() %} 已结束 {% endif %} diff --git a/app/Http/Home/Views/search/article.volt b/app/Http/Home/Views/search/article.volt index 7c22ca7c..f2762acd 100644 --- a/app/Http/Home/Views/search/article.volt +++ b/app/Http/Home/Views/search/article.volt @@ -19,7 +19,7 @@ {% if item.cover %} {% endif %} diff --git a/app/Http/Home/Views/search/course.volt b/app/Http/Home/Views/search/course.volt index 73fe058d..1bc05420 100644 --- a/app/Http/Home/Views/search/course.volt +++ b/app/Http/Home/Views/search/course.volt @@ -6,7 +6,7 @@
diff --git a/app/Http/Home/Views/search/question.volt b/app/Http/Home/Views/search/question.volt index 4dec9446..02e48e93 100644 --- a/app/Http/Home/Views/search/question.volt +++ b/app/Http/Home/Views/search/question.volt @@ -19,7 +19,7 @@ {% if item.cover %} {% endif %} diff --git a/app/Http/Home/Views/templates/main.volt b/app/Http/Home/Views/templates/main.volt index 106c9b85..4dbe95c4 100644 --- a/app/Http/Home/Views/templates/main.volt +++ b/app/Http/Home/Views/templates/main.volt @@ -1,6 +1,9 @@ + {% if site_info.analytics_enabled == 1 %} + {{ site_info.analytics_script }} + {% endif %} @@ -38,12 +41,5 @@ {% block include_js %}{% endblock %} {% block inline_js %}{% endblock %} - -{% if site_info.analytics_enabled == 1 %} -
- {{ site_info.analytics_script }} -
-{% endif %} - - \ No newline at end of file + diff --git a/app/Library/AppInfo.php b/app/Library/AppInfo.php index 3165fc16..536def8e 100644 --- a/app/Library/AppInfo.php +++ b/app/Library/AppInfo.php @@ -16,7 +16,7 @@ class AppInfo protected $link = 'https://www.koogua.com'; - protected $version = '1.7.7'; + protected $version = '1.7.8'; public function __get($name) { diff --git a/app/Services/LiveNotify.php b/app/Services/LiveNotify.php index 5ae0554c..bee69c8e 100644 --- a/app/Services/LiveNotify.php +++ b/app/Services/LiveNotify.php @@ -7,7 +7,7 @@ namespace App\Services; -use App\Caches\CourseChapterList as CatalogCache; +use App\Caches\CourseChapterList as CourseChapterListCache; use App\Models\Chapter as ChapterModel; use App\Models\ChapterLive as ChapterLiveModel; use App\Repos\Chapter as ChapterRepo; @@ -175,7 +175,7 @@ class LiveNotify extends Service protected function rebuildCatalogCache(ChapterModel $chapter) { - $cache = new CatalogCache(); + $cache = new CourseChapterListCache(); $cache->rebuild($chapter->course_id); } @@ -216,4 +216,4 @@ class LiveNotify extends Service return $sign == $mySign; } -} \ No newline at end of file +} diff --git a/public/static/admin/js/avatar.upload.js b/public/static/admin/js/avatar.upload.js new file mode 100644 index 00000000..588f2b17 --- /dev/null +++ b/public/static/admin/js/avatar.upload.js @@ -0,0 +1,25 @@ +layui.use(['jquery', 'layer', 'upload'], function () { + + var $ = layui.jquery; + var layer = layui.layer; + var upload = layui.upload; + + upload.render({ + elem: '#change-avatar', + url: '/admin/upload/avatar/img', + accept: 'images', + acceptMime: 'image/*', + before: function () { + layer.load(); + }, + done: function (res, index, upload) { + $('#img-avatar').attr('src', res.data.url); + $('input[name=avatar]').val(res.data.url); + layer.closeAll('loading'); + }, + error: function (index, upload) { + layer.msg('上传文件失败', {icon: 2}); + } + }); + +}); diff --git a/public/static/home/css/common.css b/public/static/home/css/common.css index db3d9580..dfa419ed 100644 --- a/public/static/home/css/common.css +++ b/public/static/home/css/common.css @@ -1096,7 +1096,7 @@ color: orange; } -.lesson-item .flag-pending { +.lesson-item .flag-scheduled { border: 1px solid green; color: green; } diff --git a/public/static/home/js/fixbar.js b/public/static/home/js/fixbar.js index 831f471f..91d26f62 100644 --- a/public/static/home/js/fixbar.js +++ b/public/static/home/js/fixbar.js @@ -1,4 +1,4 @@ -layui.use(['jquery', 'helper', 'util'], function () { +layui.use(['jquery', 'util'], function () { var $ = layui.jquery; var util = layui.util; @@ -47,6 +47,19 @@ layui.use(['jquery', 'helper', 'util'], function () { }); } + var showPhoneCode = function () { + var content = '
'; + content += '' + window.contact.phone; + content += '
'; + layer.open({ + type: 1, + title: false, + closeBtn: 0, + shadeClose: true, + content: content, + }); + } + var bars = []; if (window.contact.wechat) { @@ -63,6 +76,13 @@ layui.use(['jquery', 'helper', 'util'], function () { }); } + if (window.contact.phone) { + bars.push({ + type: 'phone', + content: '', + }); + } + util.fixbar({ bars: bars, click: function (type) { @@ -70,24 +90,30 @@ layui.use(['jquery', 'helper', 'util'], function () { showWechatCode(); } else if (type === 'qq') { showQQCode(); + } else if (type === 'phone') { + showPhoneCode(); } } }); - $('.icon-wechat').on('click', function () { + $('.contact > .wechat').on('click', function () { showWechatCode(); }); - $('.icon-qq').on('click', function () { + $('.contact > .qq').on('click', function () { showQQCode(); }); - $('.icon-toutiao').on('click', function () { + $('.contact > .toutiao').on('click', function () { showTouTiaoCode(); }); - $('.icon-douyin').on('click', function () { + $('.contact > .douyin').on('click', function () { showDouYinCode(); }); -}); \ No newline at end of file + $('.contact > .phone').on('click', function () { + showPhoneCode(); + }); + +}); diff --git a/scheduler.php b/scheduler.php index f6556b56..01d4f573 100644 --- a/scheduler.php +++ b/scheduler.php @@ -63,6 +63,9 @@ $scheduler->php($script, $bin, ['--task' => 'sync_article_score', '--action' => $scheduler->php($script, $bin, ['--task' => 'sync_question_score', '--action' => 'main']) ->hourly(29); +$scheduler->php($script, $bin, ['--task' => 'close_live', '--action' => 'main']) + ->hourly(31); + $scheduler->php($script, $bin, ['--task' => 'clean_log', '--action' => 'main']) ->daily(3, 3);