Jelajahi Sumber

mvp: 修改返回值结构

Signed-off-by: binren <zhangbr@elab-plus.com>
binren 5 tahun lalu
induk
melakukan
713bc2958e
1 mengubah file dengan 5 tambahan dan 3 penghapusan
  1. 5 3
      mvp.py

+ 5 - 3
mvp.py

@@ -397,7 +397,7 @@ class Mvp:
         #             datas.append([question, option, data[0][3], data[0][1], key, corr])
         # self.shangju_db.truncate('mvp_question_classification')
         # self.shangju_db.add_some(self.sql_3, datas)
-        scores_behavioral = self.city_age_crowd(city, age, crowd)
+        scores_behavioral = self.city_age_crowd(city, age, crowd, 1)
         # scores_module = self.module_score(crowd, city, age, scores_behavioral['score'])
         # result = {'行为兴趣分值': scores_behavioral['score'], '模块分值': scores_module}
         print('update finished!!!')
@@ -715,7 +715,7 @@ class Mvp:
         # # print([x[0] for x in age_info])
         # return [x[0] for x in age_info if x[0] is not None]
 
-    def city_age_crowd(self, city=None, age=None, crowd=None):
+    def city_age_crowd(self, city=None, age=None, crowd=None, is_data=None):
         data_start = []
         result = []
         module_scores = []
@@ -742,6 +742,8 @@ class Mvp:
         #             ele.extend(sub_e)
         #             data_list.append(ele)
         #     pass
+        if is_data == 1:
+            return {'behavior_score': result, 'module_score': module_scores, 'fzfm': data_start}
         return {'behavior_score': result, 'module_score': module_scores}
         # return {'score': result, 'data': data_list}
 
@@ -751,7 +753,7 @@ class Mvp:
         for city in self.city_list:
             for age in self.age_list:
                 for crowd in self.crowd:
-                    data = self.city_age_crowd(city, age, crowd)
+                    data = self.city_age_crowd(city, age, crowd, 1)
                     behavior_score.extend(data['behavior_score'])
                     module_scores.extend(data['module_score'])
         return {'behavior_score': behavior_score, 'module_score': module_scores}