|
@@ -87,6 +87,7 @@ class AiView(View):
|
|
|
|
|
|
logger.info('uid={uid}'.format(uid=uid))
|
|
|
logger.info('n_time={n_time}'.format(n_time=n_time))
|
|
|
+ now_time = int(time.time())
|
|
|
|
|
|
##通过uid查出endTime是否过期,并且ai开关是否打开
|
|
|
AiServiceQuery = AiService.objects.filter(uid=uid, detect_status=1, use_status=1, endTime__gt=receiveTime). \
|
|
@@ -194,9 +195,25 @@ class AiView(View):
|
|
|
if not nickname:
|
|
|
nickname = uid
|
|
|
|
|
|
+ # 推送表存储数据
|
|
|
+ equipment_info_kwargs = {
|
|
|
+ 'device_uid': uid,
|
|
|
+ 'device_nick_name': nickname,
|
|
|
+ 'channel': channel,
|
|
|
+ 'is_st': 3,
|
|
|
+ 'storage_location': 2,
|
|
|
+ 'event_type': eventType,
|
|
|
+ 'event_time': n_time,
|
|
|
+ 'add_time': now_time,
|
|
|
+ 'alarm': label_str,
|
|
|
+ 'border_coords': new_bounding_box_dict
|
|
|
+ }
|
|
|
+
|
|
|
eq_list = []
|
|
|
userID_ids = []
|
|
|
local_date_time = ''
|
|
|
+ equipment_info_list = []
|
|
|
+ equipment_info_model = EquipmentInfoService.randoms_choice_equipment_info()
|
|
|
for up in uid_push_list:
|
|
|
push_type = up['push_type']
|
|
|
appBundleId = up['appBundleId']
|
|
@@ -211,20 +228,8 @@ class AiView(View):
|
|
|
# 以下是存库
|
|
|
userID_id = up["userID_id"]
|
|
|
if userID_id not in userID_ids:
|
|
|
- now_time = int(time.time())
|
|
|
- EquipmentInfoService.randoms_insert_equipment_info(
|
|
|
- device_user_id=userID_id,
|
|
|
- event_time=n_time,
|
|
|
- event_type=eventType,
|
|
|
- device_uid=uid,
|
|
|
- device_nick_name=nickname,
|
|
|
- channel=channel,
|
|
|
- alarm=label_str,
|
|
|
- is_st=3,
|
|
|
- add_time=now_time,
|
|
|
- storage_location=2,
|
|
|
- border_coords=json.dumps(new_bounding_box_dict)
|
|
|
- )
|
|
|
+ equipment_info_kwargs['device_user_id'] = userID_id
|
|
|
+ equipment_info_list.append(equipment_info_model(**equipment_info_kwargs))
|
|
|
userID_ids.append(userID_id)
|
|
|
|
|
|
# 推送标题
|
|
@@ -255,6 +260,8 @@ class AiView(View):
|
|
|
continue
|
|
|
week = LocalDateTimeUtil.date_to_week(local_date_time)
|
|
|
AiView.save_cloud_ai_tag(uid, int(n_time), eventType, week)
|
|
|
+ if equipment_info_list:
|
|
|
+ equipment_info_model.objects.bulk_create(equipment_info_list)
|
|
|
return response.json(0)
|
|
|
|
|
|
except Exception as e:
|