- Модуль: scale
- Путь к файлу: ~/bitrix/modules/scale/lib/provider.php
- Класс: BitrixScaleProvider
- Вызов: Provider::sendOrder
static function sendOrder($providerId, $configId)
{
if($providerId == '' )
throw new ArgumentNullException("providerId");
if($configId == '' )
throw new ArgumentNullException("configId");
$result = "";
$shellAdapter = new ShellAdapter();
$execRes = $shellAdapter->syncExec("sudo -u root /opt/webdir/bin/bx-provider -a order --provider ".$providerId." --config_id ".$configId." -o json");
$jsonData = $shellAdapter->getLastOutput();
if($execRes)
{
$arData = json_decode($jsonData, true);
if(isset($arData["params"]["provider_order"][$providerId]["task_id"]))
$result = $arData["params"]["provider_order"][$providerId]["task_id"];
}
if($result <> '')
{
$logLevel = Logger::LOG_LEVEL_INFO;
$description = Loc::getMessage("SCALE_PROVIDER_SEND_ORDER_SUCCESS");
}
else
{
$logLevel = Logger::LOG_LEVEL_ERROR;
$description = Loc::getMessage("SCALE_PROVIDER_SEND_ORDER_ERROR");
}
$description = str_replace(
array("##PROVIDER##", "##CONFIG_ID##", "##ORDER_ID##"),
array($providerId, $configId, $result),
$description
);
Logger::addRecord(
$logLevel,
"SCALE_PROVIDER_SEND_ORDER",
$providerId."::".$configId,
$description);
return $result;
}