|
|
|
|
@ -54,7 +54,9 @@ class FenZhenService
|
|
|
|
|
//把接口请求成功的缓存到本地txt
|
|
|
|
|
$txtName=$api_dates[$key].'created_at'.date('Y-m-d H:m:s');
|
|
|
|
|
$TxtfilePath = 'fenzhen_tongji_temp/'.$txtName.'.txt';
|
|
|
|
|
Storage::put($TxtfilePath, $responseBody);
|
|
|
|
|
if($api_dates[$key]<date('Y-m-d')){
|
|
|
|
|
Storage::put($TxtfilePath, $responseBody);
|
|
|
|
|
}
|
|
|
|
|
$res=json_decode($responseBody,true);
|
|
|
|
|
// echo "Response from $key: " . $response->getBody() . "\n";
|
|
|
|
|
$table_list = array_merge($table_list, $res['data']['table1'] ?? []);
|
|
|
|
|
@ -323,14 +325,9 @@ class FenZhenService
|
|
|
|
|
// 使用 basename 获取文件名
|
|
|
|
|
$fileName = basename($file);
|
|
|
|
|
|
|
|
|
|
// 检查文件名是否匹配给定的模式
|
|
|
|
|
if (preg_match('/^(.+?)created_at(\d{4}-\d{2}-\d{2}).+\.txt$/', $fileName, $matches)) {
|
|
|
|
|
list(, $namePart, $createdAtDate) = $matches;
|
|
|
|
|
|
|
|
|
|
// 如果日期部分和创建日期符合条件,则返回该文件
|
|
|
|
|
if ($namePart === $datePart && $createdAtDate === $todayFormatted) {
|
|
|
|
|
return $file; // 返回找到的文件路径
|
|
|
|
|
}
|
|
|
|
|
// 检查文件名是否以前缀 $datePart 开头
|
|
|
|
|
if (strpos($fileName, $datePart) === 0) {
|
|
|
|
|
return $file; // 返回找到的文件路径
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|