|
@@ -10,6 +10,7 @@ namespace App\Repositories;
|
|
|
|
|
|
use App\Models\Category;
|
|
use App\Models\Category;
|
|
use App\Models\CategoryTopic;
|
|
use App\Models\CategoryTopic;
|
|
|
|
+use App\Models\MemberFollowTopic;
|
|
use App\Models\Topic;
|
|
use App\Models\Topic;
|
|
use Dingo\Api\Http\Response;
|
|
use Dingo\Api\Http\Response;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Support\Facades\DB;
|
|
@@ -18,9 +19,10 @@ use Illuminate\Support\Facades\Log;
|
|
use Illuminate\Support\Facades\Redis;
|
|
use Illuminate\Support\Facades\Redis;
|
|
|
|
|
|
class TopicRepository {
|
|
class TopicRepository {
|
|
- public function __construct(Topic $topic,CategoryTopic $categoryTopic){
|
|
|
|
|
|
+ public function __construct(Topic $topic,CategoryTopic $categoryTopic,MemberFollowTopic $memberFollowTopic){
|
|
$this->topic = $topic;
|
|
$this->topic = $topic;
|
|
$this->categoryTopic = $categoryTopic;
|
|
$this->categoryTopic = $categoryTopic;
|
|
|
|
+ $this->memberFollowTopic = $memberFollowTopic;
|
|
}
|
|
}
|
|
//列表
|
|
//列表
|
|
public function index($request){
|
|
public function index($request){
|
|
@@ -203,7 +205,13 @@ class TopicRepository {
|
|
public function getTopics($ids = []){
|
|
public function getTopics($ids = []){
|
|
return $this->topic->whereIn('id', $ids)->select('id','name')->get();
|
|
return $this->topic->whereIn('id', $ids)->select('id','name')->get();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ public function getMemberTopics($uid){
|
|
|
|
+ return $this->memberFollowTopic
|
|
|
|
+ ->leftJoin('topic','topic.id','=','member_follow_topic.topic_id')
|
|
|
|
+ ->where('member_follow_topic.uid',$uid)
|
|
|
|
+ ->select('topic.id','topic.name')
|
|
|
|
+ ->get();
|
|
|
|
+ }
|
|
/**
|
|
/**
|
|
* 重置话题redis
|
|
* 重置话题redis
|
|
*/
|
|
*/
|