wesmiler 1 år sedan
förälder
incheckning
f0c6e40ccb
1 ändrade filer med 5 tillägg och 2 borttagningar
  1. 5 2
      app/Services/Api/VideoService.php

+ 5 - 2
app/Services/Api/VideoService.php

@@ -197,7 +197,8 @@ class VideoService extends BaseService
         // 推荐的数据
         $uids = [];
         $countModel = clone $model;
-        $total = $countModel->where(function($query) use($params, $userId, &$uids){
+        $countModel = $countModel->whereNotIn('user_id',[$userId])
+            ->where(function($query) use($params, $userId, &$uids){
             // 推荐视频数据
             $isRecommend = isset($params['is_recommend']) ? $params['is_recommend'] : 0;
             if ($isRecommend > 0) {
@@ -220,7 +221,9 @@ class VideoService extends BaseService
                     });
                 }
             }
-        })->count('a.id');
+        });
+
+        $total = $countModel->count('a.id');
 
         // 随机优先匹配推送
         $match = false;