update
This commit is contained in:
@ -44,25 +44,33 @@ class AutoPush extends BaseSpider
|
||||
{
|
||||
$url = AppWebsiteConfig::query()->select(['app_domain', 'id'])->where('is_delete', 0)->get()->toArray();
|
||||
$pushArray = [];
|
||||
$push = function () use (&$pushArray) {
|
||||
$ch = curl_init();
|
||||
$options = array(
|
||||
CURLOPT_URL => $this->baseUrl,
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_POSTFIELDS => implode("\n", $pushArray),
|
||||
CURLOPT_HTTPHEADER => array('Content-Type: text/plain'),
|
||||
);
|
||||
curl_setopt_array($ch, $options);
|
||||
$result = curl_exec($ch);
|
||||
$pushArray = [];
|
||||
var_dump($result);
|
||||
};
|
||||
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'];
|
||||
}
|
||||
if ($pushArray) {
|
||||
$push();
|
||||
}
|
||||
}
|
||||
|
||||
$ch = curl_init();
|
||||
$options = array(
|
||||
CURLOPT_URL => $this->baseUrl,
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_POSTFIELDS => implode("\n", $pushArray),
|
||||
CURLOPT_HTTPHEADER => array('Content-Type: text/plain'),
|
||||
);
|
||||
curl_setopt_array($ch, $options);
|
||||
$result = curl_exec($ch);
|
||||
|
||||
// echo $result;
|
||||
var_dump($result);
|
||||
// var_dump($result);
|
||||
|
||||
var_dump($pushArray);
|
||||
|
||||
|
Reference in New Issue
Block a user