wesmiler 2 years ago
parent
commit
9f2ef030e0
1 changed files with 14 additions and 0 deletions
  1. 14 0
      app/Services/Api/VideoService.php

+ 14 - 0
app/Services/Api/VideoService.php

@@ -89,6 +89,20 @@ class VideoService extends BaseService
                         ->orWhere('b.nickname', 'like', "%{$keyword}%");
                 }
             })
+            ->where(function ($query) use ($params, $userId) {
+                $query->where(function($query) use($userId){
+                    // 所有人可见
+                    $query->where('a.visible_type', 1);
+                })->orWhere(function($query) use($userId){
+                    // 关注视频发布用户可见
+                    $uids = $uids = MemberCollectService::make()->getCollectUsers(['user_id'=> $userId,'status'=>1,'mark'=>1],'collect_uid');
+                    $uids = $uids? $uids : [0];
+                    $query->where('a.visible_type', 2)->where('a.user_id', $uids); // 仅自己可见
+                })->orWhere(function($query) use($userId){
+                    // 仅自己可见
+                    $query->where('a.visible_type', 3)->where('a.user_id', $userId); // 仅自己可见
+                });
+            })
             ->selectRaw($field)
             ->orderByRaw($order)
             ->paginate($pageSize > 0 ? $pageSize : 9999999);