From fec1171d6bea5fa4710d22c60915a4304fd2b760 Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Sat, 22 Feb 2025 16:01:57 +0800 Subject: [PATCH] v1.7.5 --- CHANGELOG.md | 11 +++++++-- app/Caches/Article.php | 36 --------------------------- app/Caches/MaxArticleId.php | 34 ------------------------- app/Caches/MaxQuestionId.php | 34 ------------------------- app/Caches/Question.php | 36 --------------------------- app/Http/Admin/Services/Article.php | 4 --- app/Http/Admin/Services/Course.php | 4 --- app/Http/Admin/Services/Question.php | 4 --- app/Models/Article.php | 8 ------ app/Models/Question.php | 8 ------ app/Services/Logic/ArticleTrait.php | 7 ------ app/Services/Logic/QuestionTrait.php | 7 ------ app/Validators/Article.php | 37 ---------------------------- app/Validators/Question.php | 37 ---------------------------- 14 files changed, 9 insertions(+), 258 deletions(-) delete mode 100644 app/Caches/Article.php delete mode 100644 app/Caches/MaxArticleId.php delete mode 100644 app/Caches/MaxQuestionId.php delete mode 100644 app/Caches/Question.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f375381..499f297b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,17 @@ -### [v1.7.5](https://gitee.com/koogua/course-tencent-cloud/releases/v1.7.5)(2024-01-10) +### [v1.7.5](https://gitee.com/koogua/course-tencent-cloud/releases/v1.7.5)(2024-02-22) +- 优化后台统计图表 +- 优化图片放大查看 +- 优化错误处理机制 +- 优化前台编辑器页面 - 去除一些过度的设计 +- 精简属性空判断 +- 规整redirect - 优化bootstrap - 优化logger - 优化contact -- 精简空判断 +- 优化logo +- 优化nav ### [v1.7.4](https://gitee.com/koogua/course-tencent-cloud/releases/v1.7.4)(2024-12-10) diff --git a/app/Caches/Article.php b/app/Caches/Article.php deleted file mode 100644 index 18baa434..00000000 --- a/app/Caches/Article.php +++ /dev/null @@ -1,36 +0,0 @@ -lifetime; - } - - public function getKey($id = null) - { - return "article:{$id}"; - } - - public function getContent($id = null) - { - $articleRepo = new ArticleRepo(); - - $article = $articleRepo->findById($id); - - return $article ?: null; - } - -} diff --git a/app/Caches/MaxArticleId.php b/app/Caches/MaxArticleId.php deleted file mode 100644 index 44e7bf7e..00000000 --- a/app/Caches/MaxArticleId.php +++ /dev/null @@ -1,34 +0,0 @@ -lifetime; - } - - public function getKey($id = null) - { - return 'max_article_id'; - } - - public function getContent($id = null) - { - $article = ArticleModel::findFirst(['order' => 'id DESC']); - - return $article->id ?? 0; - } - -} diff --git a/app/Caches/MaxQuestionId.php b/app/Caches/MaxQuestionId.php deleted file mode 100644 index 52165de2..00000000 --- a/app/Caches/MaxQuestionId.php +++ /dev/null @@ -1,34 +0,0 @@ -lifetime; - } - - public function getKey($id = null) - { - return 'max_question_id'; - } - - public function getContent($id = null) - { - $question = QuestionModel::findFirst(['order' => 'id DESC']); - - return $question->id ?? 0; - } - -} diff --git a/app/Caches/Question.php b/app/Caches/Question.php deleted file mode 100644 index b832fa1f..00000000 --- a/app/Caches/Question.php +++ /dev/null @@ -1,36 +0,0 @@ -lifetime; - } - - public function getKey($id = null) - { - return "question:{$id}"; - } - - public function getContent($id = null) - { - $questionRepo = new QuestionRepo(); - - $question = $questionRepo->findById($id); - - return $question ?: null; - } - -} diff --git a/app/Http/Admin/Services/Article.php b/app/Http/Admin/Services/Article.php index 9f516762..a09a1e07 100644 --- a/app/Http/Admin/Services/Article.php +++ b/app/Http/Admin/Services/Article.php @@ -74,10 +74,6 @@ class Article extends Service $params = $this->handleAccountSearchParams($params); - if (!empty($params['xm_tag_ids'])) { - $params['tag_id'] = explode(',', $params['xm_tag_ids']); - } - $params['deleted'] = $params['deleted'] ?? 0; $sort = $pagerQuery->getSort(); diff --git a/app/Http/Admin/Services/Course.php b/app/Http/Admin/Services/Course.php index 6540bc0d..eb8b55dc 100644 --- a/app/Http/Admin/Services/Course.php +++ b/app/Http/Admin/Services/Course.php @@ -37,10 +37,6 @@ class Course extends Service $params = $pagerQuery->getParams(); - if (!empty($params['xm_tag_ids'])) { - $params['tag_id'] = explode(',', $params['xm_tag_ids']); - } - $params['deleted'] = $params['deleted'] ?? 0; $sort = $pagerQuery->getSort(); diff --git a/app/Http/Admin/Services/Question.php b/app/Http/Admin/Services/Question.php index 5dd98be7..fd9552f0 100644 --- a/app/Http/Admin/Services/Question.php +++ b/app/Http/Admin/Services/Question.php @@ -68,10 +68,6 @@ class Question extends Service $params = $this->handleAccountSearchParams($params); - if (!empty($params['xm_tag_ids'])) { - $params['tag_id'] = explode(',', $params['xm_tag_ids']); - } - $params['deleted'] = $params['deleted'] ?? 0; $sort = $pagerQuery->getSort(); diff --git a/app/Models/Article.php b/app/Models/Article.php index 78a1dbd5..41994b8e 100644 --- a/app/Models/Article.php +++ b/app/Models/Article.php @@ -7,7 +7,6 @@ namespace App\Models; -use App\Caches\MaxArticleId as MaxArticleIdCache; use App\Services\Sync\ArticleIndex as ArticleIndexSync; use App\Services\Sync\ArticleScore as ArticleScoreSync; use Phalcon\Mvc\Model\Behavior\SoftDelete; @@ -258,13 +257,6 @@ class Article extends Model } } - public function afterCreate() - { - $cache = new MaxArticleIdCache(); - - $cache->rebuild(); - } - public function afterFetch() { if (!Text::startsWith($this->cover, 'http')) { diff --git a/app/Models/Question.php b/app/Models/Question.php index 3039a851..840dc0fa 100644 --- a/app/Models/Question.php +++ b/app/Models/Question.php @@ -7,7 +7,6 @@ namespace App\Models; -use App\Caches\MaxQuestionId as MaxQuestionIdCache; use App\Services\Sync\QuestionIndex as QuestionIndexSync; use App\Services\Sync\QuestionScore as QuestionScoreSync; use Phalcon\Mvc\Model\Behavior\SoftDelete; @@ -286,13 +285,6 @@ class Question extends Model } } - public function afterCreate() - { - $cache = new MaxQuestionIdCache(); - - $cache->rebuild(); - } - public function afterFetch() { /** diff --git a/app/Services/Logic/ArticleTrait.php b/app/Services/Logic/ArticleTrait.php index e3e4af76..27a7acd1 100644 --- a/app/Services/Logic/ArticleTrait.php +++ b/app/Services/Logic/ArticleTrait.php @@ -19,11 +19,4 @@ trait ArticleTrait return $validator->checkArticle($id); } - public function checkArticleCache($id) - { - $validator = new ArticleValidator(); - - return $validator->checkArticleCache($id); - } - } diff --git a/app/Services/Logic/QuestionTrait.php b/app/Services/Logic/QuestionTrait.php index abcc32cc..9410e068 100644 --- a/app/Services/Logic/QuestionTrait.php +++ b/app/Services/Logic/QuestionTrait.php @@ -19,11 +19,4 @@ trait QuestionTrait return $validator->checkQuestion($id); } - public function checkQuestionCache($id) - { - $validator = new QuestionValidator(); - - return $validator->checkQuestionCache($id); - } - } diff --git a/app/Validators/Article.php b/app/Validators/Article.php index cbbe4acc..8da442a4 100644 --- a/app/Validators/Article.php +++ b/app/Validators/Article.php @@ -7,8 +7,6 @@ namespace App\Validators; -use App\Caches\Article as ArticleCache; -use App\Caches\MaxArticleId as MaxArticleIdCache; use App\Exceptions\BadRequest as BadRequestException; use App\Library\Validators\Common as CommonValidator; use App\Models\Article as ArticleModel; @@ -18,30 +16,8 @@ use App\Services\EditorStorage as EditorStorageService; class Article extends Validator { - /** - * @param int $id - * @return ArticleModel - * @throws BadRequestException - */ - public function checkArticleCache($id) - { - $this->checkId($id); - - $articleCache = new ArticleCache(); - - $article = $articleCache->get($id); - - if (!$article) { - throw new BadRequestException('article.not_found'); - } - - return $article; - } - public function checkArticle($id) { - $this->checkId($id); - $articleRepo = new ArticleRepo(); $article = $articleRepo->findById($id); @@ -53,19 +29,6 @@ class Article extends Validator return $article; } - public function checkId($id) - { - $id = intval($id); - - $maxIdCache = new MaxArticleIdCache(); - - $maxId = $maxIdCache->get(); - - if ($id < 1 || $id > $maxId) { - throw new BadRequestException('article.not_found'); - } - } - public function checkCategoryId($id) { $result = 0; diff --git a/app/Validators/Question.php b/app/Validators/Question.php index e6099cd7..776ce971 100644 --- a/app/Validators/Question.php +++ b/app/Validators/Question.php @@ -7,8 +7,6 @@ namespace App\Validators; -use App\Caches\MaxQuestionId as MaxQuestionIdCache; -use App\Caches\Question as QuestionCache; use App\Exceptions\BadRequest as BadRequestException; use App\Models\Question as QuestionModel; use App\Repos\Question as QuestionRepo; @@ -17,30 +15,8 @@ use App\Services\EditorStorage as EditorStorageService; class Question extends Validator { - /** - * @param int $id - * @return QuestionModel - * @throws BadRequestException - */ - public function checkQuestionCache($id) - { - $this->checkId($id); - - $questionCache = new QuestionCache(); - - $question = $questionCache->get($id); - - if (!$question) { - throw new BadRequestException('question.not_found'); - } - - return $question; - } - public function checkQuestion($id) { - $this->checkId($id); - $questionRepo = new QuestionRepo(); $question = $questionRepo->findById($id); @@ -52,19 +28,6 @@ class Question extends Validator return $question; } - public function checkId($id) - { - $id = intval($id); - - $maxIdCache = new MaxQuestionIdCache(); - - $maxId = $maxIdCache->get(); - - if ($id < 1 || $id > $maxId) { - throw new BadRequestException('question.not_found'); - } - } - public function checkCategoryId($id) { $result = 0;