优化代码

main
gzydong 2021-08-31 21:31:45 +08:00
parent 603f7a8866
commit d55098f815
1 changed files with 7 additions and 0 deletions

View File

@ -95,6 +95,8 @@ class SubscribeHandleService
$groupInfo = GroupCache::getInstance()->getOrSetCache($receiver_id); $groupInfo = GroupCache::getInstance()->getOrSetCache($receiver_id);
} }
if (empty($fds)) return;
$fds = array_unique(array_merge(...$fds)); $fds = array_unique(array_merge(...$fds));
// 客户端ID去重 // 客户端ID去重
@ -154,6 +156,9 @@ class SubscribeHandleService
$status = (int)$data['data']['status']; $status = (int)$data['data']['status'];
$ids = di()->get(UserService::class)->getFriendIds($user_id); $ids = di()->get(UserService::class)->getFriendIds($user_id);
if (empty($ids)) return;
$fds = []; $fds = [];
foreach ($ids as $friend_id) { foreach ($ids as $friend_id) {
$fds[] = $this->clientService->findUserFds(intval($friend_id)); $fds[] = $this->clientService->findUserFds(intval($friend_id));
@ -188,6 +193,8 @@ class SubscribeHandleService
} }
} }
if (empty($fds)) return;
$fds = array_unique(array_merge(...$fds)); $fds = array_unique(array_merge(...$fds));
if (!$fds) return; if (!$fds) return;