|
@@ -58,7 +58,7 @@ class WeatherView(View):
|
|
city_obj = WeatherInfo(city_id)
|
|
city_obj = WeatherInfo(city_id)
|
|
temp, humidity = city_obj.get_city_weather()
|
|
temp, humidity = city_obj.get_city_weather()
|
|
if temp and humidity:
|
|
if temp and humidity:
|
|
- redis_obj.set_ex_data('city_id_{}_weather'.format(city_id), '{}/{}'.format(temp, humidity), 600)
|
|
|
|
|
|
+ redis_obj.set_ex_data('city_id_{}_weather'.format(city_id), '{}/{}'.format(temp, humidity), 1800)
|
|
if not all([temp, humidity]):
|
|
if not all([temp, humidity]):
|
|
return response.json(10, '获取天气失败')
|
|
return response.json(10, '获取天气失败')
|
|
return response.json(0, {'temp': temp, 'humidity': humidity})
|
|
return response.json(0, {'temp': temp, 'humidity': humidity})
|