mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-07-21 07:26:39 +08:00
v1.7.5
This commit is contained in:
parent
7ea2477f3b
commit
fec1171d6b
11
CHANGELOG.md
11
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
|
- 优化bootstrap
|
||||||
- 优化logger
|
- 优化logger
|
||||||
- 优化contact
|
- 优化contact
|
||||||
- 精简空判断
|
- 优化logo
|
||||||
|
- 优化nav
|
||||||
|
|
||||||
### [v1.7.4](https://gitee.com/koogua/course-tencent-cloud/releases/v1.7.4)(2024-12-10)
|
### [v1.7.4](https://gitee.com/koogua/course-tencent-cloud/releases/v1.7.4)(2024-12-10)
|
||||||
|
|
||||||
|
@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -74,10 +74,6 @@ class Article extends Service
|
|||||||
|
|
||||||
$params = $this->handleAccountSearchParams($params);
|
$params = $this->handleAccountSearchParams($params);
|
||||||
|
|
||||||
if (!empty($params['xm_tag_ids'])) {
|
|
||||||
$params['tag_id'] = explode(',', $params['xm_tag_ids']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$params['deleted'] = $params['deleted'] ?? 0;
|
$params['deleted'] = $params['deleted'] ?? 0;
|
||||||
|
|
||||||
$sort = $pagerQuery->getSort();
|
$sort = $pagerQuery->getSort();
|
||||||
|
@ -37,10 +37,6 @@ class Course extends Service
|
|||||||
|
|
||||||
$params = $pagerQuery->getParams();
|
$params = $pagerQuery->getParams();
|
||||||
|
|
||||||
if (!empty($params['xm_tag_ids'])) {
|
|
||||||
$params['tag_id'] = explode(',', $params['xm_tag_ids']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$params['deleted'] = $params['deleted'] ?? 0;
|
$params['deleted'] = $params['deleted'] ?? 0;
|
||||||
|
|
||||||
$sort = $pagerQuery->getSort();
|
$sort = $pagerQuery->getSort();
|
||||||
|
@ -68,10 +68,6 @@ class Question extends Service
|
|||||||
|
|
||||||
$params = $this->handleAccountSearchParams($params);
|
$params = $this->handleAccountSearchParams($params);
|
||||||
|
|
||||||
if (!empty($params['xm_tag_ids'])) {
|
|
||||||
$params['tag_id'] = explode(',', $params['xm_tag_ids']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$params['deleted'] = $params['deleted'] ?? 0;
|
$params['deleted'] = $params['deleted'] ?? 0;
|
||||||
|
|
||||||
$sort = $pagerQuery->getSort();
|
$sort = $pagerQuery->getSort();
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use App\Caches\MaxArticleId as MaxArticleIdCache;
|
|
||||||
use App\Services\Sync\ArticleIndex as ArticleIndexSync;
|
use App\Services\Sync\ArticleIndex as ArticleIndexSync;
|
||||||
use App\Services\Sync\ArticleScore as ArticleScoreSync;
|
use App\Services\Sync\ArticleScore as ArticleScoreSync;
|
||||||
use Phalcon\Mvc\Model\Behavior\SoftDelete;
|
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()
|
public function afterFetch()
|
||||||
{
|
{
|
||||||
if (!Text::startsWith($this->cover, 'http')) {
|
if (!Text::startsWith($this->cover, 'http')) {
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use App\Caches\MaxQuestionId as MaxQuestionIdCache;
|
|
||||||
use App\Services\Sync\QuestionIndex as QuestionIndexSync;
|
use App\Services\Sync\QuestionIndex as QuestionIndexSync;
|
||||||
use App\Services\Sync\QuestionScore as QuestionScoreSync;
|
use App\Services\Sync\QuestionScore as QuestionScoreSync;
|
||||||
use Phalcon\Mvc\Model\Behavior\SoftDelete;
|
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()
|
public function afterFetch()
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -19,11 +19,4 @@ trait ArticleTrait
|
|||||||
return $validator->checkArticle($id);
|
return $validator->checkArticle($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkArticleCache($id)
|
|
||||||
{
|
|
||||||
$validator = new ArticleValidator();
|
|
||||||
|
|
||||||
return $validator->checkArticleCache($id);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,11 +19,4 @@ trait QuestionTrait
|
|||||||
return $validator->checkQuestion($id);
|
return $validator->checkQuestion($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkQuestionCache($id)
|
|
||||||
{
|
|
||||||
$validator = new QuestionValidator();
|
|
||||||
|
|
||||||
return $validator->checkQuestionCache($id);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,6 @@
|
|||||||
|
|
||||||
namespace App\Validators;
|
namespace App\Validators;
|
||||||
|
|
||||||
use App\Caches\Article as ArticleCache;
|
|
||||||
use App\Caches\MaxArticleId as MaxArticleIdCache;
|
|
||||||
use App\Exceptions\BadRequest as BadRequestException;
|
use App\Exceptions\BadRequest as BadRequestException;
|
||||||
use App\Library\Validators\Common as CommonValidator;
|
use App\Library\Validators\Common as CommonValidator;
|
||||||
use App\Models\Article as ArticleModel;
|
use App\Models\Article as ArticleModel;
|
||||||
@ -18,30 +16,8 @@ use App\Services\EditorStorage as EditorStorageService;
|
|||||||
class Article extends Validator
|
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)
|
public function checkArticle($id)
|
||||||
{
|
{
|
||||||
$this->checkId($id);
|
|
||||||
|
|
||||||
$articleRepo = new ArticleRepo();
|
$articleRepo = new ArticleRepo();
|
||||||
|
|
||||||
$article = $articleRepo->findById($id);
|
$article = $articleRepo->findById($id);
|
||||||
@ -53,19 +29,6 @@ class Article extends Validator
|
|||||||
return $article;
|
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)
|
public function checkCategoryId($id)
|
||||||
{
|
{
|
||||||
$result = 0;
|
$result = 0;
|
||||||
|
@ -7,8 +7,6 @@
|
|||||||
|
|
||||||
namespace App\Validators;
|
namespace App\Validators;
|
||||||
|
|
||||||
use App\Caches\MaxQuestionId as MaxQuestionIdCache;
|
|
||||||
use App\Caches\Question as QuestionCache;
|
|
||||||
use App\Exceptions\BadRequest as BadRequestException;
|
use App\Exceptions\BadRequest as BadRequestException;
|
||||||
use App\Models\Question as QuestionModel;
|
use App\Models\Question as QuestionModel;
|
||||||
use App\Repos\Question as QuestionRepo;
|
use App\Repos\Question as QuestionRepo;
|
||||||
@ -17,30 +15,8 @@ use App\Services\EditorStorage as EditorStorageService;
|
|||||||
class Question extends Validator
|
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)
|
public function checkQuestion($id)
|
||||||
{
|
{
|
||||||
$this->checkId($id);
|
|
||||||
|
|
||||||
$questionRepo = new QuestionRepo();
|
$questionRepo = new QuestionRepo();
|
||||||
|
|
||||||
$question = $questionRepo->findById($id);
|
$question = $questionRepo->findById($id);
|
||||||
@ -52,19 +28,6 @@ class Question extends Validator
|
|||||||
return $question;
|
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)
|
public function checkCategoryId($id)
|
||||||
{
|
{
|
||||||
$result = 0;
|
$result = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user