From 894efc20ff3cdcee75036c27aad382fcc9f1e0c0 Mon Sep 17 00:00:00 2001 From: wong <106998207@qq.com> Date: Fri, 11 Jul 2025 16:16:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=A5=BD=E5=8F=8B=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../friend/GetFriendListV1Controller.php | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/Server/application/cunkebao/controller/friend/GetFriendListV1Controller.php b/Server/application/cunkebao/controller/friend/GetFriendListV1Controller.php index a6d12d6e..89abde8c 100644 --- a/Server/application/cunkebao/controller/friend/GetFriendListV1Controller.php +++ b/Server/application/cunkebao/controller/friend/GetFriendListV1Controller.php @@ -38,23 +38,21 @@ class GetFriendListV1Controller extends BaseController $where[] = ['isDeleted','=',0]; } - if(!empty($keyword)){ $where[] = ['nickname|alias|wechatId','like','%'.$keyword.'%']; } + $wechatIds = Db::name('device')->alias('d') + ->join('device_wechat_login dwl','dwl.deviceId=d.id AND dwl.companyId='.$this->getUserInfo('companyId')) + ->where(['d.companyId' => $this->getUserInfo('companyId'),'d.deleteTime' => 0]); - $devices = Db::name('device_wechat_login') - ->where(['companyId' => $this->getUserInfo('companyId'),'alive' => 1]) - ->order('id desc') - ->group('wechatId'); - - if(!empty($deviceIds) && is_array($deviceIds)){ - $devices = $devices->whereIn('deviceId',$deviceIds); + if (!empty($deviceIds)){ + $wechatIds = $wechatIds->where('d.deviceId','in',$deviceIds); } - $devices = $devices->column('wechatId'); + $wechatIds = $wechatIds->column('dwl.wechatId'); - $where[] = ['ownerWechatId','in',$devices]; + + $where[] = ['ownerWechatId','in',$wechatIds]; $data = Db::table('s2_wechat_friend') ->field(['nickname','avatar','alias','id','wechatId','ownerNickname','ownerAlias','ownerWechatId','createTime'])