perf(消息推送):代码优化

This commit is contained in:
Meng 2023-06-20 17:07:56 +08:00
parent e8675c9c14
commit 7393fdf6cf
2 changed files with 2 additions and 2 deletions

View File

@ -1474,7 +1474,7 @@ class ProjectTask extends AbstractModel
foreach ($array as $item) { foreach ($array as $item) {
$params = [ $params = [
'ignoreFd' => Request::header('fd'), 'ignoreFd' => Request::header('fd'),
'userid' => array_values($item), 'userid' => $item['userid'],
'msg' => [ 'msg' => [
'type' => 'projectTask', 'type' => 'projectTask',
'action' => $action, 'action' => $action,

View File

@ -149,7 +149,7 @@ class PushTask extends AbstractTask
if (!is_array($userid)) { if (!is_array($userid)) {
$userid = [$userid]; $userid = [$userid];
} }
foreach ($userid[0] as $uid) { foreach ($userid as $uid) {
$row = WebSocket::select(['fd'])->whereUserid($uid)->pluck('fd'); $row = WebSocket::select(['fd'])->whereUserid($uid)->pluck('fd');
if ($row->isNotEmpty()) { if ($row->isNotEmpty()) {
$array = array_merge($array, $row->toArray()); $array = array_merge($array, $row->toArray());