xielin hace 5 años
padre
commit
59717a32eb
Se han modificado 1 ficheros con 11 adiciones y 1 borrados
  1. 11 1
      app/Repositories/FeedRepositories.php

+ 11 - 1
app/Repositories/FeedRepositories.php

@@ -113,7 +113,17 @@ class FeedRepositories
                 if (in_array($feedType, [4])) {
                     $this->feed->insert($data);
                 } else {
-                    if (isset($request['is_existing']) && intval($request['is_existing']) == 0) {
+                    //此处需要优化,如果feed表需要清理历史数据怎么处理
+                    //以下判断可以控制virus的行为,重复不添加feed,但是关注用户不行,关注用户不存在is_existing字段
+                    //if (isset($request['is_existing']) && intval($request['is_existing']) == 0) {
+                    //    $this->feed->insert($data);
+                    //}
+                    $feedRow = $this->feed->where('uid',$fan)
+                        ->where('follow_uid',$request['target_id'])
+                        ->where('type',$feedType)
+                        ->where('relate_id',$request['post_id'])
+                        ->first();
+                    if(empty($feedRow)){
                         $this->feed->insert($data);
                     }
                 }