Эх сурвалжийг харах

master添加异常日志7

tanghongbin 4 жил өмнө
parent
commit
8b77315511

+ 3 - 8
Controller/EquipmentManager.py

@@ -215,14 +215,9 @@ def modifyUserEquipmentInterface(request):
         if qs.exists():
             uid = qs[0].UID
             if uid == '98UXAA8BRPA35VAL111A':
-                file_path = '/'.join((BASE_DIR, 'static/add_device.log'))
-                file = open(file_path, 'a+')
-                file.write(
-                    CommonService.get_ip_address(request) + "; username:" + userID + "; time:" + time.strftime(
-                        "%Y-%m-%d %H:%M:%S", time.localtime()) + "; modifyV1")
-                file.write('\n')
-                file.flush()
-                file.close()
+                asy = threading.Thread(target=ModelService.add_log,
+                                       args=(CommonService.get_ip_address(request), userID, 'modifyV0'))
+                asy.start()
             nickname = qs[0].NickName
             # 增加设备影子信息修改昵称 start
             us_qs = UidSetModel.objects.filter(uid=uid)