diff --git a/CHANGELOG.md b/CHANGELOG.md index 5bfc3bb1..00dd33e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,17 @@ +### [v1.3.2](https://gitee.com/koogua/course-tencent-cloud/releases/v1.3.2)(2021-04-20) + +### 更新 + +- 前台增文章和章节评论功能 +- 后台增加评论相关管理功能 +- 优化课程,章节,文章等前台界面 +- 优化分享链接的生成和跳转方式 +- 优化课程,章节,文章相关js +- 优化后台数据展示 +- 修正后台分类二级分类错位问题 +- 修正文章命名空间问题 +- 修正后台轮播没有保存问题 + ### [v1.3.1](https://gitee.com/koogua/course-tencent-cloud/releases/v1.3.1)(2021-04-09) ### 更新 diff --git a/app/Http/Admin/Views/article/list.volt b/app/Http/Admin/Views/article/list.volt index 4dde3172..3e7f8cfd 100644 --- a/app/Http/Admin/Views/article/list.volt +++ b/app/Http/Admin/Views/article/list.volt @@ -32,14 +32,16 @@ + 文章 - 来源 - 作者 - 统计 + 浏览 + 评论 + 点赞 + 收藏 推荐 评论 发布 @@ -48,6 +50,7 @@ {% for item in pager.items %} + {% set owner_url = url({'for':'home.user.show','id':item.owner.id}) %} {% set preview_url = url({'for':'home.article.show','id':item.id}) %} {% set edit_url = url({'for':'admin.article.edit','id':item.id}) %} {% set update_url = url({'for':'admin.article.update','id':item.id}) %} @@ -65,17 +68,16 @@ 标签:{{ tags_info(item.tags) }} {% endif %}

-

创建:{{ date('Y-m-d H:i',item.create_time) }},更新:{{ date('Y-m-d H:i',item.update_time) }}

- - {{ source_info(item.source_type,item.source_url) }} - -

昵称:{{ item.owner.name }}

-

编号:{{ item.owner.id }}

- - -

浏览:{{ item.view_count }},评论:{{ item.comment_count }}

-

点赞:{{ item.like_count }},收藏:{{ item.favorite_count }}

+

+ 来源:{{ source_info(item.source_type,item.source_url) }} + 作者:{{ item.owner.name }} + 创建:{{ date('Y-m-d',item.create_time) }} +

+ {{ item.view_count }} + {{ item.comment_count }} + {{ item.like_count }} + {{ item.favorite_count }} diff --git a/app/Http/Admin/Views/chapter/edit_lesson.volt b/app/Http/Admin/Views/chapter/edit_lesson.volt index 9f4e98ab..8d9bd066 100644 --- a/app/Http/Admin/Views/chapter/edit_lesson.volt +++ b/app/Http/Admin/Views/chapter/edit_lesson.volt @@ -22,7 +22,7 @@
diff --git a/app/Http/Admin/Views/chapter/edit_resource.volt b/app/Http/Admin/Views/chapter/edit_resource.volt index 2aefec6f..e2c860c9 100644 --- a/app/Http/Admin/Views/chapter/edit_resource.volt +++ b/app/Http/Admin/Views/chapter/edit_resource.volt @@ -12,7 +12,6 @@
-
选择文件 diff --git a/app/Http/Admin/Views/chapter/lessons.volt b/app/Http/Admin/Views/chapter/lessons.volt index f4d22162..861ca1a3 100644 --- a/app/Http/Admin/Views/chapter/lessons.volt +++ b/app/Http/Admin/Views/chapter/lessons.volt @@ -63,6 +63,16 @@ }); }); + $('.kg-comment').on('click', function () { + var url = $(this).data('url'); + layer.open({ + type: 2, + title: '评论管理', + area: ['1000px', '600px'], + content: url + }); + }); + }); diff --git a/app/Http/Admin/Views/chapter/lessons_live.volt b/app/Http/Admin/Views/chapter/lessons_live.volt index 8ecd0f97..88d3749a 100644 --- a/app/Http/Admin/Views/chapter/lessons_live.volt +++ b/app/Http/Admin/Views/chapter/lessons_live.volt @@ -26,14 +26,20 @@ - + + + + 编号 名称 + 课件 + 点赞 + 评论 直播时间 - 推流状态 + 推流 排序 免费 发布 @@ -50,9 +56,12 @@ {{ item.id }} - {{ item.title }} + {{ item.title }} + {{ item.resource_count }} + {{ item.like_count }} + {{ item.comment_count }} {{ live_time_info(item.attrs) }} {{ live_status_info(item.attrs['stream']['status']) }} diff --git a/app/Http/Admin/Views/chapter/lessons_read.volt b/app/Http/Admin/Views/chapter/lessons_read.volt index e5fdacb0..bef1af3c 100644 --- a/app/Http/Admin/Views/chapter/lessons_read.volt +++ b/app/Http/Admin/Views/chapter/lessons_read.volt @@ -6,13 +6,17 @@ - + + + 编号 名称 - 字数 + 课件 + 点赞 + 评论 排序 免费 发布 @@ -26,13 +30,18 @@ {% set update_url = url({'for':'admin.chapter.update','id':item.id}) %} {% set delete_url = url({'for':'admin.chapter.delete','id':item.id}) %} {% set restore_url = url({'for':'admin.chapter.restore','id':item.id}) %} + {% set comment_url = url({'for':'admin.comment.list'},{'item_id':item.id,'item_type':1}) %} {{ item.id }} - {{ item.title }} - +

+ {{ item.title }} + +

- {{ item.attrs['word_count'] }} + {{ item.resource_count }} + {{ item.like_count }} + {{ item.comment_count }} @@ -47,6 +56,8 @@ {% else %}
  • 还原
  • {% endif %} +
    +
  • 评论管理
  • diff --git a/app/Http/Admin/Views/chapter/lessons_vod.volt b/app/Http/Admin/Views/chapter/lessons_vod.volt index 838017da..6fa43f3d 100644 --- a/app/Http/Admin/Views/chapter/lessons_vod.volt +++ b/app/Http/Admin/Views/chapter/lessons_vod.volt @@ -1,14 +1,14 @@ {%- macro file_status(value) %} {% if value == 'pending' %} - 待上传 + 待上传 {% elseif value == 'uploaded' %} - 已上传 + 已上传 {% elseif value == 'translating' %} - 转码中 + 转码中 {% elseif value == 'translated' %} - 已转码 + 已转码 {% elseif value == 'failed' %} - 已失败 + 已失败 {% endif %} {%- endmacro %} @@ -21,14 +21,19 @@ + + + 编号 名称 - 状态 - 时长 + 课件 + 学员 + 点赞 + 评论 排序 免费 发布 @@ -42,14 +47,23 @@ {% set update_url = url({'for':'admin.chapter.update','id':item.id}) %} {% set delete_url = url({'for':'admin.chapter.delete','id':item.id}) %} {% set restore_url = url({'for':'admin.chapter.restore','id':item.id}) %} + {% set comment_url = url({'for':'admin.comment.list'},{'item_id':item.id,'item_type':1}) %} {{ item.id }} - {{ item.title }} - +

    + {{ item.title }} + +

    +

    + 状态:{{ file_status(item.attrs['file']['status']) }} + 时长:{{ item.attrs['duration']|duration }} +

    - {{ file_status(item.attrs['file']['status']) }} - {{ item.attrs['duration']|duration }} + {{ item.resource_count }} + {{ item.user_count }} + {{ item.like_count }} + {{ item.comment_count }} @@ -64,6 +78,8 @@ {% else %}
  • 还原
  • {% endif %} +
    +
  • 评论管理
  • diff --git a/app/Http/Admin/Views/course/chapters.volt b/app/Http/Admin/Views/course/chapters.volt index 080d2269..32b117fc 100644 --- a/app/Http/Admin/Views/course/chapters.volt +++ b/app/Http/Admin/Views/course/chapters.volt @@ -26,13 +26,21 @@ - + + + + + 编号 名称 - 课时数 + 课时 + 课件 + 学员 + 点赞 + 评论 排序 操作 @@ -50,11 +58,11 @@ {{ item.title }} - - - {{ item.lesson_count }} - - + {{ item.lesson_count }} + {{ item.resource_count }} + {{ item.user_count }} + {{ item.like_count }} + {{ item.comment_count }}
    diff --git a/app/Http/Admin/Views/course/list.volt b/app/Http/Admin/Views/course/list.volt index 7a7982bc..03faed20 100644 --- a/app/Http/Admin/Views/course/list.volt +++ b/app/Http/Admin/Views/course/list.volt @@ -32,14 +32,20 @@ + + + 课程 - 类型 - 课时数 - 用户数 + 课时 + 课件 + 学员 + 收藏 + 咨询 + 评价 价格 推荐 发布 @@ -69,22 +75,22 @@ {% endif %} 难度:{{ level_info(item.level) }}

    +

    + 类型:{{ model_info(item.model) }} + 评分:{{ item.rating }} + 创建:{{ date('Y-m-d',item.create_time) }} +

    - {{ model_info(item.model) }} + {{ item.lesson_count }} + {{ item.resource_count }} + {{ item.user_count }} + {{ item.favorite_count }} + {{ item.consult_count }} + {{ item.review_count }} - - {{ item.lesson_count }} - - - - - {{ item.user_count }} - - - -

    原始价:{{ '¥%0.2f'|format(item.origin_price) }}

    -

    市场价:{{ '¥%0.2f'|format(item.market_price) }}

    -

    会员价:{{ '¥%0.2f'|format(item.vip_price) }}

    +

    原始:{{ '¥%0.2f'|format(item.origin_price) }}

    +

    市场:{{ '¥%0.2f'|format(item.market_price) }}

    +

    会员:{{ '¥%0.2f'|format(item.vip_price) }}

    diff --git a/app/Http/Admin/Views/im/group/list.volt b/app/Http/Admin/Views/im/group/list.volt index 02d07b93..c74a0780 100644 --- a/app/Http/Admin/Views/im/group/list.volt +++ b/app/Http/Admin/Views/im/group/list.volt @@ -25,7 +25,6 @@ - @@ -38,7 +37,6 @@ - @@ -56,15 +54,23 @@ - + -
    头像 名称 群主类型 成员 发布 操作 {{ item.name }} {{ item.name }}({{ item.id }}) +

    + 名称:{{ item.name }}({{ item.id }}) +

    +

    + 类型:{{ type_info(item.type) }} + 创建:{{ date('Y-m-d',item.create_time) }} +

    +
    {% if item.owner.id is defined %} - {{ item.owner.name }}({{ item.owner.id }}) +

    昵称:{{ item.owner.name }}

    +

    编号:{{ item.owner.id }}

    {% else %} N/A {% endif %}
    {{ type_info(item.type) }} {{ item.user_count }} diff --git a/app/Http/Admin/Views/macros/article.volt b/app/Http/Admin/Views/macros/article.volt index 0c025121..fad0df84 100644 --- a/app/Http/Admin/Views/macros/article.volt +++ b/app/Http/Admin/Views/macros/article.volt @@ -1,12 +1,12 @@ {%- macro source_info(type,url) %} {% if type == 1 %} - 原创 + 原创 {% elseif type == 2 %} 转载 {% elseif type == 3 %} - 翻译 + 翻译 {% else %} - N/A + N/A {% endif %} {%- endmacro %} diff --git a/app/Http/Admin/Views/user/list.volt b/app/Http/Admin/Views/user/list.volt index 551163d9..a9ff78cd 100644 --- a/app/Http/Admin/Views/user/list.volt +++ b/app/Http/Admin/Views/user/list.volt @@ -25,7 +25,8 @@ - + + @@ -38,9 +39,10 @@ - - + + + @@ -54,15 +56,24 @@ - - - + - - + + + + +
    用户头像 用户昵称所在地区用户性别 用户角色课程文章收藏 活跃时间 注册时间 操作 {{ item.name }} {{ item.name }}({{ item.id }}){{ status_info(item) }}{{ item.area }}{{ gender_info(item.gender) }} +

    + {{ item.name }}({{ item.id }}){{ status_info(item) }} +

    +

    + 性别:{{ gender_info(item.gender) }} + 地区:{{ item.area|default('N/A') }} +

    +

    教学:{{ edu_role_info(item.edu_role) }}

    后台:{{ admin_role_info(item.admin_role) }}

    {{ date('Y-m-d H:i:s',item.active_time) }}{{ date('Y-m-d H:i:s',item.create_time) }}{{ item.course_count }}{{ item.article_count }}{{ item.favorite_count }}{{ date('Y-m-d',item.active_time) }}{{ date('Y-m-d',item.create_time) }}
    diff --git a/app/Http/Home/Services/ShareUrl.php b/app/Http/Home/Services/ShareUrl.php index 4c5dd0c5..134f0989 100644 --- a/app/Http/Home/Services/ShareUrl.php +++ b/app/Http/Home/Services/ShareUrl.php @@ -120,7 +120,7 @@ class ShareUrl extends Service $webUrl = $this->webBaseUrl . $route; - $h5Url = sprintf('%s/user/info?id=%s&referer=%s', $this->h5BaseUrl, $id, $referer); + $h5Url = sprintf('%s/user/index?id=%s&referer=%s', $this->h5BaseUrl, $id, $referer); return ['web' => $webUrl, 'h5' => $h5Url]; } diff --git a/app/Library/AppInfo.php b/app/Library/AppInfo.php index 3e782a98..3639ff96 100644 --- a/app/Library/AppInfo.php +++ b/app/Library/AppInfo.php @@ -11,7 +11,7 @@ class AppInfo protected $link = 'https://koogua.com'; - protected $version = '1.3.1'; + protected $version = '1.3.2'; public function __get($name) { diff --git a/app/Models/Course.php b/app/Models/Course.php index 4d04ed3e..d8c50fed 100644 --- a/app/Models/Course.php +++ b/app/Models/Course.php @@ -164,7 +164,7 @@ class Course extends Model * * @var float */ - public $rating = 0.00; + public $rating = 5.00; /** * 综合得分 diff --git a/app/Services/Logic/Chapter/ChapterInfo.php b/app/Services/Logic/Chapter/ChapterInfo.php index dbf0d66e..938d3d16 100644 --- a/app/Services/Logic/Chapter/ChapterInfo.php +++ b/app/Services/Logic/Chapter/ChapterInfo.php @@ -194,6 +194,13 @@ class ChapterInfo extends LogicService $chapter->user_count += 1; $chapter->update(); + + $parent = $this->checkChapter($chapter->parent_id); + + $parent->user_count += 1; + + $parent->update(); + } protected function incrGroupUserCount(ImGroupModel $group) diff --git a/app/Services/Logic/Chapter/ChapterLike.php b/app/Services/Logic/Chapter/ChapterLike.php index ff6faf72..57424145 100644 --- a/app/Services/Logic/Chapter/ChapterLike.php +++ b/app/Services/Logic/Chapter/ChapterLike.php @@ -64,6 +64,12 @@ class ChapterLike extends LogicService $chapter->like_count += 1; $chapter->update(); + + $parent = $this->checkChapter($chapter->parent_id); + + $parent->like_count += 1; + + $parent->update(); } protected function decrChapterLikeCount(ChapterModel $chapter) @@ -72,6 +78,13 @@ class ChapterLike extends LogicService $chapter->like_count -= 1; $chapter->update(); } + + $parent = $this->checkChapter($chapter->parent_id); + + if ($parent->like_count > 0) { + $parent->like_count -= 1; + $parent->update(); + } } protected function incrUserDailyChapterLikeCount(UserModel $user) diff --git a/app/Services/Logic/Comment/CommentCountTrait.php b/app/Services/Logic/Comment/CommentCountTrait.php index 4973e553..1bdfc499 100644 --- a/app/Services/Logic/Comment/CommentCountTrait.php +++ b/app/Services/Logic/Comment/CommentCountTrait.php @@ -24,6 +24,12 @@ trait CommentCountTrait $chapter->comment_count += 1; $chapter->update(); + + $parent = $this->checkChapter($chapter->parent_id); + + $parent->comment_count += 1; + + $parent->update(); } protected function incrArticleCommentCount(ArticleModel $article) @@ -47,6 +53,13 @@ trait CommentCountTrait $chapter->comment_count -= 1; $chapter->update(); } + + $parent = $this->checkChapter($chapter->parent_id); + + if ($parent->comment_count > 0) { + $parent->comment_count -= 1; + $parent->update(); + } } protected function decrArticleCommentCount(ArticleModel $article) diff --git a/app/Services/Logic/Comment/CommentCreate.php b/app/Services/Logic/Comment/CommentCreate.php index 02c59a11..4c7c54e4 100644 --- a/app/Services/Logic/Comment/CommentCreate.php +++ b/app/Services/Logic/Comment/CommentCreate.php @@ -6,6 +6,7 @@ use App\Models\Comment as CommentModel; use App\Services\Logic\ArticleTrait; use App\Services\Logic\ChapterTrait; use App\Services\Logic\Service as LogicService; +use App\Traits\Client as ClientTrait; use App\Validators\Comment as CommentValidator; use App\Validators\UserLimit as UserLimitValidator; @@ -14,6 +15,7 @@ class CommentCreate extends LogicService use ArticleTrait; use ChapterTrait; + use ClientTrait; use CommentCountTrait; public function handle() @@ -40,6 +42,8 @@ class CommentCreate extends LogicService ]; $data['content'] = $validator->checkContent($post['content']); + $data['client_type'] = $this->getClientType(); + $data['client_ip'] = $this->getClientIp(); if ($post['item_type'] == CommentModel::ITEM_CHAPTER) { diff --git a/app/Services/Logic/Comment/CommentReply.php b/app/Services/Logic/Comment/CommentReply.php index dfd4f1ab..fc31d0fe 100644 --- a/app/Services/Logic/Comment/CommentReply.php +++ b/app/Services/Logic/Comment/CommentReply.php @@ -7,6 +7,7 @@ use App\Services\Logic\ArticleTrait; use App\Services\Logic\ChapterTrait; use App\Services\Logic\CommentTrait; use App\Services\Logic\Service as LogicService; +use App\Traits\Client as ClientTrait; use App\Validators\Comment as CommentValidator; use App\Validators\UserLimit as UserLimitValidator; @@ -15,6 +16,7 @@ class CommentReply extends LogicService use ArticleTrait; use ChapterTrait; + use ClientTrait; use CommentTrait; use CommentCountTrait; @@ -49,6 +51,8 @@ class CommentReply extends LogicService } $data['content'] = $validator->checkContent($post['content']); + $data['client_type'] = $this->getClientType(); + $data['client_ip'] = $this->getClientIp(); $comment = new CommentModel();