1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
Task.php
См. документацию.
1<?php
2
3namespace Bitrix\Im\V2\Controller\Chat;
4
5use Bitrix\Im\V2\Chat;
6use Bitrix\Im\V2\Controller\BaseController;
7use Bitrix\Im\V2\Link\Task\TaskService;
8use Bitrix\Im\V2\Message\MessageError;
9use Bitrix\Im\V2\Rest\RestError;
10use Bitrix\Main\Engine\AutoWire\ExactParameter;
11
12class Task extends BaseController
13{
17 public function prepareAction(?Chat $chat = null, ?\Bitrix\Im\V2\Message $message = null): ?array
18 {
19 if (isset($message)) {
20 $chat = $message->getChat();
21 if (!$chat->checkAccess()->isSuccess())
22 {
23 $this->addError(new RestError(RestError::ACCESS_ERROR));
24
25 return null;
26 }
27 }
28
29 if (!isset($chat))
30 {
31 $this->addError(new Chat\ChatError(Chat\ChatError::TASK_ACCESS_ERROR));
32
33 return null;
34 }
35
36 $taskService = new TaskService();
37 $result = $taskService->prepareDataForCreateSlider($chat, $message);
38 if (!$result->isSuccess())
39 {
40 $error = $result->getErrors()[0];
41 if (isset($error))
42 {
43 $this->addError($error);
44
45 return null;
46 }
47 }
48
49 return [
50 'link' => $result->getResult()['LINK'],
51 'params' => $result->getResult()['PARAMS']
52 ];
53 }
54}
const TASK_ACCESS_ERROR
Определения ChatError.php:32
prepareAction(?Chat $chat=null, ?\Bitrix\Im\V2\Message $message=null)
Определения Task.php:17
const ACCESS_ERROR
Определения RestError.php:10
</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
Определения Uuid.php:3
Определения ActionUuid.php:3
$message
Определения payment.php:8
$error
Определения subscription_card_product.php:20