From 7c663867e8208aeb86a8a15238f8f8ad80765541 Mon Sep 17 00:00:00 2001 From: toom1996 Date: Mon, 14 Jul 2025 19:18:29 +0800 Subject: [PATCH] update --- app/Command/baidu/AutoPush.php | 200 +++++++++++++++++++++++++++++++++ 1 file changed, 200 insertions(+) create mode 100644 app/Command/baidu/AutoPush.php diff --git a/app/Command/baidu/AutoPush.php b/app/Command/baidu/AutoPush.php new file mode 100644 index 0000000..6a4134a --- /dev/null +++ b/app/Command/baidu/AutoPush.php @@ -0,0 +1,200 @@ +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('/