소스 검색

限制获取天气频率

peng 1 년 전
부모
커밋
261637fe1b
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      Controller/WeatherControl.py

+ 1 - 1
Controller/WeatherControl.py

@@ -58,7 +58,7 @@ class WeatherView(View):
                 city_obj = WeatherInfo(city_id)
                 temp, humidity = city_obj.get_city_weather()
                 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]):
                 return response.json(10, '获取天气失败')
             return response.json(0, {'temp': temp, 'humidity': humidity})