浏览代码

Update StatusHashtagService, use StatusService for statuses

Daniel Supernault 4 年之前
父节点
当前提交
0355b567dd
共有 1 个文件被更改,包括 5 次插入11 次删除
  1. 5 11
      app/Services/StatusHashtagService.php

+ 5 - 11
app/Services/StatusHashtagService.php

@@ -16,6 +16,10 @@ class StatusHashtagService {
 
 
 	public static function get($id, $page = 1, $stop = 9)
 	public static function get($id, $page = 1, $stop = 9)
 	{
 	{
+		if($page > 20) {
+			return [];
+		}
+
 		return StatusHashtag::whereHashtagId($id)
 		return StatusHashtag::whereHashtagId($id)
 			->whereStatusVisibility('public')
 			->whereStatusVisibility('public')
 			->whereHas('media')
 			->whereHas('media')
@@ -66,16 +70,6 @@ class StatusHashtagService {
 
 
 	public static function getStatus($statusId, $hashtagId)
 	public static function getStatus($statusId, $hashtagId)
 	{
 	{
-		return Cache::remember('pf:services:status-hashtag:post:'.$statusId.':hashtag:'.$hashtagId, now()->addMonths(3), function() use($statusId, $hashtagId) {
-			$statusHashtag = StatusHashtag::with('profile', 'status', 'hashtag')
-				->whereStatusVisibility('public')
-				->whereStatusId($statusId)
-				->whereHashtagId($hashtagId)
-				->first();
-			$fractal = new Fractal\Manager();
-			$fractal->setSerializer(new ArraySerializer());
-			$resource = new Fractal\Resource\Item($statusHashtag, new StatusHashtagTransformer());
-			return $fractal->createData($resource)->toArray();
-		});
+		return ['status' => StatusService::get($statusId)];
 	}
 	}
 }
 }