diff --git a/app/Trending.php b/app/Trending.php index 53ce4e2..b9f6c99 100644 --- a/app/Trending.php +++ b/app/Trending.php @@ -7,7 +7,7 @@ class Trending { /** - * 获取所有热门线程 + * 获取所有热门线程. * * @return array */ @@ -20,7 +20,7 @@ public function get() } /** - * 获取缓存键名 + * 获取缓存键名. * * @return string */ @@ -30,19 +30,18 @@ private function cacheKey() } /** - * 将新线程推送到热门线程列表 + * 将新线程推送到热门线程列表. * * @param Thread $thread */ public function push($thread, $increment = 1) { - $trending = Cache::get($this->cacheKey(), collect()); $trending[$thread->id] = (object) [ 'score' => $this->score($thread) + $increment, 'title' => $thread->title, - 'path' => $thread->path(), + 'path' => $thread->path(), ]; Cache::forever($this->cacheKey(), $trending); @@ -52,7 +51,7 @@ public function score($thread) { $trending = Cache::get($this->cacheKey(), collect()); - if (! isset($trending[$thread->id])) { + if (!isset($trending[$thread->id])) { return 0; } @@ -60,7 +59,7 @@ public function score($thread) } /** - * 重置所有热门线程 + * 重置所有热门线程. */ public function reset() {