From 56e04fc3a30c4667a626b7ec10cf5a38bf775290 Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Mon, 22 Jan 2024 12:37:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=88=86=E7=B1=BB=E7=AD=89?= =?UTF-8?q?=E5=BF=85=E9=80=89=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Admin/Services/Article.php | 2 +- app/Http/Admin/Services/Course.php | 4 ++-- app/Http/Admin/Services/Question.php | 2 +- app/Http/Home/Controllers/Controller.php | 2 +- public/static/home/js/article.show.js | 4 +--- public/static/home/js/chapter.show.js | 4 +--- public/static/home/js/question.show.js | 4 +--- 7 files changed, 8 insertions(+), 14 deletions(-) diff --git a/app/Http/Admin/Services/Article.php b/app/Http/Admin/Services/Article.php index f0f568ce..894ebc52 100644 --- a/app/Http/Admin/Services/Article.php +++ b/app/Http/Admin/Services/Article.php @@ -200,7 +200,7 @@ class Article extends Service $data['published'] = $validator->checkPublishStatus($post['published']); } - if (isset($post['category_id'])) { + if (isset($post['category_id']) && !empty($post['category_id'])) { $category = $validator->checkCategory($post['category_id']); $data['category_id'] = $category->id; } diff --git a/app/Http/Admin/Services/Course.php b/app/Http/Admin/Services/Course.php index 1d4ade92..414a011f 100644 --- a/app/Http/Admin/Services/Course.php +++ b/app/Http/Admin/Services/Course.php @@ -165,12 +165,12 @@ class Course extends Service $data['published'] = $validator->checkPublishStatus($post['published']); } - if (isset($post['category_id'])) { + if (isset($post['category_id']) && !empty($post['category_id'])) { $category = $validator->checkCategory($post['category_id']); $data['category_id'] = $category->id; } - if (isset($post['teacher_id'])) { + if (isset($post['teacher_id']) && !empty($post['teacher_id'])) { $teacher = $validator->checkTeacher($post['teacher_id']); $data['teacher_id'] = $teacher->id; } diff --git a/app/Http/Admin/Services/Question.php b/app/Http/Admin/Services/Question.php index a0fab6aa..87ca6273 100644 --- a/app/Http/Admin/Services/Question.php +++ b/app/Http/Admin/Services/Question.php @@ -186,7 +186,7 @@ class Question extends Service $data['published'] = $validator->checkPublishStatus($post['published']); } - if (isset($post['category_id'])) { + if (isset($post['category_id']) && !empty($post['category_id'])) { $category = $validator->checkCategory($post['category_id']); $data['category_id'] = $category->id; } diff --git a/app/Http/Home/Controllers/Controller.php b/app/Http/Home/Controllers/Controller.php index 8ca96c2b..fb73c7cc 100644 --- a/app/Http/Home/Controllers/Controller.php +++ b/app/Http/Home/Controllers/Controller.php @@ -102,7 +102,7 @@ class Controller extends \Phalcon\Mvc\Controller $this->view->setVar('websocket_info', $this->websocketInfo); } - protected function getAuthUser($cache = false) + protected function getAuthUser($cache = true) { /** * @var HomeAuth $auth diff --git a/public/static/home/js/article.show.js b/public/static/home/js/article.show.js index 161a5589..a997719b 100644 --- a/public/static/home/js/article.show.js +++ b/public/static/home/js/article.show.js @@ -85,9 +85,7 @@ layui.use(['jquery', 'layer', 'helper'], function () { }); $('.icon-reply').on('click', function () { - $('html').animate({ - scrollTop: $('#comment-anchor').offset().top - }, 500); + $('html').scrollTop($('#comment-anchor').offset().top); }); }); \ No newline at end of file diff --git a/public/static/home/js/chapter.show.js b/public/static/home/js/chapter.show.js index d7d76e29..5cebd398 100644 --- a/public/static/home/js/chapter.show.js +++ b/public/static/home/js/chapter.show.js @@ -35,9 +35,7 @@ layui.use(['jquery', 'helper'], function () { }); $('.icon-reply').on('click', function () { - $('html').animate({ - scrollTop: $('#comment-anchor').offset().top - }, 500); + $('html').scrollTop($('#comment-anchor').offset().top); }); }); \ No newline at end of file diff --git a/public/static/home/js/question.show.js b/public/static/home/js/question.show.js index 4bc30dc1..be30ce94 100644 --- a/public/static/home/js/question.show.js +++ b/public/static/home/js/question.show.js @@ -85,9 +85,7 @@ layui.use(['jquery', 'helper'], function () { }); $('.icon-reply').on('click', function () { - $('html').animate({ - scrollTop: $('#answer-anchor').offset().top - }, 500); + $('html').scrollTop($('#answer-anchor').offset().top); }); }); \ No newline at end of file