|
@@ -201,30 +201,31 @@ class Mvp:
|
|
|
self.shangju_db.add_some(module_insert_sql, module_insert_data)
|
|
|
print('模块分数更新完成...')
|
|
|
|
|
|
- for key in behavior_score.keys():
|
|
|
- insert_sql = self.get_insert_sql(key)
|
|
|
- if insert_sql:
|
|
|
- insert_data = []
|
|
|
- score = behavior_score[key]
|
|
|
- for data in score:
|
|
|
- city = data[0]
|
|
|
- age = data[1]
|
|
|
- tag_name = data[2]
|
|
|
- crowd = data[3]
|
|
|
- tag_score = data[4]
|
|
|
- for id in ids:
|
|
|
- city_1 = id[2]
|
|
|
- age_1 = id[1]
|
|
|
- crowd_1 = id[3]
|
|
|
- id_1 = id[0]
|
|
|
- if city == city_1 and self.age_dict[age] == age_1 and crowd == crowd_1:
|
|
|
- insert_data.append([id_1, tag_name, tag_score])
|
|
|
- if len(insert_data) > 0:
|
|
|
- self.shangju_db.truncate(key)
|
|
|
- self.shangju_db.add_some(insert_sql, insert_data)
|
|
|
- else:
|
|
|
- print('未找到对应的表,数据无法插入...')
|
|
|
- print('行为分数更新完成...')
|
|
|
+ for b_score in behavior_score:
|
|
|
+ for key in b_score.keys():
|
|
|
+ insert_sql = self.get_insert_sql(key)
|
|
|
+ if insert_sql:
|
|
|
+ insert_data = []
|
|
|
+ score = b_score[key]
|
|
|
+ for data in score:
|
|
|
+ city = data[0]
|
|
|
+ age = data[1]
|
|
|
+ tag_name = data[2]
|
|
|
+ crowd = data[3]
|
|
|
+ tag_score = data[4]
|
|
|
+ for id in ids:
|
|
|
+ city_1 = id[2]
|
|
|
+ age_1 = id[1]
|
|
|
+ crowd_1 = id[3]
|
|
|
+ id_1 = id[0]
|
|
|
+ if city == city_1 and self.age_dict[age] == age_1 and crowd == crowd_1:
|
|
|
+ insert_data.append([id_1, tag_name, tag_score])
|
|
|
+ if len(insert_data) > 0:
|
|
|
+ self.shangju_db.truncate(key)
|
|
|
+ self.shangju_db.add_some(insert_sql, insert_data)
|
|
|
+ else:
|
|
|
+ print('未找到对应的表,数据无法插入...')
|
|
|
+ print('行为分数更新完成...')
|
|
|
|
|
|
def module_score(self, crowd, city, age, scores):
|
|
|
"""
|
|
@@ -367,7 +368,7 @@ class Mvp:
|
|
|
print('{}-{}-{}'.format(city, age, crowd_type))
|
|
|
datas = self.behavior_tag_init(city, age, people_uuids)
|
|
|
data_start.append(datas)
|
|
|
- all_data, behavior_data_1 = self.calculation_standard_score(datas, city, age, crowd)
|
|
|
+ all_data, behavior_data_1 = self.calculation_standard_score(datas, city, age, crowd_type)
|
|
|
result.append(all_data)
|
|
|
behavior_data = behavior_data_1
|
|
|
if behavior_data:
|