1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-28 21:31:37 +08:00
This commit is contained in:
xiaochong0302 2025-02-22 16:01:57 +08:00
parent fce99c2472
commit 2b08bf737d
14 changed files with 9 additions and 258 deletions

View File

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

View File

@ -1,36 +0,0 @@
<?php
/**
* @copyright Copyright (c) 2021 深圳市酷瓜软件有限公司
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.koogua.com
*/
namespace App\Caches;
use App\Repos\Article as ArticleRepo;
class Article extends Cache
{
protected $lifetime = 86400;
public function getLifetime()
{
return $this->lifetime;
}
public function getKey($id = null)
{
return "article:{$id}";
}
public function getContent($id = null)
{
$articleRepo = new ArticleRepo();
$article = $articleRepo->findById($id);
return $article ?: null;
}
}

View File

@ -1,34 +0,0 @@
<?php
/**
* @copyright Copyright (c) 2021 深圳市酷瓜软件有限公司
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.koogua.com
*/
namespace App\Caches;
use App\Models\Article as ArticleModel;
class MaxArticleId extends Cache
{
protected $lifetime = 365 * 86400;
public function getLifetime()
{
return $this->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;
}
}

View File

@ -1,34 +0,0 @@
<?php
/**
* @copyright Copyright (c) 2021 深圳市酷瓜软件有限公司
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.koogua.com
*/
namespace App\Caches;
use App\Models\Question as QuestionModel;
class MaxQuestionId extends Cache
{
protected $lifetime = 365 * 86400;
public function getLifetime()
{
return $this->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;
}
}

View File

@ -1,36 +0,0 @@
<?php
/**
* @copyright Copyright (c) 2021 深圳市酷瓜软件有限公司
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.koogua.com
*/
namespace App\Caches;
use App\Repos\Question as QuestionRepo;
class Question extends Cache
{
protected $lifetime = 86400;
public function getLifetime()
{
return $this->lifetime;
}
public function getKey($id = null)
{
return "question:{$id}";
}
public function getContent($id = null)
{
$questionRepo = new QuestionRepo();
$question = $questionRepo->findById($id);
return $question ?: null;
}
}

View File

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

View File

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

View File

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

View File

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

View File

@ -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()
{
/**

View File

@ -19,11 +19,4 @@ trait ArticleTrait
return $validator->checkArticle($id);
}
public function checkArticleCache($id)
{
$validator = new ArticleValidator();
return $validator->checkArticleCache($id);
}
}

View File

@ -19,11 +19,4 @@ trait QuestionTrait
return $validator->checkQuestion($id);
}
public function checkQuestionCache($id)
{
$validator = new QuestionValidator();
return $validator->checkQuestionCache($id);
}
}

View File

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

View File

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