uid = $uid; $this->invite_code = $invite_code; } public function transform(Post $post) { $isLike = 0; if($this->uid){ $isLike = Redis::SISMEMBER('post_like_'.$post['id'], $this->uid); } $user = $this->userInfo($post['uid']); $postInfo = $this->getPostInfo($post['id']); return [ 'id' => $post['id'], 'type' => $post['type'], 'uid' => $post['uid'], 'username' => $user['username'], 'avatar' => $user['avatar'], 'is_fine' => $post['is_fine']??0, 'title' => $post['title'], 'content' => subtext($post['content'], 100), 'img' => $post['img'], 'topic' => $this->getTopic($post['topic_ids']), 'praise_count' => $postInfo['praise_count'], 'is_like' => $isLike, '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']:'', ]; } }