|
@@ -13,13 +13,15 @@ use App\Models\PostCollect;
|
|
use App\Models\PostComment;
|
|
use App\Models\PostComment;
|
|
use App\Models\PostDislike;
|
|
use App\Models\PostDislike;
|
|
use App\Models\PostLike;
|
|
use App\Models\PostLike;
|
|
|
|
+use App\Traits\FollowStatusTrait;
|
|
use App\Traits\UserTrait;
|
|
use App\Traits\UserTrait;
|
|
use Carbon\Carbon;
|
|
use Carbon\Carbon;
|
|
use League\Fractal\TransformerAbstract;
|
|
use League\Fractal\TransformerAbstract;
|
|
|
|
|
|
class SuggestTransformer extends TransformerAbstract
|
|
class SuggestTransformer extends TransformerAbstract
|
|
{
|
|
{
|
|
- use UserTrait;
|
|
|
|
|
|
+// use UserTrait;
|
|
|
|
+ use FollowStatusTrait;
|
|
public function __construct($uid, $invite_code)
|
|
public function __construct($uid, $invite_code)
|
|
{
|
|
{
|
|
$this->uid = $uid;
|
|
$this->uid = $uid;
|
|
@@ -47,11 +49,11 @@ class SuggestTransformer extends TransformerAbstract
|
|
'name' => $val
|
|
'name' => $val
|
|
];
|
|
];
|
|
}
|
|
}
|
|
- $isFollow = 0;
|
|
|
|
- $followStatus = $this->getFollowStatus($this->uid, $post['uid']);
|
|
|
|
- if($followStatus){
|
|
|
|
- $isFollow = $followStatus;
|
|
|
|
- }
|
|
|
|
|
|
+// $isFollow = 0;
|
|
|
|
+// $followStatus = $this->getFollowStatus($this->uid, $post['uid']);
|
|
|
|
+// if($followStatus){
|
|
|
|
+// $isFollow = $followStatus;
|
|
|
|
+// }
|
|
return [
|
|
return [
|
|
'show_type' => 'post',
|
|
'show_type' => 'post',
|
|
'id' => $post['id'],
|
|
'id' => $post['id'],
|
|
@@ -76,7 +78,7 @@ class SuggestTransformer extends TransformerAbstract
|
|
'is_dislike' => PostDislike::where('post_id', $post['id'])->where('uid', $this->uid)->exists()?1:0,
|
|
'is_dislike' => PostDislike::where('post_id', $post['id'])->where('uid', $this->uid)->exists()?1:0,
|
|
'is_collect' => PostCollect::where('post_id', $post['id'])->where('uid', $this->uid)->exists()?1:0,
|
|
'is_collect' => PostCollect::where('post_id', $post['id'])->where('uid', $this->uid)->exists()?1:0,
|
|
'comment' => $comment,
|
|
'comment' => $comment,
|
|
- 'is_follow' => $isFollow,
|
|
|
|
|
|
+ 'is_follow' => $this->followStatus($this->uid, $post['uid']),
|
|
'h5url' => config('customer.share_post_h5url')."?post_id={$post['id']}&invite_code={$this->invite_code}",
|
|
'h5url' => config('customer.share_post_h5url')."?post_id={$post['id']}&invite_code={$this->invite_code}",
|
|
'desc_url' => $post['type'] == 'html'?config('customer.app_service_url').'/community/fragment/detail/'.$post['id']:'',
|
|
'desc_url' => $post['type'] == 'html'?config('customer.app_service_url').'/community/fragment/detail/'.$post['id']:'',
|
|
];
|
|
];
|