|
@@ -1028,18 +1028,23 @@ class SmartSceneView(View):
|
|
|
@param request_dict:
|
|
|
@return: bool, True: 冲突, False: 不冲突
|
|
|
"""
|
|
|
+ # 不设置时间不会冲突
|
|
|
+ if is_all_day is None:
|
|
|
+ return False
|
|
|
+
|
|
|
+ # 查询设置过时间的数据
|
|
|
smart_scene_qs = SmartScene.objects.filter(
|
|
|
- ~Q(effective_time_id=0),
|
|
|
+ ~Q(is_all_day=0),
|
|
|
sub_device_id=sub_device_id,
|
|
|
conditions=conditions).values('effective_time_id')
|
|
|
if not smart_scene_qs.exists():
|
|
|
return False
|
|
|
|
|
|
- if is_all_day is None: # 不设置时间不会冲突
|
|
|
- return False
|
|
|
- elif is_all_day == 1: # 全天必冲突
|
|
|
+ # 再设置全天必冲突
|
|
|
+ if is_all_day == 1:
|
|
|
return True
|
|
|
- elif is_all_day == 2: # 非全天判断effective_time_id
|
|
|
+ # 非全天判断effective_time_id
|
|
|
+ elif is_all_day == 2:
|
|
|
start_time = int(request_dict.get('startTime', None))
|
|
|
end_time = int(request_dict.get('endTime', None))
|
|
|
int(request_dict.get('repeat', None))
|