1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
user.php
См. документацию.
1<?php
2
3namespace Bitrix\Pull\Controller;
4
5use \Bitrix\Main\Application;
6use Bitrix\Main\Engine;
7use Bitrix\Main\Error;
8use Bitrix\Main\Type\DateTime;
9use Bitrix\Main\UserTable;
10use Bitrix\Pull\JsonRpcTransport;
11
13{
14 function getLastSeenAction(array $userIds, bool $sendToQueueSever = false)
15 {
16 $userIds = array_map(fn ($a) => (int)$a, $userIds);
17 if (empty($userIds))
18 {
19 $this->addError(new Error("userIds should not be empty"));
20 }
21
22 $now = time();
23 $timestamps = [];
24 $result = [];
25
26 $cursor = UserTable::getList([
27 'select' => ['ID', 'LAST_ACTIVITY_DATE'],
28 'filter' => ['=ID' => $userIds],
29 ]);
30
31 foreach ($cursor->getIterator() as $row)
32 {
33 if ($row['LAST_ACTIVITY_DATE'] instanceof DateTime)
34 {
35 $userId = $row['ID'];
36 $lastSeen = $row['LAST_ACTIVITY_DATE']->getTimestamp();
37 $timestamps[$userId] = $lastSeen;
38 $result[$userId] = $now - $lastSeen;
39 }
40 }
41
42 if ($sendToQueueSever && !empty($timestamps))
43 {
44 Application::getInstance()->addBackgroundJob(
45 function (array $timestamps) {
46 (new JsonRpcTransport())->updateUsersLastSeen($timestamps);
47 },
48 [$timestamps]
49 );
50 }
51 return $result;
52 }
53}
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения check_mail.php:18
addError(Error $error)
Определения controller.php:1070
Определения error.php:15
getLastSeenAction(array $userIds, bool $sendToQueueSever=false)
Определения user.php:14
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
else $a
Определения template.php:137