瀏覽代碼

tag name 同时具备才算

visuddhinanda 10 月之前
父節點
當前提交
69ddae91d7
共有 1 個文件被更改,包括 4 次插入2 次删除
  1. 4 2
      api-v8/app/Services/ProgressChapterService.php

+ 4 - 2
api-v8/app/Services/ProgressChapterService.php

@@ -41,22 +41,24 @@ class ProgressChapterService
     }
     }
     public function get()
     public function get()
     {
     {
+        $tagCount = count($this->tags);
         $chapters = ProgressChapter::where('progress', '>', $this->minProgress)
         $chapters = ProgressChapter::where('progress', '>', $this->minProgress)
             ->whereHas('channel', function ($query) {
             ->whereHas('channel', function ($query) {
                 $query->where('owner_uid', $this->channelOwnerId);
                 $query->where('owner_uid', $this->channelOwnerId);
             })->whereHas('tags', function ($query) {
             })->whereHas('tags', function ($query) {
                 $query->whereIn('name', $this->tags);
                 $query->whereIn('name', $this->tags);
-            })->get();
+            }, '=', $tagCount)->get();
         return $chapters;
         return $chapters;
     }
     }
     public function getTags()
     public function getTags()
     {
     {
+        $tagCount = count($this->tags);
         $chapters = ProgressChapter::where('progress', '>', $this->minProgress)
         $chapters = ProgressChapter::where('progress', '>', $this->minProgress)
             ->whereHas('channel', function ($query) {
             ->whereHas('channel', function ($query) {
                 $query->where('owner_uid', $this->channelOwnerId);
                 $query->where('owner_uid', $this->channelOwnerId);
             })->whereHas('tags', function ($query) {
             })->whereHas('tags', function ($query) {
                 $query->whereIn('name', $this->tags);
                 $query->whereIn('name', $this->tags);
-            })->select('uid')->get();
+            }, '=', $tagCount)->select('uid')->get();
         $tagMaps = TagMap::with('tags')->whereIn('anchor_id', $chapters)
         $tagMaps = TagMap::with('tags')->whereIn('anchor_id', $chapters)
             ->get();
             ->get();
         $tags = [];
         $tags = [];