Browse Source

数据写入文档

peng 1 year ago
parent
commit
5387c049b9
1 changed files with 4 additions and 1 deletions
  1. 4 1
      Controller/TestApi.py

+ 4 - 1
Controller/TestApi.py

@@ -34,6 +34,7 @@ from Ansjer.config import (
     SERVER_DOMAIN_SSL,
     SERVER_TYPE,
     CONFIG_TEST,
+    BASE_DIR
 )
 from Model.models import (
     CompanySerialModel,
@@ -1207,7 +1208,9 @@ class testView(View):
             return response.json(444)
         try:
             data = json.loads(data)
-            LOGGER.info('设备上传数据:{}'.format(data))
+            file = '{}/static/generic_report_push.txt'.format(BASE_DIR)
+            with open(file, 'w', encoding='utf-8') as f:
+                json.dump(data, f, indent='\t', ensure_ascii=False)
             return response.json(0)
         except Exception as e:
             return response.json(500, 'error_line:{}, error_msg:{}'.format(e.__traceback__.tb_lineno, repr(e)))