作者 刘锟

update

... ... @@ -10,7 +10,6 @@
use App\Http\Controllers\Api\NoticeController;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Redis;
... ... @@ -32,30 +31,37 @@ class DownloadFile extends Command
public function handle()
{
while (true) {
$info = Redis::rpop(env('REDIS_NAME', 'handle_html'));
if (empty($info)) {
sleep(60);
return true;
}
try {
$this->websiteHandle();
sleep(30);
$infoArr = json_decode($info, true);
$this->websiteHandle($infoArr);
sleep(2);
} catch (\Exception $e) {
sleep(30);
Redis::lpush(env('REDIS_NAME', 'handle_html'), $info);
sleep(180);
}
return true;
}
return true;
}
/**
* 处理HTML
*/
public function websiteHandle()
public function websiteHandle($infoArr)
{
$info = Redis::rpop(env('REDIS_NAME','handle_html'));
if (!empty($info)) {
$this->output('网站更新开始');
$noticeController = new NoticeController();
$infoArr = json_decode($info, true);
$noticeController->websiteHtmlHandle($infoArr["zip_count"], $infoArr["domain"]);
$this->output('网站更新结束');
}
return true;
$this->output('网站更新开始');
$noticeController = new NoticeController();
$noticeController->websiteHtmlHandle($infoArr["zip_count"], $infoArr["domain"]);
$this->output('网站更新结束');
}
/**
... ...