Commit 83c209a6 authored by hj's avatar hj

更新提交

parent b45125b5
......@@ -51,6 +51,7 @@ class CheMenuService
try{
$pageUrl = $url['url'];
SimpleLogs::writeLog('开始抓取'.$pageUrl.'分类页面数据', 'chemenu info', 'info');
$pageIndex = 1;
while(true){
$responseHtml = $this->apiService->getPage($pageUrl);
//file_put_contents('./test2.txt', $responseHtml);
......@@ -94,6 +95,18 @@ class CheMenuService
SimpleLogs::writeLog('分类页面抓取结束', 'chemenu info', 'info');
break;
}
if($pageIndex == 10){
$jobContent = [
'params' => ['url' => $pageUrl],
'consumer' => __CLASS__,
'method' => 'categoryPage'
];
$this->apiService->pushQueue($jobContent,'chemenu_category_page');
$pageIndex = 1;
break;
}
$pageIndex ++;
$randomFloat = 3 + mt_rand(0, 3) + (mt_rand(0, 999) / 1000);
usleep($randomFloat * 1000000); // 微秒级延迟
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment