Browse Source

flask_app: 调整接口返回结果结构

Signed-off-by: binren <zhangbr@elab-plus.com>
binren 5 years ago
parent
commit
c93ed79fd0
1 changed files with 10 additions and 1 deletions
  1. 10 1
      flask_app.py

+ 10 - 1
flask_app.py

@@ -200,7 +200,16 @@ class Mvp:
                                 data_start.append(datas)
                                 result.extend(self.calculation_standard_score(datas, city, age, crowd_type))
         # return result
-        return {'score': result, 'data': data_start}
+        data_list = []
+        for e in data_start:
+            for key in e.keys():
+                values = e[key]
+                for sub_e in values:
+                    ele = [key]
+                    ele.extend(sub_e)
+                    data_list.append(ele)
+            pass
+        return {'score': result, 'data': data_list}
 
     def behavior_tag_init(self, city, age, people_uuids):
         result = {}