Browse Source

关注连刷,减少发消息

lizhen_gitee 1 year ago
parent
commit
d7454116e0
1 changed files with 6 additions and 6 deletions
  1. 6 6
      application/api/controller/Userfollow.php

+ 6 - 6
application/api/controller/Userfollow.php

@@ -250,14 +250,14 @@ class Userfollow extends Api
 
 
         $check = Db::name('user_follow')->where($map2)->find();
         $check = Db::name('user_follow')->where($map2)->find();
         if(empty($check) && $this->user_power($this->auth->id,'yinsi') != 1){
         if(empty($check) && $this->user_power($this->auth->id,'yinsi') != 1){
-            //防止重复刷关注,如果总是重复关注,取关,一天内就发一次消息
-            $check = Db::name('message')
+            //防止重复刷关注,先删掉以前的,再加新的
+            Db::name('message')
                 ->where('user_id',$follow_uid)
                 ->where('user_id',$follow_uid)
                 ->where('infotype','newfriend')
                 ->where('infotype','newfriend')
                 ->where('infotype_id',$this->auth->id)
                 ->where('infotype_id',$this->auth->id)
-                ->where('createtime','gt',strtotime(date('Y-m-d')))
-                ->find();
-            if(!$check){
+                ->where('status',0)
+                ->delete();
+
                 $message = [
                 $message = [
                     'user_id' => $follow_uid,
                     'user_id' => $follow_uid,
                     'title'   => '好友请求',
                     'title'   => '好友请求',
@@ -268,7 +268,7 @@ class Userfollow extends Api
                     'infotype_id' => $this->auth->id,
                     'infotype_id' => $this->auth->id,
                 ];
                 ];
                 Db::name('message')->insertGetId($message);
                 Db::name('message')->insertGetId($message);
-            }
+
         }
         }
 
 
         //我从好友审核列表过来的,我又回关了
         //我从好友审核列表过来的,我又回关了