优化好友列表功能
This commit is contained in:
@@ -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'])
|
||||
|
||||
Reference in New Issue
Block a user