From cca449f56034f5f4fab57fa98cba9dc3f26b0196 Mon Sep 17 00:00:00 2001 From: wanghongjun <1445693971@qq.com> Date: Thu, 3 Jul 2025 17:33:33 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E4=BF=AE=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E6=88=96=E5=AE=A2=E6=9C=8D=EF=BC=8C=E9=BB=91?= =?UTF-8?q?=E5=90=8D=E5=8D=95=E6=B8=85=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/enterprise/model/Friend.php | 15 +++++++++++++++ app/manage/controller/Config.php | 10 ++++++++++ app/manage/controller/User.php | 3 +++ 3 files changed, 28 insertions(+) diff --git a/app/enterprise/model/Friend.php b/app/enterprise/model/Friend.php index 57317df..750e6bc 100644 --- a/app/enterprise/model/Friend.php +++ b/app/enterprise/model/Friend.php @@ -47,4 +47,19 @@ class Friend extends BaseModel 'avatar' => $avatar ]; } + + // 同步更新取消黑名单 + public static function syncCancelBlacklist($uid) + { + $where = [ + 'create_user' => $uid, + 'is_blacklist' => 1, + 'delete_time' => 0, + 'status' => 1 + ]; + $friend_ids = self::where($where)->column('friend_id'); + if ($friend_ids) { + self::where('id', 'in', $friend_ids)->update(['is_blacklist' => 0]); + } + } } \ No newline at end of file diff --git a/app/manage/controller/Config.php b/app/manage/controller/Config.php index 695abf0..e9c262a 100644 --- a/app/manage/controller/Config.php +++ b/app/manage/controller/Config.php @@ -10,6 +10,7 @@ namespace app\manage\controller; use app\BaseController; +use app\enterprise\model\Friend; use app\manage\model\{Config as Conf}; use think\facade\Cache; class Config extends BaseController @@ -72,6 +73,15 @@ class Config extends BaseController $systemInfo=Conf::getSystemInfo(true); // 向所有人推送新的设置 wsSendMsg(0,'updateConfig',$systemInfo); + if ($name == 'chatInfo') { + $status = $value['autoAddUser']['status'] ?? 0; + $user_ids = $value['autoAddUser']['user_ids'] ?? []; + if ($status == 0 && $user_ids) { + foreach ($user_ids as $uid) { + Friend::syncCancelBlacklist($uid); + } + } + } } return success(lang('system.editOk')); } diff --git a/app/manage/controller/User.php b/app/manage/controller/User.php index 3f7cc13..85cd05a 100644 --- a/app/manage/controller/User.php +++ b/app/manage/controller/User.php @@ -189,6 +189,9 @@ class User extends BaseController try{ $role = $this->request->param('role'); UserModel::where('user_id', $user_id)->update(['role'=>$role]); + if ($role > 0) { + Friend::syncCancelBlacklist($user_id); + } return success(lang('system.settingOk')); }catch (\Exception $e){ return error('');