From b0196bb672efa0e94f13f7240fadbb28ea65f751 Mon Sep 17 00:00:00 2001 From: toom1996 Date: Wed, 30 Jul 2025 15:32:31 +0800 Subject: [PATCH] update --- app/Command/spider/BaiduRecordCommand.php | 8 +++++++- config/crontabs.php | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/Command/spider/BaiduRecordCommand.php b/app/Command/spider/BaiduRecordCommand.php index 07bbe10..0e0142a 100644 --- a/app/Command/spider/BaiduRecordCommand.php +++ b/app/Command/spider/BaiduRecordCommand.php @@ -60,7 +60,11 @@ class BaiduRecordCommand extends BaseSpider { $cache = []; $requestCookie = ''; - $query = AppNews::query()->where('is_delete', 0)->where('is_record', 0); + $query = AppNews::query() + ->where('is_delete', 0) + ->where('is_record', 0) + ->orderBy(Db::raw('RAND()')) + ->limit(10); if ($id) { $query = $query->where('id', $id); } @@ -90,6 +94,8 @@ class BaiduRecordCommand extends BaseSpider if (stripos($res, '验证') !== false || stripos($res, 'wappass') !== false) { $this->log->info('有验证码!!'); + // 有验证码就跳出 + return; } (new Crawler($res))?->filter('.abs')?->each(function ($node) use ($domain, $item) { diff --git a/config/crontabs.php b/config/crontabs.php index 10bf32a..ad72cfa 100644 --- a/config/crontabs.php +++ b/config/crontabs.php @@ -4,4 +4,4 @@ use Hyperf\Crontab\Schedule; // 百度自动查收录 // 每12个小时运行一次 -Schedule::command('spider:baidu-record')->setName('spider:baidu-record')->setRule('0 */12 * * *'); \ No newline at end of file +Schedule::command('spider:baidu-record')->setName('spider:baidu-record')->setRule('*/5 * * * *'); \ No newline at end of file