浏览代码

设备昵称存在表情存表失败问题

locky 1 年之前
父节点
当前提交
09b8d40024
共有 2 个文件被更改,包括 8 次插入5 次删除
  1. 4 5
      Controller/DetectControllerV2.py
  2. 4 0
      Service/DevicePushService.py

+ 4 - 5
Controller/DetectControllerV2.py

@@ -128,11 +128,10 @@ class NotificationV2View(View):
                       'uid_set_push_list': uid_set_push_list}
 
             # 异步推送消息和保存数据
-            push_and_save_data(**params)
-            # push_thread = threading.Thread(
-            #     target=push_and_save_data,
-            #     kwargs=params)
-            # push_thread.start()
+            push_thread = threading.Thread(
+                target=push_and_save_data,
+                kwargs=params)
+            push_thread.start()
 
             # 视频通话不返回图片链接
             if event_type == 607:

+ 4 - 0
Service/DevicePushService.py

@@ -249,6 +249,10 @@ class DevicePushService:
 
                 for equipment_info in equipment_info_redis_list:
                     equipment_info_data = eval(equipment_info)
+                    # 设备昵称存在表情,解码utf-8
+                    if equipment_info_data.get('device_nick_name') is not None:
+                        equipment_info_data['device_nick_name'] = equipment_info_data['device_nick_name'].\
+                            encode('UTF-8', 'ignore').decode('UTF-8')
                     equipment_info_list.append(equipment_info_model(**equipment_info_data))
                 equipment_info_model.objects.bulk_create(equipment_info_list)