|
@@ -121,10 +121,10 @@ class Mvp:
|
|
|
# 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_module = self.module_score(crowd, city, age, scores_behavioral['score'])
|
|
|
- result = {'行为兴趣分值': scores_behavioral['score'], '模块分值': scores_module}
|
|
|
+ # scores_module = self.module_score(crowd, city, age, scores_behavioral['score'])
|
|
|
+ #result = {'行为兴趣分值': scores_behavioral['score'], '模块分值': scores_module}
|
|
|
print('update finished!!!')
|
|
|
- return result
|
|
|
+ return scores_behavioral
|
|
|
|
|
|
def module_score(self, crowd, city, age, scores):
|
|
|
"""
|
|
@@ -178,6 +178,7 @@ class Mvp:
|
|
|
def city_age_crowd(self, city=None, age=None, crowd=None):
|
|
|
data_start = []
|
|
|
result = []
|
|
|
+ module_scores = []
|
|
|
if city is not None and age is not None and crowd is not None:
|
|
|
print('获取指定城市,年龄段,人群类型的数据...')
|
|
|
people_uuids = self.get_people_uuid_by_type(crowd)
|
|
@@ -186,6 +187,7 @@ class Mvp:
|
|
|
datas = self.behavior_tag_init(city, age, people_uuids)
|
|
|
data_start.append(datas)
|
|
|
result.extend(self.calculation_standard_score(datas, city, age, crowd))
|
|
|
+ module_scores.extend(self.module_score(crowd, city, age, result))
|
|
|
pass
|
|
|
else:
|
|
|
print('获取所有case的数据...')
|
|
@@ -200,17 +202,18 @@ class Mvp:
|
|
|
datas = self.behavior_tag_init(city, age, people_uuids)
|
|
|
data_start.append(datas)
|
|
|
result.extend(self.calculation_standard_score(datas, city, age, crowd_type))
|
|
|
+ module_scores.extend(self.module_score(crowd_type, city, age, result))
|
|
|
# return result
|
|
|
- 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_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 {'tag_score': result, 'module_score': module_scores}
|
|
|
# return {'score': result, 'data': data_list}
|
|
|
|
|
|
def behavior_tag_init(self, city, age, people_uuids):
|