wesmiler 2 年之前
父節點
當前提交
915c0e37b9
共有 1 個文件被更改,包括 18 次插入3 次删除
  1. 18 3
      app/Services/Api/VideoService.php

+ 18 - 3
app/Services/Api/VideoService.php

@@ -61,16 +61,31 @@ class VideoService extends BaseService
     public function getDataList($params, $pageSize = 18, $field = '', $userId=0)
     {
 
-        $where = ['a.mark' => 1,'b.mark'=>1];
+        $where = ['a.mark' => 1,'a.is_sort'=>2,'b.mark'=>1];
         $field = $field? $field : 'lev_a.*';
         $order = 'lev_a.id desc';
         $list = $this->model->with(['member'])->from('videos as a')
             ->leftJoin('member as b', 'b.id', '=', 'a.user_id')
             ->where($where)
-            ->where(function ($query) use ($params) {
+            ->where(function ($query) use ($params, $userId) {
                 $type = isset($params['type']) ? $params['type'] : 0;
                 if ($type > 0) {
-                    $query->where('a.type', $type);
+                    if($type == 1){
+                        $query->where('a.user_id', $userId);
+                    }else if($type == 2){
+                        $ids = VideoCollectModel::where(['user_id'=> $userId,'type'=>2,'status'=>1,'mark'=>1])->pluck('collect_id');
+                        $ids = $ids? $ids : ['0'];
+                        if($ids){
+                            $query->whereIn('a.id', $ids);
+                        }
+                    }else if($type == 3){
+                        $ids = VideoCollectModel::where(['user_id'=> $userId,'type'=>3,'status'=>1,'mark'=>1])->pluck('collect_id');
+                        $ids = $ids? $ids : ['0'];
+                        if($ids){
+                            $query->whereIn('a.id', $ids);
+                        }
+                    }
+//                    $query->where('a.type', $type);
                 }
 
                 $uid = isset($params['uid']) ? $params['uid'] : 0;