setDescription('elle.com/street elle街拍模块'); $this->addOption('brandId', 'b', InputOption::VALUE_OPTIONAL, '指定的品牌id', false); } public function execute(InputInterface $input, OutputInterface $output): int { run(function () { $this->spiderStart(); }); return 0; } private function _getTask($brand): \Generator { $query = Db::table('app_brands'); if ($brand) { $query->where(['id' => $brand]); } $query->where('id', '>', 1)->orderBy('id'); foreach ($query->cursor() as $row) { yield $row; } } private function _getTaskName($name): string { return strtolower(strtr($name, [ '.' => '-', ' ' => '-' ])); } public function spiderStart(): void { list($result, $httpCode) = $this->request($this->getBaseUrl() . '/fashion/street-style/'); preg_match_all('/