<?php
namespace app\common\command;
use think\console\Command;
use think\console\Input;
use think\console\Output;
use think\Db;
class Crawl extends Command
{
protected function configure()
{
$this->setName('crawl')
->setDescription('启信宝爬取企业信息');
}
//爬取企业信息
protected function execute(Input $input, Output $output)
{
$page=0;
while($all=Db::name('enterprise')
->order('id')
->limit($page*500,'500')
->select()
){
$page=$page+1;
foreach ($all as $key => $value) {
if(失败){
//失败 结束本次循环
continue;
}
//成功
}
}
$output->writeln("启信宝爬取企业信息执行完成!");
}
}
Tp5创建定时
于 2023-03-07 14:11:06 首次发布