mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-17 07:45:29 +08:00
修正文章和问题缓存
This commit is contained in:
parent
77b7224901
commit
90ab9bc018
@ -1,6 +1,6 @@
|
|||||||
## 酷瓜云课堂
|
## 酷瓜云课堂
|
||||||
|
|
||||||

|
[](https://www.koogua.com)
|
||||||
|
|
||||||
### 系统介绍
|
### 系统介绍
|
||||||
|
|
||||||
@ -63,4 +63,4 @@ Tips: 请用手机注册一个新账号,用户中心 -> 关注订阅,扫码
|
|||||||
|
|
||||||
- [码云平台](https://gitee.com/koogua/course-tencent-cloud/issues)
|
- [码云平台](https://gitee.com/koogua/course-tencent-cloud/issues)
|
||||||
- [官方社区](https://www.koogua.com/community)
|
- [官方社区](https://www.koogua.com/community)
|
||||||
- QQ交流群: 788459713
|
- QQ交流群: 787363898
|
||||||
|
@ -9,10 +9,8 @@ namespace App\Http\Admin\Services;
|
|||||||
|
|
||||||
use App\Builders\ArticleList as ArticleListBuilder;
|
use App\Builders\ArticleList as ArticleListBuilder;
|
||||||
use App\Builders\ReportList as ReportListBuilder;
|
use App\Builders\ReportList as ReportListBuilder;
|
||||||
use App\Caches\Article as ArticleCache;
|
|
||||||
use App\Http\Admin\Services\Traits\AccountSearchTrait;
|
use App\Http\Admin\Services\Traits\AccountSearchTrait;
|
||||||
use App\Library\Paginator\Query as PagerQuery;
|
use App\Library\Paginator\Query as PagerQuery;
|
||||||
use App\Library\Utils\Word as WordUtil;
|
|
||||||
use App\Models\Article as ArticleModel;
|
use App\Models\Article as ArticleModel;
|
||||||
use App\Models\Category as CategoryModel;
|
use App\Models\Category as CategoryModel;
|
||||||
use App\Models\Reason as ReasonModel;
|
use App\Models\Reason as ReasonModel;
|
||||||
@ -137,7 +135,6 @@ class Article extends Service
|
|||||||
$article->create();
|
$article->create();
|
||||||
|
|
||||||
$this->saveDynamicAttrs($article);
|
$this->saveDynamicAttrs($article);
|
||||||
$this->rebuildArticleCache($article);
|
|
||||||
$this->rebuildArticleIndex($article);
|
$this->rebuildArticleIndex($article);
|
||||||
$this->recountUserArticles($user);
|
$this->recountUserArticles($user);
|
||||||
|
|
||||||
@ -208,7 +205,6 @@ class Article extends Service
|
|||||||
$owner = $this->findUser($article->owner_id);
|
$owner = $this->findUser($article->owner_id);
|
||||||
|
|
||||||
$this->saveDynamicAttrs($article);
|
$this->saveDynamicAttrs($article);
|
||||||
$this->rebuildArticleCache($article);
|
|
||||||
$this->rebuildArticleIndex($article);
|
$this->rebuildArticleIndex($article);
|
||||||
$this->recountUserArticles($owner);
|
$this->recountUserArticles($owner);
|
||||||
|
|
||||||
@ -228,7 +224,6 @@ class Article extends Service
|
|||||||
$owner = $this->findUser($article->owner_id);
|
$owner = $this->findUser($article->owner_id);
|
||||||
|
|
||||||
$this->saveDynamicAttrs($article);
|
$this->saveDynamicAttrs($article);
|
||||||
$this->rebuildArticleCache($article);
|
|
||||||
$this->rebuildArticleIndex($article);
|
$this->rebuildArticleIndex($article);
|
||||||
$this->recountUserArticles($owner);
|
$this->recountUserArticles($owner);
|
||||||
|
|
||||||
@ -248,7 +243,6 @@ class Article extends Service
|
|||||||
$owner = $this->findUser($article->owner_id);
|
$owner = $this->findUser($article->owner_id);
|
||||||
|
|
||||||
$this->saveDynamicAttrs($article);
|
$this->saveDynamicAttrs($article);
|
||||||
$this->rebuildArticleCache($article);
|
|
||||||
$this->rebuildArticleIndex($article);
|
$this->rebuildArticleIndex($article);
|
||||||
$this->recountUserArticles($owner);
|
$this->recountUserArticles($owner);
|
||||||
|
|
||||||
@ -287,7 +281,6 @@ class Article extends Service
|
|||||||
|
|
||||||
$owner = $this->findUser($article->owner_id);
|
$owner = $this->findUser($article->owner_id);
|
||||||
|
|
||||||
$this->rebuildArticleCache($article);
|
|
||||||
$this->rebuildArticleIndex($article);
|
$this->rebuildArticleIndex($article);
|
||||||
$this->recountUserArticles($owner);
|
$this->recountUserArticles($owner);
|
||||||
|
|
||||||
@ -323,7 +316,6 @@ class Article extends Service
|
|||||||
|
|
||||||
$owner = $this->findUser($article->owner_id);
|
$owner = $this->findUser($article->owner_id);
|
||||||
|
|
||||||
$this->rebuildArticleCache($article);
|
|
||||||
$this->rebuildArticleIndex($article);
|
$this->rebuildArticleIndex($article);
|
||||||
$this->recountUserArticles($owner);
|
$this->recountUserArticles($owner);
|
||||||
}
|
}
|
||||||
@ -362,7 +354,6 @@ class Article extends Service
|
|||||||
$owner = $this->findUser($article->owner_id);
|
$owner = $this->findUser($article->owner_id);
|
||||||
|
|
||||||
$this->recountUserArticles($owner);
|
$this->recountUserArticles($owner);
|
||||||
$this->rebuildArticleCache($article);
|
|
||||||
$this->rebuildArticleIndex($article);
|
$this->rebuildArticleIndex($article);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -389,7 +380,6 @@ class Article extends Service
|
|||||||
$owner = $this->findUser($article->owner_id);
|
$owner = $this->findUser($article->owner_id);
|
||||||
|
|
||||||
$this->recountUserArticles($owner);
|
$this->recountUserArticles($owner);
|
||||||
$this->rebuildArticleCache($article);
|
|
||||||
$this->rebuildArticleIndex($article);
|
$this->rebuildArticleIndex($article);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -408,13 +398,6 @@ class Article extends Service
|
|||||||
return $userRepo->findById($id);
|
return $userRepo->findById($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function rebuildArticleCache(ArticleModel $article)
|
|
||||||
{
|
|
||||||
$cache = new ArticleCache();
|
|
||||||
|
|
||||||
$cache->rebuild($article->id);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function rebuildArticleIndex(ArticleModel $article)
|
protected function rebuildArticleIndex(ArticleModel $article)
|
||||||
{
|
{
|
||||||
$sync = new ArticleIndexSync();
|
$sync = new ArticleIndexSync();
|
||||||
|
@ -131,7 +131,6 @@ class Question extends Service
|
|||||||
$question->create();
|
$question->create();
|
||||||
|
|
||||||
$this->saveDynamicAttrs($question);
|
$this->saveDynamicAttrs($question);
|
||||||
$this->rebuildQuestionCache($question);
|
|
||||||
$this->rebuildQuestionIndex($question);
|
$this->rebuildQuestionIndex($question);
|
||||||
$this->recountUserQuestions($user);
|
$this->recountUserQuestions($user);
|
||||||
|
|
||||||
@ -195,7 +194,6 @@ class Question extends Service
|
|||||||
$owner = $this->findUser($question->owner_id);
|
$owner = $this->findUser($question->owner_id);
|
||||||
|
|
||||||
$this->saveDynamicAttrs($question);
|
$this->saveDynamicAttrs($question);
|
||||||
$this->rebuildQuestionCache($question);
|
|
||||||
$this->rebuildQuestionIndex($question);
|
$this->rebuildQuestionIndex($question);
|
||||||
$this->recountUserQuestions($owner);
|
$this->recountUserQuestions($owner);
|
||||||
|
|
||||||
@ -219,7 +217,6 @@ class Question extends Service
|
|||||||
$owner = $this->findUser($question->owner_id);
|
$owner = $this->findUser($question->owner_id);
|
||||||
|
|
||||||
$this->saveDynamicAttrs($question);
|
$this->saveDynamicAttrs($question);
|
||||||
$this->rebuildQuestionCache($question);
|
|
||||||
$this->rebuildQuestionIndex($question);
|
$this->rebuildQuestionIndex($question);
|
||||||
$this->recountUserQuestions($owner);
|
$this->recountUserQuestions($owner);
|
||||||
|
|
||||||
@ -238,7 +235,6 @@ class Question extends Service
|
|||||||
|
|
||||||
$owner = $this->findUser($question->owner_id);
|
$owner = $this->findUser($question->owner_id);
|
||||||
|
|
||||||
$this->rebuildQuestionCache($question);
|
|
||||||
$this->rebuildQuestionIndex($question);
|
$this->rebuildQuestionIndex($question);
|
||||||
$this->recountUserQuestions($owner);
|
$this->recountUserQuestions($owner);
|
||||||
|
|
||||||
@ -278,7 +274,6 @@ class Question extends Service
|
|||||||
$owner = $this->findUser($question->owner_id);
|
$owner = $this->findUser($question->owner_id);
|
||||||
|
|
||||||
$this->recountUserQuestions($owner);
|
$this->recountUserQuestions($owner);
|
||||||
$this->rebuildQuestionCache($question);
|
|
||||||
$this->rebuildQuestionIndex($question);
|
$this->rebuildQuestionIndex($question);
|
||||||
|
|
||||||
return $question;
|
return $question;
|
||||||
@ -313,7 +308,6 @@ class Question extends Service
|
|||||||
|
|
||||||
$owner = $this->findUser($question->owner_id);
|
$owner = $this->findUser($question->owner_id);
|
||||||
|
|
||||||
$this->rebuildQuestionCache($question);
|
|
||||||
$this->rebuildQuestionIndex($question);
|
$this->rebuildQuestionIndex($question);
|
||||||
$this->recountUserQuestions($owner);
|
$this->recountUserQuestions($owner);
|
||||||
}
|
}
|
||||||
@ -352,7 +346,6 @@ class Question extends Service
|
|||||||
$owner = $this->findUser($question->owner_id);
|
$owner = $this->findUser($question->owner_id);
|
||||||
|
|
||||||
$this->recountUserQuestions($owner);
|
$this->recountUserQuestions($owner);
|
||||||
$this->rebuildQuestionCache($question);
|
|
||||||
$this->rebuildQuestionIndex($question);
|
$this->rebuildQuestionIndex($question);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -379,7 +372,6 @@ class Question extends Service
|
|||||||
$owner = $this->findUser($question->owner_id);
|
$owner = $this->findUser($question->owner_id);
|
||||||
|
|
||||||
$this->recountUserQuestions($owner);
|
$this->recountUserQuestions($owner);
|
||||||
$this->rebuildQuestionCache($question);
|
|
||||||
$this->rebuildQuestionIndex($question);
|
$this->rebuildQuestionIndex($question);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -398,13 +390,6 @@ class Question extends Service
|
|||||||
return $userRepo->findById($id);
|
return $userRepo->findById($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function rebuildQuestionCache(QuestionModel $question)
|
|
||||||
{
|
|
||||||
$cache = new QuestionCache();
|
|
||||||
|
|
||||||
$cache->rebuild($question->id);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function rebuildQuestionIndex(QuestionModel $question)
|
protected function rebuildQuestionIndex(QuestionModel $question)
|
||||||
{
|
{
|
||||||
$sync = new QuestionIndexSync();
|
$sync = new QuestionIndexSync();
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
namespace Bootstrap;
|
namespace Bootstrap;
|
||||||
|
|
||||||
use App\Library\Logger as AppLogger;
|
use App\Library\Logger as AppLogger;
|
||||||
use Phalcon\Logger\Adapter\File as PhLogger;
|
|
||||||
use Throwable;
|
use Throwable;
|
||||||
|
|
||||||
class ConsoleErrorHandler extends ErrorHandler
|
class ConsoleErrorHandler extends ErrorHandler
|
||||||
@ -44,9 +43,6 @@ class ConsoleErrorHandler extends ErrorHandler
|
|||||||
echo $content . PHP_EOL;
|
echo $content . PHP_EOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return PhLogger
|
|
||||||
*/
|
|
||||||
protected function getLogger()
|
protected function getLogger()
|
||||||
{
|
{
|
||||||
$logger = new AppLogger();
|
$logger = new AppLogger();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user