|
@@ -128,8 +128,13 @@ class WeatherSvc extends Service
|
|
|
$now['category']=$airQuality['category']??'优';
|
|
|
$now['aqi']=$airQuality['aqi']??'22';
|
|
|
$now['obsTime']=Carbon::parse($now['obsTime'])->format('m-d H:i');
|
|
|
- $now['tempMin']=$now['temp'];
|
|
|
- $now['tempMax']=$now['temp']+mt_rand(1,5);
|
|
|
+ if(isset($daily[0])){
|
|
|
+ $now['tempMin'] = $daily[0]['tempMin'];
|
|
|
+ $now['tempMax'] = $daily[0]['tempMax'];
|
|
|
+ }else {
|
|
|
+ $now['tempMin'] = $now['temp'];
|
|
|
+ $now['tempMax'] = $now['temp'] + mt_rand(1, 5);
|
|
|
+ }
|
|
|
}
|
|
|
return compact('hourly','daily','index','now');
|
|
|
}
|