diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1dae06da..0acff682 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,15 @@
+### [v1.4.3](https://gitee.com/koogua/course-tencent-cloud/releases/v1.4.3)(2021-08-23)
+
+- 优化邮件验证码
+- 优化logo和favicon上传
+- 优化api验证码中使用的ticket和rand
+- 优化点播和直播地址获取
+- 修复部分清晰度外链播放地址为空时切换卡死问题
+- 增加QQ,微信,微博,邮件,电话等联系配置
+- 用户控制台文章和提问列表增加删除过滤
+- 去除layim在线客服
+- 提高视频转码分辨率
+
### [v1.4.2](https://gitee.com/koogua/course-tencent-cloud/releases/v1.4.2)(2021-08-13)
- 后台增加转码码率配置选项
diff --git a/app/Http/Admin/Controllers/SettingController.php b/app/Http/Admin/Controllers/SettingController.php
index 22e425d5..94bd7ee3 100644
--- a/app/Http/Admin/Controllers/SettingController.php
+++ b/app/Http/Admin/Controllers/SettingController.php
@@ -409,4 +409,29 @@ class SettingController extends Controller
}
}
+ /**
+ * @Route("/contact", name="admin.setting.contact")
+ */
+ public function contactAction()
+ {
+ $section = 'contact';
+
+ $settingService = new SettingService();
+
+ if ($this->request->isPost()) {
+
+ $data = $this->request->getPost();
+
+ $settingService->updateSettings($section, $data);
+
+ return $this->jsonSuccess(['msg' => '更新配置成功']);
+
+ } else {
+
+ $contact = $settingService->getSettings($section);
+
+ $this->view->setVar('contact', $contact);
+ }
+ }
+
}
diff --git a/app/Http/Admin/Controllers/UploadController.php b/app/Http/Admin/Controllers/UploadController.php
index a96380d3..57eda34b 100644
--- a/app/Http/Admin/Controllers/UploadController.php
+++ b/app/Http/Admin/Controllers/UploadController.php
@@ -16,48 +16,6 @@ use App\Services\Vod as VodService;
class UploadController extends Controller
{
- /**
- * @Post("/site/logo", name="admin.upload.site_logo")
- */
- public function uploadSiteLogoAction()
- {
- $service = new StorageService();
-
- $file = $service->uploadSiteLogo();
-
- if (!$file) {
- return $this->jsonError(['msg' => '上传文件失败']);
- }
-
- $data = [
- 'src' => $service->getImageUrl($file->path),
- 'title' => $file->name,
- ];
-
- return $this->jsonSuccess(['data' => $data]);
- }
-
- /**
- * @Post("/site/favicon", name="admin.upload.site_favicon")
- */
- public function uploadSiteFaviconAction()
- {
- $service = new StorageService();
-
- $file = $service->uploadSiteFavicon();
-
- if (!$file) {
- return $this->jsonError(['msg' => '上传文件失败']);
- }
-
- $data = [
- 'src' => $service->getImageUrl($file->path),
- 'title' => $file->name,
- ];
-
- return $this->jsonSuccess(['data' => $data]);
- }
-
/**
* @Post("/icon/img", name="admin.upload.icon_img")
*/
diff --git a/app/Http/Admin/Services/AuthNode.php b/app/Http/Admin/Services/AuthNode.php
index 75af4425..192366b6 100644
--- a/app/Http/Admin/Services/AuthNode.php
+++ b/app/Http/Admin/Services/AuthNode.php
@@ -1221,6 +1221,12 @@ class AuthNode extends Service
'type' => 'menu',
'route' => 'admin.setting.dingtalk_robot',
],
+ [
+ 'id' => '5-1-16',
+ 'title' => '联系方式',
+ 'type' => 'menu',
+ 'route' => 'admin.setting.contact',
+ ],
],
],
],
diff --git a/app/Http/Admin/Views/public/live_player.volt b/app/Http/Admin/Views/public/live_player.volt
index f615c74f..97558946 100644
--- a/app/Http/Admin/Views/public/live_player.volt
+++ b/app/Http/Admin/Views/public/live_player.volt
@@ -56,11 +56,11 @@
$.each(formats, function (i, format) {
$.each(rates, function (k, rate) {
if (playUrls.hasOwnProperty(format) && playUrls[format].hasOwnProperty(rate.name)) {
- quality[k] = {
+ quality.push({
name: rate.label,
url: playUrls[format][rate.name],
type: 'flv',
- };
+ });
}
});
});
diff --git a/app/Http/Admin/Views/setting/contact.volt b/app/Http/Admin/Views/setting/contact.volt
new file mode 100644
index 00000000..94973dcb
--- /dev/null
+++ b/app/Http/Admin/Views/setting/contact.volt
@@ -0,0 +1,126 @@
+{% extends 'templates/main.volt' %}
+
+{% block content %}
+
+
-
-
-
+
-
+
+ {% if contact_info.enabled == 1 %}
+
+ {% endif %}
\ No newline at end of file
diff --git a/app/Http/Home/Views/partials/js_vars.volt b/app/Http/Home/Views/partials/js_vars.volt
index 167c38e0..14bd81cd 100644
--- a/app/Http/Home/Views/partials/js_vars.volt
+++ b/app/Http/Home/Views/partials/js_vars.volt
@@ -8,6 +8,18 @@
vip: '{{ auth_user.vip }}'
};
+ window.contact = {
+ enabled: '{{ contact_info.enabled }}',
+ qq: '{{ contact_info.qq }}',
+ wechat: '{{ contact_info.wechat }}',
+ toutiao: '{{ contact_info.toutiao }}',
+ weibo: '{{ contact_info.weibo }}',
+ zhihu: '{{ contact_info.zhihu }}',
+ phone: '{{ contact_info.phone }}',
+ email: '{{ contact_info.email }}',
+ address: '{{ contact_info.address }}'
+ };
+
window.im = {
main: {
title: '{{ im_info.main.title }}',
diff --git a/app/Http/Home/Views/templates/main.volt b/app/Http/Home/Views/templates/main.volt
index cb3f3e70..0e1fdec0 100644
--- a/app/Http/Home/Views/templates/main.volt
+++ b/app/Http/Home/Views/templates/main.volt
@@ -13,6 +13,8 @@
{% else %}
{{ icon_link('favicon.ico') }}
{% endif %}
+
+
{{ css_link('lib/layui/css/layui.css') }}
{{ css_link('home/css/common.css') }}
{% block link_css %}{% endblock %}
diff --git a/app/Library/AppInfo.php b/app/Library/AppInfo.php
index 28255fe9..ce5f1a17 100644
--- a/app/Library/AppInfo.php
+++ b/app/Library/AppInfo.php
@@ -16,7 +16,7 @@ class AppInfo
protected $link = 'https://koogua.com';
- protected $version = '1.4.2';
+ protected $version = '1.4.3';
public function __get($name)
{
diff --git a/app/Repos/ArticleFavorite.php b/app/Repos/ArticleFavorite.php
index 2affdf10..ec43be57 100644
--- a/app/Repos/ArticleFavorite.php
+++ b/app/Repos/ArticleFavorite.php
@@ -30,6 +30,10 @@ class ArticleFavorite extends Repository
$builder->andWhere('user_id = :user_id:', ['user_id' => $where['user_id']]);
}
+ if (isset($where['deleted'])) {
+ $builder->andWhere('deleted = :deleted:', ['deleted' => $where['deleted']]);
+ }
+
switch ($sort) {
default:
$orderBy = 'id DESC';
diff --git a/app/Repos/QuestionFavorite.php b/app/Repos/QuestionFavorite.php
index 0cc5ba4e..e0834171 100644
--- a/app/Repos/QuestionFavorite.php
+++ b/app/Repos/QuestionFavorite.php
@@ -30,6 +30,10 @@ class QuestionFavorite extends Repository
$builder->andWhere('user_id = :user_id:', ['user_id' => $where['user_id']]);
}
+ if (isset($where['deleted'])) {
+ $builder->andWhere('deleted = :deleted:', ['deleted' => $where['deleted']]);
+ }
+
switch ($sort) {
default:
$orderBy = 'id DESC';
diff --git a/app/Services/ChapterVod.php b/app/Services/ChapterVod.php
index 0a02198d..8f11bc3b 100644
--- a/app/Services/ChapterVod.php
+++ b/app/Services/ChapterVod.php
@@ -89,9 +89,9 @@ class ChapterVod extends Service
protected function getVodTemplates()
{
return [
- 'hd' => ['height' => 720, 'rate' => 1800],
- 'sd' => ['height' => 540, 'rate' => 1000],
- 'fd' => ['height' => 360, 'rate' => 400],
+ 'hd' => ['height' => 1080, 'rate' => 2500],
+ 'sd' => ['height' => 720, 'rate' => 1800],
+ 'fd' => ['height' => 540, 'rate' => 1000],
];
}
diff --git a/app/Services/Logic/Chapter/BasicInfo.php b/app/Services/Logic/Chapter/BasicInfo.php
index 90bfdfca..e9a4e84c 100644
--- a/app/Services/Logic/Chapter/BasicInfo.php
+++ b/app/Services/Logic/Chapter/BasicInfo.php
@@ -70,6 +70,13 @@ class BasicInfo extends LogicService
$playUrls = $chapterVodService->getPlayUrls($chapter->id);
+ /**
+ *过滤播放地址为空的条目
+ */
+ foreach ($playUrls as $key => $value) {
+ if (empty($value['url'])) unset($playUrls[$key]);
+ }
+
return [
'id' => $chapter->id,
'title' => $chapter->title,
diff --git a/app/Services/Logic/Verify/EmailCode.php b/app/Services/Logic/Verify/MailCode.php
similarity index 82%
rename from app/Services/Logic/Verify/EmailCode.php
rename to app/Services/Logic/Verify/MailCode.php
index 2e359c06..9a04d1dc 100644
--- a/app/Services/Logic/Verify/EmailCode.php
+++ b/app/Services/Logic/Verify/MailCode.php
@@ -7,12 +7,12 @@
namespace App\Services\Logic\Verify;
-use App\Services\Logic\Notice\Mail\Verify as VerifyMailService;
+use App\Services\Logic\Notice\Mail\Verify as MailVerifyService;
use App\Services\Logic\Service as LogicService;
use App\Validators\Captcha as CaptchaValidator;
use App\Validators\Verify as VerifyValidator;
-class EmailCode extends LogicService
+class MailCode extends LogicService
{
public function handle()
@@ -27,7 +27,7 @@ class EmailCode extends LogicService
$validator->checkCode($post['ticket'], $post['rand']);
- $service = new VerifyMailService();
+ $service = new MailVerifyService();
$service->handle($post['email']);
}
diff --git a/app/Services/Logic/Verify/Ticket.php b/app/Services/Logic/Verify/Ticket.php
new file mode 100644
index 00000000..b42c1915
--- /dev/null
+++ b/app/Services/Logic/Verify/Ticket.php
@@ -0,0 +1,27 @@
+request->getPost('rand', ['trim', 'string']);
+
+ $validator = new VerifyValidator();
+
+ $rand = $validator->checkRand($rand);
+
+ return $this->crypt->encryptBase64($rand);
+ }
+
+}
diff --git a/app/Services/MyStorage.php b/app/Services/MyStorage.php
index b7326442..157855e5 100644
--- a/app/Services/MyStorage.php
+++ b/app/Services/MyStorage.php
@@ -119,26 +119,6 @@ class MyStorage extends Storage
return $this->putFile($key, $filename);
}
- /**
- * 上传站点LOGO
- *
- * @return UploadModel|bool
- */
- public function uploadSiteLogo()
- {
- return $this->upload('/img/icon/', self::MIME_IMAGE, UploadModel::TYPE_DEFAULT_IMG);
- }
-
- /**
- * 上传站点ICON
- *
- * @return UploadModel|bool
- */
- public function uploadSiteFavicon()
- {
- return $this->upload('/img/icon/', self::MIME_IMAGE, UploadModel::TYPE_DEFAULT_IMG);
- }
-
/**
* 上传封面图片
*
diff --git a/app/Services/Vod.php b/app/Services/Vod.php
index 364d8b7a..19c03e6c 100644
--- a/app/Services/Vod.php
+++ b/app/Services/Vod.php
@@ -633,15 +633,15 @@ class Vod extends Service
public function getVideoTransTemplates()
{
$hlsTemplates = [
- 100210 => ['quality' => 'fd', 'height' => 360, 'bit_rate' => 400, 'frame_rate' => 25],
- 100220 => ['quality' => 'sd', 'height' => 540, 'bit_rate' => 1000, 'frame_rate' => 25],
- 100230 => ['quality' => 'hd', 'height' => 720, 'bit_rate' => 1800, 'frame_rate' => 25],
+ 100220 => ['quality' => 'fd', 'height' => 540, 'bit_rate' => 1000, 'frame_rate' => 25],
+ 100230 => ['quality' => 'sd', 'height' => 720, 'bit_rate' => 1800, 'frame_rate' => 25],
+ 100240 => ['quality' => 'hd', 'height' => 1080, 'bit_rate' => 2500, 'frame_rate' => 25],
];
$mp4Templates = [
- 100010 => ['quality' => 'fd', 'height' => 360, 'bit_rate' => 400, 'frame_rate' => 25],
- 100020 => ['quality' => 'sd', 'height' => 540, 'bit_rate' => 1000, 'frame_rate' => 25],
- 100030 => ['quality' => 'hd', 'height' => 720, 'bit_rate' => 1800, 'frame_rate' => 25],
+ 100020 => ['quality' => 'fd', 'height' => 540, 'bit_rate' => 1000, 'frame_rate' => 25],
+ 100030 => ['quality' => 'sd', 'height' => 720, 'bit_rate' => 1800, 'frame_rate' => 25],
+ 100040 => ['quality' => 'hd', 'height' => 360, 'bit_rate' => 2500, 'frame_rate' => 25],
];
$format = $this->settings['video_format'] ?: 'hls';
diff --git a/app/Validators/Verify.php b/app/Validators/Verify.php
index 1176e207..3e991c4b 100644
--- a/app/Validators/Verify.php
+++ b/app/Validators/Verify.php
@@ -65,4 +65,28 @@ class Verify extends Validator
}
}
+ public function checkRand($rand)
+ {
+ list($time, $number) = explode('-', $rand);
+
+ if (abs($time - time()) > 300) {
+ throw new BadRequestException('verify.invalid_rand');
+ }
+
+ if ($number < 1000 || $number > 9999) {
+ throw new BadRequestException('verify.invalid_rand');
+ }
+
+ return $rand;
+ }
+
+ public function checkTicket($ticket, $rand)
+ {
+ $ticket = $this->crypt->decrypt($ticket);
+
+ if ($ticket != $rand) {
+ throw new BadRequestException('verify.invalid_ticket');
+ }
+ }
+
}
diff --git a/db/migrations/20210820064755.php b/db/migrations/20210820064755.php
new file mode 100644
index 00000000..657de33f
--- /dev/null
+++ b/db/migrations/20210820064755.php
@@ -0,0 +1,71 @@
+handleContactSetting();
+ }
+
+ protected function handleContactSetting()
+ {
+ $rows = [
+ [
+ 'section' => 'contact',
+ 'item_key' => 'enabled',
+ 'item_value' => '0',
+ ],
+ [
+ 'section' => 'contact',
+ 'item_key' => 'qq',
+ 'item_value' => '',
+ ],
+ [
+ 'section' => 'contact',
+ 'item_key' => 'wechat',
+ 'item_value' => '',
+ ],
+ [
+ 'section' => 'contact',
+ 'item_key' => 'toutiao',
+ 'item_value' => '',
+ ],
+ [
+ 'section' => 'contact',
+ 'item_key' => 'weibo',
+ 'item_value' => '',
+ ],
+ [
+ 'section' => 'contact',
+ 'item_key' => 'zhihu',
+ 'item_value' => '',
+ ],
+ [
+ 'section' => 'contact',
+ 'item_key' => 'email',
+ 'item_value' => '',
+ ],
+ [
+ 'section' => 'contact',
+ 'item_key' => 'phone',
+ 'item_value' => '',
+ ],
+ [
+ 'section' => 'contact',
+ 'item_key' => 'address',
+ 'item_value' => '',
+ ],
+ ];
+
+ $this->table('kg_setting')->insert($rows)->save();
+ }
+
+}
diff --git a/public/static/home/css/common.css b/public/static/home/css/common.css
index 95d596df..1e01acbf 100644
--- a/public/static/home/css/common.css
+++ b/public/static/home/css/common.css
@@ -233,27 +233,39 @@
background: none;
}
+#footer .row {
+ line-height: 18px;
+ margin-bottom: 15px;
+}
+
+#footer .row:last-child {
+ margin-bottom: 0;
+}
+
+#footer .contact {
+ line-height: 24px;
+}
+
#footer span, #footer a {
color: #999;
}
-#footer a:hover {
+#footer a:hover,
+#footer .iconfont:hover {
color: #fff;
}
-.bottom-nav {
- margin-bottom: 10px;
- line-height: 18px;
-}
-
-.copyright {
- line-height: 18px;
-}
-
-.bottom-nav a, .copyright span, .copyright a {
+#footer .nav a,
+#footer .copyright span,
+#footer .copyright a,
+#footer .contact a {
margin-right: 10px;
}
+#footer .iconfont {
+ font-size: 20px;
+}
+
.layout-sidebar .loading {
padding: 15px;
text-align: center;
diff --git a/public/static/home/js/captcha.verify.js b/public/static/home/js/captcha.verify.js
index 6322b529..13fe91c3 100644
--- a/public/static/home/js/captcha.verify.js
+++ b/public/static/home/js/captcha.verify.js
@@ -25,7 +25,7 @@ layui.use(['jquery', 'util'], function () {
postUrl = '/verify/sms/code';
} else if (isEmail($account.val())) {
postData.email = $account.val();
- postUrl = '/verify/email/code';
+ postUrl = '/verify/mail/code';
}
$.ajax({
type: 'POST',
diff --git a/public/static/home/js/chapter.live.player.js b/public/static/home/js/chapter.live.player.js
index 9dca40de..d842d16e 100644
--- a/public/static/home/js/chapter.live.player.js
+++ b/public/static/home/js/chapter.live.player.js
@@ -25,11 +25,11 @@ layui.use(['jquery', 'helper'], function () {
$.each(formats, function (i, format) {
$.each(rates, function (k, rate) {
if (playUrls.hasOwnProperty(format) && playUrls[format].hasOwnProperty(rate.name)) {
- quality[k] = {
+ quality.push({
name: rate.label,
url: playUrls[format][rate.name],
type: 'flv',
- };
+ });
}
});
});
diff --git a/public/static/home/js/chapter.vod.player.js b/public/static/home/js/chapter.vod.player.js
index 2ea203bc..d1041bf6 100644
--- a/public/static/home/js/chapter.vod.player.js
+++ b/public/static/home/js/chapter.vod.player.js
@@ -22,13 +22,15 @@ layui.use(['jquery', 'helper'], function () {
$.each(rates, function (k, rate) {
if (playUrls.hasOwnProperty(rate.name)) {
- quality[k] = {
+ quality.push({
name: rate.label,
url: playUrls[rate.name]['url'],
- };
+ });
}
});
+ console.log(quality)
+
var player = new DPlayer({
container: document.getElementById('player'),
video: {
diff --git a/public/static/home/js/fixbar.js b/public/static/home/js/fixbar.js
index 283a717e..6b9f952a 100644
--- a/public/static/home/js/fixbar.js
+++ b/public/static/home/js/fixbar.js
@@ -1,16 +1,50 @@
-layui.use(['helper', 'util'], function () {
+layui.use(['jquery', 'helper', 'util'], function () {
- var helper = layui.helper;
+ var $ = layui.jquery;
var util = layui.util;
+ var showQQDialog = function () {
+ window.open('https://wpa.qq.com/msgrd?v=3&uin=' + window.contact.qq + '&site=qq&menu=yes');
+ }
+
+ var showWechatCode = function () {
+ var content = '

';
+ layer.open({
+ type: 1,
+ title: false,
+ closeBtn: 0,
+ shadeClose: true,
+ content: content
+ });
+ }
+
+ var showTouTiaoCode = function () {
+ var content = '
';
+ layer.open({
+ type: 1,
+ title: false,
+ closeBtn: 0,
+ shadeClose: true,
+ content: content
+ });
+ }
+
+ $('.icon-wechat').on('click', function () {
+ showWechatCode();
+ });
+
+ $('.icon-toutiao').on('click', function () {
+ showTouTiaoCode();
+ });
+
util.fixbar({
- bar1: window.im.cs.enabled === '1' ? '' : false,
- bar2: true,
+ bar1: window.contact.qq ? '' : false,
+ bar2: window.contact.wechat ? '' : false,
click: function (type) {
if (type === 'bar1') {
- helper.cs();
+ showQQDialog();
} else if (type === 'bar2') {
- window.open('/help', 'help');
+ showWechatCode();
}
}
});