Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
Task.php
1
<?php
2
3
namespace
Bitrix\Im\V2\Controller\Chat
;
4
5
use
Bitrix\Im\V2\Chat
;
6
use
Bitrix\Im\V2\Controller\BaseController
;
7
use
Bitrix\Im\V2\Link\Task\TaskService
;
8
use
Bitrix\Im\V2\Message\MessageError
;
9
use
Bitrix\Im\V2\Rest\RestError
;
10
use
Bitrix\Main\Engine\AutoWire\ExactParameter
;
11
12
class
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->hasAccess())
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
}
Bitrix\Im\Chat
Definition
chat.php:19
Bitrix\Im\V2\Chat\ChatError
Definition
ChatError.php:9
Bitrix\Im\V2\Chat\ChatError\TASK_ACCESS_ERROR
const TASK_ACCESS_ERROR
Definition
ChatError.php:32
Bitrix\Im\V2\Controller\BaseController
Definition
BaseController.php:24
Bitrix\Im\V2\Controller\Chat\Message
Definition
Message.php:26
Bitrix\Im\V2\Controller\Chat\Task
Definition
Task.php:13
Bitrix\Im\V2\Controller\Chat\Task\prepareAction
prepareAction(?Chat $chat=null, ?\Bitrix\Im\V2\Message $message=null)
Definition
Task.php:17
Bitrix\Im\V2\Link\Task\TaskService
Definition
TaskService.php:24
Bitrix\Im\V2\Message\MessageError
Definition
MessageError.php:9
Bitrix\Im\V2\Rest\RestError
Definition
RestError.php:9
Bitrix\Im\V2\Rest\RestError\ACCESS_ERROR
const ACCESS_ERROR
Definition
RestError.php:10
Bitrix\Main\Engine\AutoWire\ExactParameter
Definition
exactparameter.php:9
Bitrix\Main\Engine\Controller\addError
addError(Error $error)
Definition
controller.php:1051
Bitrix\Im\V2\Chat
Definition
ChannelChat.php:3
Bitrix\Im\V2\Controller\Chat
Definition
Message.php:3
Bitrix
modules
im
lib
V2
Controller
Chat
Task.php
Создано системой
1.10.0