代码提交

This commit is contained in:
wong
2025-10-21 16:46:55 +08:00
parent 19734415f0
commit 7475dbd07c
3 changed files with 126 additions and 89 deletions

View File

@@ -42,16 +42,20 @@ class GetFriendListV1Controller extends BaseController
$where[] = ['nickname|alias|wechatId','like','%'.$keyword.'%'];
}
$wechatIds = Db::name('device')->alias('d')
/* $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])->group('dwl.deviceId')->order('dwl.id desc');
->where(['d.companyId' => $this->getUserInfo('companyId'),'d.deleteTime' => 0])
->group('dwl.deviceId')
->order('dwl.id desc');*/
/*$wechatIds = Db::name('device')->alias('d')
$companyId = $this->getUserInfo('companyId');
$wechatIds = Db::name('device')->alias('d')
// 仅关联每个设备在 device_wechat_login 中的最新一条记录
->join('(SELECT MAX(id) AS id, deviceId FROM ck_device_wechat_login WHERE companyId='.$companyId.' GROUP BY deviceId) dwl_max','dwl_max.deviceId = d.id')
->join('device_wechat_login dwl','dwl.id = dwl_max.id')
->where(['d.companyId' => $companyId,'d.deleteTime' => 0]);*/
->where(['d.companyId' => $companyId,'d.deleteTime' => 0]);
if (!empty($deviceIds)){
@@ -59,7 +63,6 @@ class GetFriendListV1Controller extends BaseController
}
$wechatIds = $wechatIds->column('dwl.wechatId');
$where[] = ['ownerWechatId','in',$wechatIds];
$data = Db::table('s2_wechat_friend')