|
...
|
...
|
@@ -60,7 +60,29 @@ class FetchTicketProjects extends Command |
|
|
|
$postids = [];
|
|
|
|
|
|
|
|
while (true) {
|
|
|
|
$response = Http::get('https://www.quanqiusou.cn/extend_api/webs/globalso_all.php?page=' . $page);
|
|
|
|
try {
|
|
|
|
$maxRetries = 3;
|
|
|
|
$retryCount = 0;
|
|
|
|
|
|
|
|
while ($retryCount < $maxRetries) {
|
|
|
|
try {
|
|
|
|
$response = Http::get('https://www.quanqiusou.cn/extend_api/webs/globalso_all.php?page=' . $page);
|
|
|
|
break; // 如果请求成功,跳出重试循环
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
$retryCount++;
|
|
|
|
if ($retryCount >= $maxRetries) {
|
|
|
|
// 如果达到最大重试次数,抛出异常
|
|
|
|
throw $e;
|
|
|
|
}
|
|
|
|
// 等待一段时间再重试
|
|
|
|
sleep(2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}catch (\Exception $e){
|
|
|
|
echo now() . " | ERROR | " . $e->getMessage() . "\n" . $e->getTraceAsString() . "\n";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($response->status() == 200) {
|
|
|
|
$resp_json = $response->json();
|
|
|
|
$items = $resp_json['data'] ?? [];
|
...
|
...
|
|