3declare(strict_types=1);
5namespace Bitrix\Im\V2\Anchor;
7use Bitrix\Im\Model\AnchorTable;
8use Bitrix\Im\V2\Anchor\DI\AnchorContainer;
9use Bitrix\Im\V2\Anchor\Push\PushService;
10use Bitrix\Im\V2\Common\ContextCustomer;
11use Bitrix\Im\V2\Result;
12use Bitrix\Main\Application;
13use Bitrix\Main\Diag\ExceptionHandler;
14use Bitrix\Main\SystemException;
33 if (empty($messageIds))
38 $userId ??= $this->getContext()->getUserId();
42 'MESSAGE_ID' => $messageIds,
48 if ($anchorCollection->isEmpty())
53 $deleteResult = $anchorCollection->delete();
54 if (!$deleteResult->isSuccess())
56 return $result->addErrors($deleteResult->getErrors());
61 $this->exceptionHandler->writeToLog($exception);
66 $this->anchorProvider->cleanCache(
$userId);
68 $this->pushService->deleteMulti($anchorCollection);
77 if (empty($messageIds))
83 'MESSAGE_ID' => $messageIds,
89 if ($anchorCollection->isEmpty())
94 $deleteResult = $anchorCollection->delete();
95 if (!$deleteResult->isSuccess())
97 return $result->addErrors($deleteResult->getErrors());
102 $this->exceptionHandler->writeToLog($exception);
107 $this->anchorProvider->cleanUsersCache((
array)$anchorCollection->getUserIdList());
109 $this->pushService->deleteMulti($anchorCollection);
118 $userId ??= $this->getContext()->getUserId();
127 AnchorTable::deleteByFilter([
'USER_ID' =>
$userId]);
131 $this->exceptionHandler->writeToLog($exception);
136 $this->pushService->deleteAll(
$userId);
138 $this->anchorProvider->cleanCache(
$userId);
147 $userId ??= $this->getContext()->getUserId();
149 if (
$userId <= 0 || $chatId <= 0)
156 AnchorTable::deleteByFilter([
'CHAT_ID' => $chatId,
'USER_ID' =>
$userId]);
160 $this->exceptionHandler->writeToLog($exception);
165 $this->pushService->deleteByChat($chatId,
$userId);
167 $this->anchorProvider->cleanCache(
$userId);
172 private function init(): void
174 $this->pushService = AnchorContainer::getInstance()->getPushService();
175 $this->anchorProvider = AnchorContainer::getInstance()->getAnchorProvider();
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
static find(array $filter, array $order=['MESSAGE_ID'=> 'desc'], ?int $limit=null, ?Context $context=null)
read(array $messageIds, ?int $userId=null)
readAll(?int $userId=null)
readByChatId(int $chatId, ?int $userId=null)
readByMessageIds(array $messageIds)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)