|
@@ -109,9 +109,12 @@ class FeedRepositories
|
|
|
}
|
|
|
//我的feed
|
|
|
public function myFeed($request){
|
|
|
- $token = JWTAuth::decode(JWTAuth::getToken());
|
|
|
+ $userInfo = $this->getUserInfo();
|
|
|
+ if (empty($userInfo)) {
|
|
|
+ return jsonError('获取用户信息失败');
|
|
|
+ }
|
|
|
$perPage = isset($request['per_page']) ? $request['per_page'] : 20;
|
|
|
- $where[] = ['uid',$token['user']->uid];
|
|
|
+ $where[] = ['uid',$userInfo['uid']];
|
|
|
$data = $this->feed
|
|
|
->where($where)
|
|
|
->orderBy('id','desc')
|
|
@@ -120,7 +123,7 @@ class FeedRepositories
|
|
|
foreach ($data as &$value){
|
|
|
if($value['type'] == 6){
|
|
|
$post = $this->postRepositories->detail($value['relate_id']);
|
|
|
- $value['relate_data'] = $this->postDetail($post,$value['follow_uid']);
|
|
|
+ $value['relate_data'] = $this->postDetail($post,$value['follow_uid'], $userInfo);
|
|
|
}
|
|
|
if($value['type'] == 5){
|
|
|
$value['content'] = null;
|
|
@@ -134,9 +137,8 @@ class FeedRepositories
|
|
|
}
|
|
|
return $data;
|
|
|
}
|
|
|
- public function postDetail($post,$follow_uid){
|
|
|
- $token = JWTAuth::decode(JWTAuth::getToken());
|
|
|
- $uid = $token['user']->uid;
|
|
|
+ public function postDetail($post,$follow_uid,$userInfo){
|
|
|
+ $uid = $userInfo['uid'];
|
|
|
$imgs = [];
|
|
|
foreach($post->imgs as $img){
|
|
|
$imgs[] = $img['img'];
|
|
@@ -178,6 +180,8 @@ class FeedRepositories
|
|
|
'is_dislike' => PostDislike::where('post_id', $post['id'])->where('uid', $uid)->exists()?1:0,
|
|
|
'is_collect' => PostCollect::where('post_id', $post['id'])->where('uid', $uid)->exists()?1:0,
|
|
|
'follow_status' => $isFollow,
|
|
|
+ 'h5url' => config('customer.share_post_h5url')."?post_id={$post['id']}&invite_code={$userInfo['invite_code']}",
|
|
|
+ 'desc_url' => $post['type'] == 'html'?config('customer.app_service_url').'/community/fragment/detail/'.$post['id']:'',
|
|
|
];
|
|
|
}
|
|
|
public function getPostComment($post_id){
|