1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-22 11:41:27 +08:00
This commit is contained in:
koogua 2021-04-20 21:16:48 +08:00
parent 6e4711e3bb
commit 1778b25c25
21 changed files with 210 additions and 77 deletions

View File

@ -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)
### 更新

View File

@ -32,14 +32,16 @@
<col>
<col>
<col>
<col>
<col width="10%">
</colgroup>
<thead>
<tr>
<th>文章</th>
<th>来源</th>
<th>作者</th>
<th>统计</th>
<th>浏览</th>
<th>评论</th>
<th>点赞</th>
<th>收藏</th>
<th>推荐</th>
<th>评论</th>
<th>发布</th>
@ -48,6 +50,7 @@
</thead>
<tbody>
{% 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 @@
<span>标签:{{ tags_info(item.tags) }}</span>
{% endif %}
</p>
<p>创建:{{ date('Y-m-d H:i',item.create_time) }},更新:{{ date('Y-m-d H:i',item.update_time) }}</p>
</td>
<td>{{ source_info(item.source_type,item.source_url) }}</td>
<td>
<p>昵称:{{ item.owner.name }}</p>
<p>编号:{{ item.owner.id }}</p>
</td>
<td>
<p>浏览:{{ item.view_count }},评论:{{ item.comment_count }}</p>
<p>点赞:{{ item.like_count }},收藏:{{ item.favorite_count }}</p>
<p class="meta">
<span>来源:{{ source_info(item.source_type,item.source_url) }}</span>
<span>作者:<a href="{{ owner_url }}" target="_blank">{{ item.owner.name }}</a></span>
<span>创建:{{ date('Y-m-d',item.create_time) }}</span>
</p>
</td>
<td>{{ item.view_count }}</td>
<td>{{ item.comment_count }}</td>
<td>{{ item.like_count }}</td>
<td>{{ item.favorite_count }}</td>
<td><input type="checkbox" name="featured" value="1" lay-skin="switch" lay-text="是|否" lay-filter="featured" data-url="{{ update_url }}" {% if item.featured == 1 %}checked="checked"{% endif %}></td>
<td><input type="checkbox" name="comment" value="1" lay-skin="switch" lay-text="开|关" lay-filter="comment" data-url="{{ update_url }}" {% if item.allow_comment == 1 %}checked="checked"{% endif %}></td>
<td><input type="checkbox" name="published" value="1" lay-skin="switch" lay-text="是|否" lay-filter="published" data-url="{{ update_url }}" {% if item.published == 1 %}checked="checked"{% endif %}></td>

View File

@ -22,7 +22,7 @@
<ul class="layui-tab-title kg-tab-title">
<li class="layui-this">基本信息</li>
<li>{{ content_title(course.model) }}</li>
<li>学习资料</li>
<li>课件资料</li>
</ul>
<div class="layui-tab-content">
<div class="layui-tab-item layui-show">

View File

@ -12,7 +12,6 @@
<form class="layui-form kg-form" id="res-form">
<div class="layui-form-item" id="res-upload-block">
<label class="layui-form-label">资源文件</label>
<div class="layui-input-block">
<span class="layui-btn" id="res-upload-btn">选择文件</span>
<input class="layui-hide" type="file" name="res_file" accept="*/*">

View File

@ -63,6 +63,16 @@
});
});
$('.kg-comment').on('click', function () {
var url = $(this).data('url');
layer.open({
type: 2,
title: '评论管理',
area: ['1000px', '600px'],
content: url
});
});
});
</script>

View File

@ -26,14 +26,20 @@
<col>
<col>
<col>
<col width="12%">
<col>
<col>
<col>
<col width="10%">
</colgroup>
<thead>
<tr>
<th>编号</th>
<th>名称</th>
<th>课件</th>
<th>点赞</th>
<th>评论</th>
<th>直播时间</th>
<th>推流状态</th>
<th>推流</th>
<th>排序</th>
<th>免费</th>
<th>发布</th>
@ -50,9 +56,12 @@
<tr>
<td>{{ item.id }}</td>
<td>
<span><a href="{{ edit_url }}">{{ item.title }}</a></span>
<a href="{{ edit_url }}">{{ item.title }}</a>
<span class="layui-badge layui-bg-green">课</span>
</td>
<td>{{ item.resource_count }}</td>
<td>{{ item.like_count }}</td>
<td>{{ item.comment_count }}</td>
<td>{{ live_time_info(item.attrs) }}</td>
<td>{{ live_status_info(item.attrs['stream']['status']) }}</td>
<td><input class="layui-input kg-priority" type="text" name="priority" title="数值越小排序越靠前" value="{{ item.priority }}" data-url="{{ update_url }}"></td>

View File

@ -6,13 +6,17 @@
<col>
<col>
<col>
<col width="12%">
<col>
<col>
<col width="10%">
</colgroup>
<thead>
<tr>
<th>编号</th>
<th>名称</th>
<th>字数</th>
<th>课件</th>
<th>点赞</th>
<th>评论</th>
<th>排序</th>
<th>免费</th>
<th>发布</th>
@ -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}) %}
<tr>
<td>{{ item.id }}</td>
<td>
<span><a href="{{ edit_url }}">{{ item.title }}</a></span>
<span class="layui-badge layui-bg-green">课</span>
<p>
<a href="{{ edit_url }}">{{ item.title }}</a>
<span class="layui-badge layui-bg-green">课</span>
</p>
</td>
<td><span class="layui-badge layui-bg-gray">{{ item.attrs['word_count'] }}</span></td>
<td>{{ item.resource_count }}</td>
<td>{{ item.like_count }}</td>
<td>{{ item.comment_count }}</td>
<td><input class="layui-input kg-priority" type="text" name="priority" title="数值越小排序越靠前" value="{{ item.priority }}" data-url="{{ update_url }}"></td>
<td><input type="checkbox" name="free" value="1" lay-skin="switch" lay-text="是|否" lay-filter="free" data-url="{{ update_url }}" {% if item.free == 1 %}checked="checked"{% endif %}></td>
<td><input type="checkbox" name="published" value="1" lay-skin="switch" lay-text="是|否" lay-filter="published" data-url="{{ update_url }}" {% if item.published == 1 %}checked="checked"{% endif %}></td>
@ -47,6 +56,8 @@
{% else %}
<li><a href="javascript:" class="kg-restore" data-url="{{ restore_url }}">还原</a></li>
{% endif %}
<hr>
<li><a href="javascript:" class="kg-comment" data-url="{{ comment_url }}">评论管理</a></li>
</ul>
</div>
</td>

View File

@ -1,14 +1,14 @@
{%- macro file_status(value) %}
{% if value == 'pending' %}
<span class="layui-badge layui-bg-gray">待上传</span>
待上传
{% elseif value == 'uploaded' %}
<span class="layui-badge layui-bg-black">已上传</span>
已上传
{% elseif value == 'translating' %}
<span class="layui-badge layui-bg-blue">转码中</span>
转码中
{% elseif value == 'translated' %}
<span class="layui-badge layui-bg-green">已转码</span>
已转码
{% elseif value == 'failed' %}
<span class="layui-badge layui-bg-red">已失败</span>
已失败
{% endif %}
{%- endmacro %}
@ -21,14 +21,19 @@
<col>
<col>
<col>
<col>
<col>
<col>
<col width="10%">
</colgroup>
<thead>
<tr>
<th>编号</th>
<th>名称</th>
<th>状态</th>
<th>时长</th>
<th>课件</th>
<th>学员</th>
<th>点赞</th>
<th>评论</th>
<th>排序</th>
<th>免费</th>
<th>发布</th>
@ -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}) %}
<tr>
<td>{{ item.id }}</td>
<td>
<span><a href="{{ edit_url }}">{{ item.title }}</a></span>
<span class="layui-badge layui-bg-green">课</span>
<p>
<a href="{{ edit_url }}">{{ item.title }}</a>
<span class="layui-badge layui-bg-green">课</span>
</p>
<p class="meta">
<span>状态:{{ file_status(item.attrs['file']['status']) }}</span>
<span>时长:{{ item.attrs['duration']|duration }}</span>
</p>
</td>
<td>{{ file_status(item.attrs['file']['status']) }}</td>
<td>{{ item.attrs['duration']|duration }}</td>
<td>{{ item.resource_count }}</td>
<td>{{ item.user_count }}</td>
<td>{{ item.like_count }}</td>
<td>{{ item.comment_count }}</td>
<td><input class="layui-input kg-priority" type="text" name="priority" title="数值越小排序越靠前" value="{{ item.priority }}" data-url="{{ update_url }}"></td>
<td><input type="checkbox" name="free" value="1" lay-skin="switch" lay-text="是|否" lay-filter="free" data-url="{{ update_url }}" {% if item.free == 1 %}checked="checked"{% endif %}></td>
<td><input type="checkbox" name="published" value="1" lay-skin="switch" lay-text="是|否" lay-filter="published" data-url="{{ update_url }}" {% if item.published == 1 %}checked="checked"{% endif %}></td>
@ -64,6 +78,8 @@
{% else %}
<li><a href="javascript:" class="kg-restore" data-url="{{ restore_url }}">还原</a></li>
{% endif %}
<hr>
<li><a href="javascript:" class="kg-comment" data-url="{{ comment_url }}">评论管理</a></li>
</ul>
</div>
</td>

View File

@ -26,13 +26,21 @@
<col>
<col>
<col>
<col width="12%">
<col>
<col>
<col>
<col>
<col width="10%">
</colgroup>
<thead>
<tr>
<th>编号</th>
<th>名称</th>
<th>课时数</th>
<th>课时</th>
<th>课件</th>
<th>学员</th>
<th>点赞</th>
<th>评论</th>
<th>排序</th>
<th>操作</th>
</tr>
@ -50,11 +58,11 @@
<a href="{{ child_url }}">{{ item.title }}</a>
<span class="layui-badge layui-bg-green">章</span>
</td>
<td>
<a href="{{ child_url }}">
<span class="layui-badge layui-bg-green">{{ item.lesson_count }}</span>
</a>
</td>
<td>{{ item.lesson_count }}</td>
<td>{{ item.resource_count }}</td>
<td>{{ item.user_count }}</td>
<td>{{ item.like_count }}</td>
<td>{{ item.comment_count }}</td>
<td><input class="layui-input kg-priority" type="text" name="priority" value="{{ item.priority }}" data-url="{{ update_url }}"></td>
<td class="center">
<div class="layui-dropdown">

View File

@ -32,14 +32,20 @@
<col>
<col>
<col>
<col>
<col>
<col>
<col width="10%">
</colgroup>
<thead>
<tr>
<th>课程</th>
<th>类型</th>
<th>课时数</th>
<th>用户数</th>
<th>课时</th>
<th>课件</th>
<th>学员</th>
<th>收藏</th>
<th>咨询</th>
<th>评价</th>
<th>价格</th>
<th>推荐</th>
<th>发布</th>
@ -69,22 +75,22 @@
{% endif %}
<span>难度:{{ level_info(item.level) }}</span>
</p>
<p class="meta">
<span>类型:{{ model_info(item.model) }}</span>
<span>评分:{{ item.rating }}</span>
<span>创建:{{ date('Y-m-d',item.create_time) }}</span>
</p>
</td>
<td>{{ model_info(item.model) }}</td>
<td>{{ item.lesson_count }}</td>
<td>{{ item.resource_count }}</td>
<td>{{ item.user_count }}</td>
<td>{{ item.favorite_count }}</td>
<td>{{ item.consult_count }}</td>
<td>{{ item.review_count }}</td>
<td>
<a href="{{ catalog_url }}">
<span class="layui-badge layui-bg-green">{{ item.lesson_count }}</span>
</a>
</td>
<td>
<a href="{{ student_url }}">
<span class="layui-badge layui-bg-green">{{ item.user_count }}</span>
</a>
</td>
<td>
<p>原始价:{{ '¥%0.2f'|format(item.origin_price) }}</p>
<p>市场价:{{ '¥%0.2f'|format(item.market_price) }}</p>
<p>会员价:{{ '¥%0.2f'|format(item.vip_price) }}</p>
<p>原始:{{ '¥%0.2f'|format(item.origin_price) }}</p>
<p>市场:{{ '¥%0.2f'|format(item.market_price) }}</p>
<p>会员:{{ '¥%0.2f'|format(item.vip_price) }}</p>
</td>
<td><input type="checkbox" name="featured" value="1" lay-skin="switch" lay-text="是|否" lay-filter="featured" data-url="{{ update_url }}" {% if item.featured == 1 %}checked="checked"{% endif %}></td>
<td><input type="checkbox" name="published" value="1" lay-skin="switch" lay-text="是|否" lay-filter="published" data-url="{{ update_url }}" {% if item.published == 1 %}checked="checked"{% endif %}></td>

View File

@ -25,7 +25,6 @@
<table class="kg-table layui-table layui-form">
<colgroup>
<col width="10%">
<col>
<col>
<col>
@ -38,7 +37,6 @@
<th>头像</th>
<th>名称</th>
<th>群主</th>
<th>类型</th>
<th>成员</th>
<th>发布</th>
<th>操作</th>
@ -56,15 +54,23 @@
<td class="center">
<img class="avatar-sm" src="{{ item.avatar }}!avatar_160" alt="{{ item.name }}">
</td>
<td><a href="{{ preview_url }}" title="{{ item.about }}" target="_blank">{{ item.name }}</a>{{ item.id }}</td>
<td>
<p>
名称:<a href="{{ preview_url }}" title="{{ item.about }}" target="_blank">{{ item.name }}</a>{{ item.id }}
</p>
<p class="meta">
<span>类型:{{ type_info(item.type) }}</span>
<span>创建:{{ date('Y-m-d',item.create_time) }}</span>
</p>
</td>
<td>
{% if item.owner.id is defined %}
<a href="{{ url({'for':'home.user.show','id':item.owner.id}) }}" target="_blank">{{ item.owner.name }}</a>{{ item.owner.id }}
<p>昵称:<a href="{{ url({'for':'home.user.show','id':item.owner.id}) }}" target="_blank">{{ item.owner.name }}</a></p>
<p>编号:{{ item.owner.id }}</p>
{% else %}
N/A
{% endif %}
</td>
<td> {{ type_info(item.type) }}</td>
<td><a href="{{ users_url }}" class="layui-badge layui-bg-green">{{ item.user_count }}</a></td>
<td><input type="checkbox" name="published" value="1" lay-filter="published" lay-skin="switch" lay-text="是|否" data-url="{{ update_url }}" {% if item.published == 1 %}checked="checked"{% endif %}></td>
<td class="center">

View File

@ -1,12 +1,12 @@
{%- macro source_info(type,url) %}
{% if type == 1 %}
<span>原创</span>
原创
{% elseif type == 2 %}
<a href="{{ url }}" target="_blank">转载</a>
{% elseif type == 3 %}
<span>翻译</span>
翻译
{% else %}
<span>N/A</span>
N/A
{% endif %}
{%- endmacro %}

View File

@ -25,7 +25,8 @@
<table class="layui-table kg-table">
<colgroup>
<col width="10%">
<col>
<col>
<col>
<col>
<col>
@ -38,9 +39,10 @@
<tr>
<th>用户头像</th>
<th>用户昵称</th>
<th>所在地区</th>
<th>用户性别</th>
<th>用户角色</th>
<th>课程</th>
<th>文章</th>
<th>收藏</th>
<th>活跃时间</th>
<th>注册时间</th>
<th>操作</th>
@ -54,15 +56,24 @@
<td class="center">
<img class="avatar-sm" src="{{ item.avatar }}!avatar_160" alt="{{ item.name }}">
</td>
<td><a href="{{ preview_url }}" title="{{ item.about }}" target="_blank">{{ item.name }}</a>{{ item.id }}{{ status_info(item) }}</td>
<td>{{ item.area }}</td>
<td>{{ gender_info(item.gender) }}</td>
<td>
<p>
<a href="{{ preview_url }}" title="{{ item.about }}" target="_blank">{{ item.name }}</a>{{ item.id }}{{ status_info(item) }}
</p>
<p class="meta">
<span>性别:{{ gender_info(item.gender) }}</span>
<span>地区:{{ item.area|default('N/A') }}</span>
</p>
</td>
<td>
<p>教学:{{ edu_role_info(item.edu_role) }}</p>
<p>后台:{{ admin_role_info(item.admin_role) }}</p>
</td>
<td>{{ date('Y-m-d H:i:s',item.active_time) }}</td>
<td>{{ date('Y-m-d H:i:s',item.create_time) }}</td>
<td>{{ item.course_count }}</td>
<td>{{ item.article_count }}</td>
<td>{{ item.favorite_count }}</td>
<td>{{ date('Y-m-d',item.active_time) }}</td>
<td>{{ date('Y-m-d',item.create_time) }}</td>
<td class="center">
<div class="layui-dropdown">
<button class="layui-btn layui-btn-sm">操作 <i class="layui-icon layui-icon-triangle-d"></i></button>

View File

@ -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];
}

View File

@ -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)
{

View File

@ -164,7 +164,7 @@ class Course extends Model
*
* @var float
*/
public $rating = 0.00;
public $rating = 5.00;
/**
* 综合得分

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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) {

View File

@ -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();