Browse Source

fix a bug cased by upgrading arrow module

highing666 3 years ago
parent
commit
e23dc1830e
2 changed files with 4 additions and 4 deletions
  1. 1 1
      app/controllers/targets/temperature.py
  2. 3 3
      app/services/transfer.py

+ 1 - 1
app/controllers/targets/temperature.py

@@ -190,7 +190,7 @@ class TemporaryTargetBuilder:
 
     def build(self) -> Dict:
         now_str = get_time_str()
-        time_index = arrow.get(arrow.get(now_str, TIME_FMT).shift(minutes=15).timestamp
+        time_index = arrow.get(arrow.get(now_str, TIME_FMT).shift(minutes=15).timestamp()
                                // (15 * 60) * (15 * 60)).time().strftime('%H%M%S')
         return {time_index: [self.lower_target, self.upper_target]}
 

+ 3 - 3
app/services/transfer.py

@@ -41,7 +41,7 @@ class SpaceInfoService(Service):
 
     async def is_customized(self) -> bool:
         url = self._base_url.join('duoduo-service/custom-service/custom/timetarget')
-        time_str = arrow.get(arrow.get(self._now_time, TIME_FMT).shift(minutes=15).timestamp
+        time_str = arrow.get(arrow.get(self._now_time, TIME_FMT).shift(minutes=15).timestamp()
                              // 900 * 900).strftime('%Y%m%d%H%M%S')
         params = {
             'projectId': self._project_id,
@@ -121,7 +121,7 @@ class SpaceInfoService(Service):
             current_targets = targets.get('pre_targets').append(targets.get('normal_targets'))
         else:
             current_targets = targets.get('normal_targets')
-        temp = arrow.get(self._now_time, TIME_FMT).shift(minutes=15).timestamp // (15 * 60) * (15 * 60)
+        temp = arrow.get(self._now_time, TIME_FMT).shift(minutes=15).timestamp() // (15 * 60) * (15 * 60)
         next_quarter_minutes = arrow.get(temp).time().strftime('%H%M%S')
         try:
             current_lower_target = current_targets['temperatureMin'].loc[next_quarter_minutes]
@@ -134,7 +134,7 @@ class SpaceInfoService(Service):
     async def env_database_set(self, form: str, value: float) -> None:
         url = self._base_url.join('duoduo-service/transfer/environment/hispoint/set')
         params = self._common_parameters()
-        time_str = arrow.get(arrow.get(self._now_time, TIME_FMT).timestamp // 900 * 900).strftime('%Y%m%d%H%M%S')
+        time_str = arrow.get(arrow.get(self._now_time, TIME_FMT).timestamp() // 900 * 900).strftime('%Y%m%d%H%M%S')
         params.update({'time': time_str, 'type': form, 'value': value})
         await self._get(url, params)