- Модуль: imbot
- Путь к файлу: ~/bitrix/modules/imbot/lib/bot/support24.php
- Класс: BitrixImBotBotSupport24
- Вызов: Support24::onSupportLevelChange
static function onSupportLevelChange(array $params): bool
{
$isSupportLevelChanged = $params['IS_SUPPORT_LEVEL_CHANGE'] ?? false;
$isDemoLevelChanged = $params['IS_DEMO_LEVEL_CHANGE'] ?? false;
//$isRegionChanged = $params['IS_REGION_CHANGED'] ?? false;
$isLineCodeChanged = $params['IS_SUPPORT_CODE_CHANGE'] ?? false;
$previousCode = $params['PREVIOUS_BOT_CODE'] ?? '';
$currentCode = $params['CURRENT_BOT_CODE'] ?? '';
$previousSupportLevel = $params['PREVIOUS_SUPPORT_LEVEL'] ?? '';
if (
!$isSupportLevelChanged
&& !$isDemoLevelChanged
//&& !$isRegionChanged
&& !$isLineCodeChanged
)
{
return true;
}
self::sendNotifyAboutChangeLevel([
'BUSINESS_USERS' => self::getBusinessUsers(),
'IS_SUPPORT_LEVEL_CHANGE' => $isSupportLevelChanged,
'IS_DEMO_LEVEL_CHANGE' => $isDemoLevelChanged,
'IS_SUPPORT_CODE_CHANGE' => $isLineCodeChanged //|| $isRegionChanged,
]);
$previousLicence = CBitrix24::getLicenseType(CBitrix24::LICENSE_TYPE_PREVIOUS);
$currentLicence = CBitrix24::getLicenseType(CBitrix24::LICENSE_TYPE_CURRENT);
$http = self::instanceHttpClient();
$http->query(
'clientChangeLicence',
[
'BOT_ID' => self::getBotId(),
'PREVIOUS_LICENCE_TYPE' => !$isLineCodeChanged ? $previousLicence : $currentLicence,
'PREVIOUS_LICENCE_NAME' => CBitrix24::getLicenseName(!$isLineCodeChanged ? $previousLicence : $currentLicence),
'CURRENT_LICENCE_TYPE' => $currentLicence,
'CURRENT_LICENCE_NAME' => CBitrix24::getLicenseName($currentLicence),
'PREVIOUS_BOT_CODE' => $previousCode,
'CURRENT_BOT_CODE' => $currentCode,
'MESSAGE' => self::getMessage('SUPPORT_INFO_CHANGE_CODE', $previousSupportLevel),
],
false
);
return true;
}