update
This commit is contained in:
@ -38,11 +38,19 @@ class AutoPush extends BaseSpider
|
|||||||
//2、API提交和手动提交共享配额,sitemap提交配额不与其他方式共享,具体配额以站点页面显示数据为准 。配额不可累计,当日有效。
|
//2、API提交和手动提交共享配额,sitemap提交配额不与其他方式共享,具体配额以站点页面显示数据为准 。配额不可累计,当日有效。
|
||||||
//3、若链接存在跳转关系,请直接提交跳转后链接。如网站换域名,需提交新域名资源;进行HTTPS改造页面,请提交HTTPS资源。
|
//3、若链接存在跳转关系,请直接提交跳转后链接。如网站换域名,需提交新域名资源;进行HTTPS改造页面,请提交HTTPS资源。
|
||||||
$this->setDescription('自动向百度推送');
|
$this->setDescription('自动向百度推送');
|
||||||
|
$this->addOption('platform', 'p', InputOption::VALUE_OPTIONAL, '指定的平台.', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function execute(InputInterface $input, OutputInterface $output): int
|
public function execute(InputInterface $input, OutputInterface $output): int
|
||||||
{
|
{
|
||||||
$url = AppWebsiteConfig::query()->select(['app_domain', 'id'])->where('is_delete', 0)->get()->toArray();
|
$query = AppWebsiteConfig::query()
|
||||||
|
->select(['app_domain', 'id'])
|
||||||
|
->where('is_delete', 0);
|
||||||
|
|
||||||
|
if ($id = $input->getOption('platform')) {
|
||||||
|
$query = $query->where('id', $id);
|
||||||
|
}
|
||||||
|
$query = $query->get()->toArray();
|
||||||
$pushArray = [];
|
$pushArray = [];
|
||||||
$push = function () use (&$pushArray) {
|
$push = function () use (&$pushArray) {
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
@ -58,7 +66,7 @@ class AutoPush extends BaseSpider
|
|||||||
$pushArray = [];
|
$pushArray = [];
|
||||||
var_dump($result);
|
var_dump($result);
|
||||||
};
|
};
|
||||||
foreach ($url as $item) {
|
foreach ($query as $item) {
|
||||||
$article = AppNews::query()->where('platform', $item['id'])->select(['id'])->get()->toArray();
|
$article = AppNews::query()->where('platform', $item['id'])->select(['id'])->get()->toArray();
|
||||||
foreach ($article as $articleItem) {
|
foreach ($article as $articleItem) {
|
||||||
$pushArray[] = 'https://' . $item['app_domain'] . '/news/' . $articleItem['id'];
|
$pushArray[] = 'https://' . $item['app_domain'] . '/news/' . $articleItem['id'];
|
||||||
|
Reference in New Issue
Block a user