<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Vendor\LazyValue; use ModStart\Core\Dao\ModelUtil; use ModStart\Core\Job\BaseJob; use Module\Vendor\Log\Logger; class LazyValueJob extends BaseJob { private $key; private $param; private $cacheSeconds; public function __construct($Jo7ME, $KJ3xr, $rnyWQ) { goto uBiiB; uBiiB: $this->key = $Jo7ME; goto OSE8G; OSE8G: $this->param = $KJ3xr; goto bGQwv; bGQwv: $this->cacheSeconds = $rnyWQ; goto ZGmdA; ZGmdA: } public static function create($Jo7ME, $KJ3xr, $rnyWQ) { goto NU2sx; NU2sx: $QJc0N = new LazyValueJob($Jo7ME, $KJ3xr, $rnyWQ); goto E6htW; E6htW: $QJc0N->onQueue('LazyValueJob'); goto CEKUC; CEKUC: app('Illuminate\\Contracts\\Bus\\Dispatcher')->dispatch($QJc0N); goto vmtJ6; vmtJ6: } public static function createRefresh($Jo7ME, $KJ3xr, $rnyWQ) { goto Og3VF; aFnDN: $QJc0N->onQueue('LazyValueJobRefresh'); goto p97B5; p97B5: app('Illuminate\\Contracts\\Bus\\Dispatcher')->dispatch($QJc0N); goto PC32T; Og3VF: $QJc0N = new LazyValueJob($Jo7ME, $KJ3xr, $rnyWQ); goto aFnDN; PC32T: } public function handle() { goto pZLJl; TsBgp: foreach ($W5YMs as $U2KUI) { $gLDFc = $U2KUI . '\\' . $this->key . 'Processor'; if (class_exists($gLDFc)) { goto oTKbr; oTKbr: $vNjqq = new $gLDFc(); goto z5Y_a; nDY6i: $kOAtQ = true; goto xaU7z; z5Y_a: $gbkxa = $vNjqq->execute($this->param); goto nDY6i; xaU7z: } } goto uZIJW; r8cPh: $W5YMs = config('app.lazy_value_processor_roots', array()); goto rzyQe; pZLJl: $CihET = time(); goto A7373; dNG3X: Logger::info('LazyValueJob', 'End'); goto FfFSq; A7373: Logger::info('LazyValueJob', 'Start', array($this->key, $this->cacheSeconds, $this->param)); goto r8cPh; OW617: Logger::info('LazyValueJob', 'Result', $gbkxa); goto oPmVk; oPmVk: ModelUtil::update('lazy_value', array('key' => $this->key, 'param' => json_encode($this->param)), array('expire' => time() + $this->cacheSeconds, 'value' => json_encode($gbkxa))); goto dNG3X; rzyQe: if (empty($W5YMs)) { throw new \Exception('LazyValueJob.Error : you should define lazy_value_processor_roots in config/app.php file'); } goto RNq4y; uZIJW: if (!$kOAtQ) { throw new \Exception('LazyValueJob.Error : could not found processor ' . $this->key); } goto OW617; RNq4y: $kOAtQ = false; goto TsBgp; FfFSq: } }