Browse Source

加入黑名单

author
wanghongjun 8 months ago
parent
commit
b575fff6f8
  1. 23
      app/enterprise/controller/Friend.php
  2. 4
      app/enterprise/model/Message.php
  3. 1
      app/lang/en_us.php
  4. 1
      app/lang/zh_cn.php

23
app/enterprise/controller/Friend.php

@ -178,4 +178,27 @@ class Friend extends BaseController
return success('', $count);
}
// 加入/取消黑名单
public function isBlacklist()
{
$friend_user_id = $this->request->param('friend_user_id');
if (!$friend_user_id || !is_numeric($friend_user_id)) {
return error(lang('system.fail'));
}
$where = [
'friend_user_id' => $friend_user_id,
'create_user' => $this->uid
];
$friend = FriendModel::where($where)->find();
if (!$friend) {
return error(lang('system.fail'));
}
$friend->is_blacklist = $friend->is_blacklist ? 0 : 1;
$friend->update_time = time();
$friend->save();
return success('');
}
}

4
app/enterprise/model/Message.php

@ -98,6 +98,10 @@ class Message extends BaseModel
$this->error=lang('im.friendNot');
return false;
}
if ($friend['is_blacklist'] == 0) {
$this->error=lang('im.blacklist');
return false;
}
}
}
}else{

1
app/lang/en_us.php

@ -110,6 +110,7 @@ return [
'msgContentLimit' => "Message content too long",
'sendTimeLimit'=>'The message sending interval is {:time} seconds!',
'forbidMsg'=>'[The message is suspected of violation and has been blocked]',
'blacklist'=>'You have been blacklisted by him',
],
'webRtc' => [
'cancel' => 'Call has been canceled',

1
app/lang/zh_cn.php

@ -109,6 +109,7 @@ return [
'msgContentLimit'=>'你发送的消息长度太长了!',
'sendTimeLimit'=>'消息发送时间间隔为 {:time} 秒!',
'forbidMsg'=>'[该消息涉嫌违规,已被屏蔽]',
'blacklist'=>'您已被TA加入黑名单',
],
'webRtc'=>[
'cancel'=>'已取消通话',

Loading…
Cancel
Save