File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change 77class Trending
88{
99 /**
10- * 获取所有热门线程
10+ * 获取所有热门线程.
1111 *
1212 * @return array
1313 */
@@ -20,7 +20,7 @@ public function get()
2020 }
2121
2222 /**
23- * 获取缓存键名
23+ * 获取缓存键名.
2424 *
2525 * @return string
2626 */
@@ -30,19 +30,18 @@ private function cacheKey()
3030 }
3131
3232 /**
33- * 将新线程推送到热门线程列表
33+ * 将新线程推送到热门线程列表.
3434 *
3535 * @param Thread $thread
3636 */
3737 public function push ($ thread , $ increment = 1 )
3838 {
39-
4039 $ trending = Cache::get ($ this ->cacheKey (), collect ());
4140
4241 $ trending [$ thread ->id ] = (object ) [
4342 'score ' => $ this ->score ($ thread ) + $ increment ,
4443 'title ' => $ thread ->title ,
45- 'path ' => $ thread ->path (),
44+ 'path ' => $ thread ->path (),
4645 ];
4746
4847 Cache::forever ($ this ->cacheKey (), $ trending );
@@ -52,15 +51,15 @@ public function score($thread)
5251 {
5352 $ trending = Cache::get ($ this ->cacheKey (), collect ());
5453
55- if (! isset ($ trending [$ thread ->id ])) {
54+ if (!isset ($ trending [$ thread ->id ])) {
5655 return 0 ;
5756 }
5857
5958 return $ trending [$ thread ->id ]->score ;
6059 }
6160
6261 /**
63- * 重置所有热门线程
62+ * 重置所有热门线程.
6463 */
6564 public function reset ()
6665 {
You can’t perform that action at this time.
0 commit comments