Browse Source

修复十进制转星期周期函数问题

locky 1 year ago
parent
commit
996784f164
1 changed files with 5 additions and 1 deletions
  1. 5 1
      Controller/SensorGateway/SmartSceneController.py

+ 5 - 1
Controller/SensorGateway/SmartSceneController.py

@@ -1315,7 +1315,11 @@ class SmartSceneView(View):
         next_day = 1 if is_next_day else 0
         next_day = 1 if is_next_day else 0
         for i, bit in enumerate(bin_str):
         for i, bit in enumerate(bin_str):
             if bit == '1':
             if bit == '1':
-                weeks += str(i+next_day) + ','
+                # 7 -> 0
+                week = i + next_day
+                if week == 7:
+                    week = 0
+                weeks += str(week) + ','
         # 删除最后一个逗号并返回结果
         # 删除最后一个逗号并返回结果
         return weeks[:-1]
         return weeks[:-1]