From 44eb45793b508467078081aeeb8fe65f5b938f04 Mon Sep 17 00:00:00 2001 From: Default Date: Thu, 10 Apr 2025 15:55:53 +0800 Subject: [PATCH] debug --- code/app/task/crawler/zw630/Scheduler.php | 21 ++++++++++++++++++- code/app/task/module/PlanTask.php | 25 ++++++++++++++++++++++- code/database/seeders/PlanTaskSeeder.php | 10 ++++++--- 3 files changed, 51 insertions(+), 5 deletions(-) diff --git a/code/app/task/crawler/zw630/Scheduler.php b/code/app/task/crawler/zw630/Scheduler.php index 03091ac..abb3dd4 100644 --- a/code/app/task/crawler/zw630/Scheduler.php +++ b/code/app/task/crawler/zw630/Scheduler.php @@ -53,13 +53,32 @@ class Scheduler } } + /** + * Undocumented function + * + * @return void + */ + public function crawLatest() + { + $arrUri = []; + $strUri = '/list/lastupdate_%s_0_0_%s.html'; + + for ($intCategoryKey = 0; $intCategoryKey < 10; $intCategoryKey++) { + for ($intPage = 1; $intPage <= 10; $intPage++) { + $arrUri[] = sprintf($strUri, $intCategoryKey, $intPage); + } + } + + print_r($arrUri); + } + /** * Undocumented function * * @param array $arrFilter * @return void */ - public function fetchNovel(array $arrFilter) //(int $intNSourceId, int $intPage = 0) + public function fetchNovel(array $arrFilter) { $arrTask = [ 'callback' => [self::class, 'getNovelInfo'], diff --git a/code/app/task/module/PlanTask.php b/code/app/task/module/PlanTask.php index db73150..8807682 100644 --- a/code/app/task/module/PlanTask.php +++ b/code/app/task/module/PlanTask.php @@ -31,13 +31,20 @@ class PlanTask case 'PULL_630_ZW_NOVEL': self::pull630ZwNovel(); break; - + case 'PULL_630_ZW_NOVEL_LATEST': + self::pull630ZwNovelLatest(); + break; default: break; } } } + /** + * Undocumented function + * + * @return void + */ public static function pull630ZwNovel() { $arrTask = [ @@ -48,4 +55,20 @@ class PlanTask $QueueManage = new QueueManage(); $QueueManage->set($arrTask); } + + /** + * Undocumented function + * + * @return void + */ + public static function pull630ZwNovelLatest() + { + $arrTask = [ + 'callback' => [Zw630Scheduler::class, 'crawLatest'], + 'data' => [] + ]; + + $QueueManage = new QueueManage(); + $QueueManage->set($arrTask); + } } diff --git a/code/database/seeders/PlanTaskSeeder.php b/code/database/seeders/PlanTaskSeeder.php index 9808864..e59e5ca 100644 --- a/code/database/seeders/PlanTaskSeeder.php +++ b/code/database/seeders/PlanTaskSeeder.php @@ -9,12 +9,10 @@ class PlanTaskSeeder { static public function handle() { - self::addNovelTypePlanTask(); } - // 添加小说类型站点 爬虫任务 static public function addNovelTypePlanTask() { $arrDataNovel = [ @@ -25,8 +23,14 @@ class PlanTaskSeeder 'pt_enable' => 1, 'pt_limit' => 10 * 24 * 3600 * 3, ], - + [ + 'pt_name' => '630小说每日增量', + 'pt_code' => 'PULL_630_ZW_NOVEL_LATEST', + 'pt_enable' => 1, + 'pt_limit' => 1 * 24 * 3600, + ], ]; + foreach ($arrDataNovel as $arrPlanTask) { $NovelOnePlanTaskModel = PlanTaskModel::where('pt_code', $arrPlanTask['pt_code'])->find();