|
@@ -250,16 +250,25 @@ 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){
|
|
- $message = [
|
|
|
|
- 'user_id' => $follow_uid,
|
|
|
|
- 'title' => '好友请求',
|
|
|
|
- 'content' => '有人关注了你,回关TA成为好友',
|
|
|
|
- 'createtime' => time(),
|
|
|
|
- 'status' => 0,
|
|
|
|
- 'infotype' => 'newfriend',//关注,请求好友
|
|
|
|
- 'infotype_id' => $this->auth->id,
|
|
|
|
- ];
|
|
|
|
- Db::name('message')->insertGetId($message);
|
|
|
|
|
|
+ //防止重复刷关注,如果总是重复关注,取关,一天内就发一次消息
|
|
|
|
+ $check = Db::name('message')
|
|
|
|
+ ->where('user_id',$follow_uid)
|
|
|
|
+ ->where('infotype','newfriend')
|
|
|
|
+ ->where('infotype_id',$this->auth->id)
|
|
|
|
+ ->where('createtime','gt',strtotime(date('Y-m-d')))
|
|
|
|
+ ->find();
|
|
|
|
+ if(!$check){
|
|
|
|
+ $message = [
|
|
|
|
+ 'user_id' => $follow_uid,
|
|
|
|
+ 'title' => '好友请求',
|
|
|
|
+ 'content' => '有人关注了你,回关TA成为好友',
|
|
|
|
+ 'createtime' => time(),
|
|
|
|
+ 'status' => 0,
|
|
|
|
+ 'infotype' => 'newfriend',//关注,请求好友
|
|
|
|
+ 'infotype_id' => $this->auth->id,
|
|
|
|
+ ];
|
|
|
|
+ Db::name('message')->insertGetId($message);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
//我从好友审核列表过来的,我又回关了
|
|
//我从好友审核列表过来的,我又回关了
|