This commit is contained in:
2026-02-05 16:22:55 +03:00
parent 1adbe9591c
commit 3a75beee32
18 changed files with 319 additions and 335 deletions
+45
View File
@@ -0,0 +1,45 @@
<?php
namespace Bx\Discount\Agents;
use Bx\Discount\Tools;
use Wt\Core\Agent\AAgentCase;
class SpiderAgentCase extends AAgentCase
{
/**
* @return array
*/
public function getAgentConfig()
{
return [
'exec' => [
'NEXT_EXEC' => $this->getNextExecLater(1),
'MODULE_ID' => discountApp()->module()->getId(),
'AGENT_INTERVAL' => 60,
'IS_PERIOD' => 'Y',
],
];
}
public static function exec($arAgent)
{
ini_set('max_execution_time', 0);
ini_set('memory_limit', -1);
@set_time_limit(0);
$agent = null;
if (is_array($arAgent) && $arAgent['ID']) {
$agent = app()->factory()->main()->getAgentFactory()->getEntityById($arAgent['ID']);
}
if(Tools::isEnable()){
$spider = discountApp()->service()->spider();
$spider->setContext($agent);
$spider->next();
}
return static::class . "::exec(\$arAgent);";
}
}