setDescription('自动向百度推送'); } public function execute(InputInterface $input, OutputInterface $output): int { $url = AppWebsiteConfig::query()->select(['app_domain', 'id'])->where('is_delete', 0)->get()->toArray(); $pushArray = []; foreach ($url as $item) { $article = AppNews::query()->where('platform', $item['id'])->select(['id'])->get()->toArray(); foreach ($article as $articleItem) { $pushArray[] = 'https://' . $item['app_domain'] . '/news/' . $articleItem['id']; } } var_dump($pushArray); 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('/