- Модуль: landing
- Путь к файлу: ~/bitrix/modules/landing/lib/publicaction/repo.php
- Класс: Bitrix\Landing\PublicAction\Repo
- Вызов: Repo::getAppInfo
static function getAppInfo($code)
{
$result = new PublicActionResult();
$error = new \Bitrix\Landing\Error;
$app = array();
if (!is_string($code))
{
return $result;
}
if ($appLocal = RepoCore::getAppByCode($code))
{
$app = array(
'CODE' => $appLocal['CODE'],
'NAME' => $appLocal['APP_NAME'],
'DATE_FINISH' => (string)$appLocal['DATE_FINISH'],
'PAYMENT_ALLOW' => $appLocal['PAYMENT_ALLOW'],
'ICON' => '',
'PRICE' => array(),
'UPDATES' => 0
);
if (\Bitrix\Main\Loader::includeModule('rest'))
{
$appRemote = Client::getApp($code);
if (isset($appRemote['ITEMS']))
{
$data = $appRemote['ITEMS'];
if (isset($data['ICON']))
{
$app['ICON'] = $data['ICON'];
}
if (isset($data['PRICE']) && !empty($data['PRICE']))
{
$app['PRICE'] = $data['PRICE'];
}
}
$updates = Client::getUpdates(array(
$code => $appLocal['VERSION']
));
if (
isset($updates['ITEMS'][0]['VERSIONS']) &&
is_array($updates['ITEMS'][0]['VERSIONS'])
)
{
$app['UPDATES'] = count($updates['ITEMS'][0]['VERSIONS']);
}
}
$result->setResult($app);
}
if (empty($app))
{
$error->addError(
'NOT_FOUND',
Loc::getMessage('LANDING_APP_NOT_FOUND')
);
}
$result->setError($error);
return $result;
}