微信列表及设备列表优化

This commit is contained in:
wong
2025-06-16 15:40:45 +08:00
parent edb983e01e
commit 9e89e3db9c
2 changed files with 10 additions and 6 deletions

View File

@@ -79,6 +79,7 @@ class GetDeviceListV1Controller extends BaseController
]) ])
->leftJoin('device_wechat_login l', 'd.id = l.deviceId and l.alive =' . DeviceWechatLoginModel::ALIVE_WECHAT_ACTIVE . ' and l.companyId = d.companyId') ->leftJoin('device_wechat_login l', 'd.id = l.deviceId and l.alive =' . DeviceWechatLoginModel::ALIVE_WECHAT_ACTIVE . ' and l.companyId = d.companyId')
->leftJoin('wechat_account a', 'l.wechatId = a.wechatId') ->leftJoin('wechat_account a', 'l.wechatId = a.wechatId')
->group('l.wechatId')
->order('d.id desc'); ->order('d.id desc');
foreach ($where as $key => $value) { foreach ($where as $key => $value) {
@@ -124,7 +125,7 @@ class GetDeviceListV1Controller extends BaseController
$curstomer = WechatCustomerModel::field('friendShip') $curstomer = WechatCustomerModel::field('friendShip')
->where( ->where(
[ [
'companyId' => $this->getUserInfo('companyId'), //'companyId' => $this->getUserInfo('companyId'),
'wechatId' => $wechatId 'wechatId' => $wechatId
] ]
) )

View File

@@ -77,7 +77,7 @@ class GetWechatsOnDevicesV1Controller extends BaseController
return WechatFriendShipModel::where( return WechatFriendShipModel::where(
[ [
'ownerWechatId' => $ownerWechatId, 'ownerWechatId' => $ownerWechatId,
'companyId' => $this->getUserInfo('companyId'), //'companyId' => $this->getUserInfo('companyId'),
] ]
) )
->count(); ->count();
@@ -95,10 +95,12 @@ class GetWechatsOnDevicesV1Controller extends BaseController
->where( ->where(
[ [
'l.wechatId' => $wechatId, 'l.wechatId' => $wechatId,
'l.alive' => DeviceWechatLoginModel::ALIVE_WECHAT_ACTIVE 'l.alive' => DeviceWechatLoginModel::ALIVE_WECHAT_ACTIVE,
'l.companyId' => $this->getUserInfo('companyId')
] ]
) )
->join('device_wechat_login l', 'd.id = l.deviceId') ->join('device_wechat_login l', 'd.id = l.deviceId AND l.companyId = '. $this->getUserInfo('companyId'))
->order('l.id desc')
->value('d.memo'); ->value('d.memo');
} }
@@ -218,8 +220,9 @@ class GetWechatsOnDevicesV1Controller extends BaseController
'l.deviceId' 'l.deviceId'
] ]
) )
->join('device_wechat_login l', 'w.wechatId = l.wechatId') ->join('device_wechat_login l', 'w.wechatId = l.wechatId AND l.companyId = '. $this->getUserInfo('companyId'))
->order('w.id desc'); ->order('w.id desc')
->group('w.wechatId');
foreach ($where as $key => $value) { foreach ($where as $key => $value) {
if (is_numeric($key) && is_array($value) && isset($value[0]) && $value[0] === 'exp') { if (is_numeric($key) && is_array($value) && isset($value[0]) && $value[0] === 'exp') {