|
@@ -36,6 +36,8 @@ class PostRepositories
|
|
|
PostData $postData,
|
|
|
PostImgs $postImgs,
|
|
|
PostComment $postComment,
|
|
|
+ PostCollect $postCollect,
|
|
|
+ PostShare $postShare,
|
|
|
DetectionService $detectionService,
|
|
|
RabbitMqUtil $rabbitMqUtil,
|
|
|
Topic $topic)
|
|
@@ -44,6 +46,8 @@ class PostRepositories
|
|
|
$this->postData = $postData;
|
|
|
$this->postImgs = $postImgs;
|
|
|
$this->postComment = $postComment;
|
|
|
+ $this->postCollect = $postCollect;
|
|
|
+ $this->postShare = $postShare;
|
|
|
$this->detectionService = $detectionService;
|
|
|
$this->rabbitMqUtil = $rabbitMqUtil;
|
|
|
$this->topic = $topic;
|
|
@@ -322,6 +326,35 @@ class PostRepositories
|
|
|
->paginate($perPage);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 个人中心内容列表
|
|
|
+ */
|
|
|
+ public function MyPost($type, $uid)
|
|
|
+ {
|
|
|
+ $perPage = isset($request['per_page']) ? $request['per_page'] : 20;
|
|
|
+
|
|
|
+ $where = [];
|
|
|
+ if($type == 'create'){
|
|
|
+ $where[] = ['post.uid', $uid];
|
|
|
+ $post = $this->post;
|
|
|
+ $order = 'post.id';
|
|
|
+ }elseif($type == 'collect'){
|
|
|
+ $post = $this->post->join('post_collect', 'post_collect.post_id', '=', 'post.id');
|
|
|
+ $where[] = ['post_collect.uid', $uid];
|
|
|
+ $order = 'post_collect.id';
|
|
|
+ }else{
|
|
|
+ $post = $this->post->join('post_share', 'post_share.post_id', '=', 'post.id');
|
|
|
+ $where[] = ['post_share.uid', $uid];
|
|
|
+ $order = 'post_share.updated_at';
|
|
|
+ }
|
|
|
+ return $post
|
|
|
+ ->join('post_data', 'post_data.post_id', '=', 'post.id')
|
|
|
+ ->select('post.*')
|
|
|
+ ->where($where)
|
|
|
+ ->orderBy($order,'desc')
|
|
|
+ ->paginate($perPage);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 内容详情
|
|
|
*/
|