|
@@ -10,6 +10,7 @@ namespace App\Repositories;
|
|
|
|
|
|
|
|
|
use App\Models\Behavior;
|
|
|
+use App\Models\MemberFollowTopic;
|
|
|
use App\Models\Post;
|
|
|
use App\Models\PostCollect;
|
|
|
use App\Models\PostComment;
|
|
@@ -47,6 +48,7 @@ class PostRepositories
|
|
|
PostLog $postLog,
|
|
|
DetectionService $detectionService,
|
|
|
AliYunVodService $aliYunVodService,
|
|
|
+ MemberFollowTopic $memberFollowTopic,
|
|
|
Topic $topic)
|
|
|
{
|
|
|
$this->post = $post;
|
|
@@ -58,6 +60,7 @@ class PostRepositories
|
|
|
$this->postLog = $postLog;
|
|
|
$this->detectionService = $detectionService;
|
|
|
$this->topic = $topic;
|
|
|
+ $this->memberFollowTopic = $memberFollowTopic;
|
|
|
$this->aliYunVodService = $aliYunVodService;
|
|
|
}
|
|
|
|
|
@@ -485,14 +488,14 @@ class PostRepositories
|
|
|
$perPage = isset($request['per_page']) ? $request['per_page'] : 20;
|
|
|
|
|
|
$where = [];
|
|
|
+ $topic = $this->topic;
|
|
|
if(isset($request['category_id']) && $request['category_id']){
|
|
|
- $topic = $this->topic->join('category_topic', 'category_topic.topic_id', '=', 'topic.id')->select('topic.*');
|
|
|
- $where[] = ['category_topic.category_id', $request['category_id']];
|
|
|
- }else{
|
|
|
- $topic = $this->topic;
|
|
|
- }
|
|
|
- if(isset($request['is_suggest']) && $request['is_suggest']){
|
|
|
- $where[] = ['topic.is_hot', $request['is_suggest']];
|
|
|
+ if($request['category_id'] == -2){
|
|
|
+ $where[] = ['topic.is_hot', 1];
|
|
|
+ }else{
|
|
|
+ $topic = $topic->join('category_topic', 'category_topic.topic_id', '=', 'topic.id')->select('topic.*');
|
|
|
+ $where[] = ['category_topic.category_id', $request['category_id']];
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if(isset($request['name'])){
|
|
@@ -504,6 +507,25 @@ class PostRepositories
|
|
|
->paginate($perPage);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 我的话题列表
|
|
|
+ */
|
|
|
+ public function myTopicList($request)
|
|
|
+ {
|
|
|
+ $perPage = isset($request['per_page']) ? $request['per_page'] : 20;
|
|
|
+
|
|
|
+ $uid = 0;
|
|
|
+ $user = $this->getUserInfo();
|
|
|
+ if($user){
|
|
|
+ $uid = $user['uid'];
|
|
|
+ }
|
|
|
+
|
|
|
+ return $this->memberFollowTopic
|
|
|
+ ->where('uid', $uid)
|
|
|
+ ->orderBy('id','desc')
|
|
|
+ ->paginate($perPage);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 更新帖子统计数量
|