Commit 70cb568f authored by 任婷婷's avatar 任婷婷

.

parent 71558f3b
......@@ -29,6 +29,8 @@ def make_dict_from_pair(x):
def update_tag3_user_portrait(cl_id):
user_df = get_tag3_user_log(cl_id)
print('*'*100)
print('user_df',user_df)
if not user_df.empty:
user_df["first_solutions"] = list(zip(user_df["first_solutions"].apply(lambda x: x.split(",")), user_df["tag_score"]))
user_df["second_solutions"] = list(zip(user_df["second_solutions"].apply(lambda x: x.split(",")), user_df["tag_score"]))
......@@ -96,10 +98,10 @@ def update_tag3_user_portrait(cl_id):
# redis_client.set(key2, json.dumps(res2))
# redis_client.expire(key2, 60 * 60 * 24 * 30)
# print('*'*10)
write_user_portrait(cl_id, ",".join(first_solutions_score.keys()), ",".join(second_solutions_score.keys()),
",".join(first_demands_score.keys()), ",".join(second_demands_score.keys()),
",".join(first_positions_score.keys()), ",".join(second_positions_score.keys()),
",".join(projects_score.keys()))
# write_user_portrait(cl_id, ",".join(first_solutions_score.keys()), ",".join(second_solutions_score.keys()),
# ",".join(first_demands_score.keys()), ",".join(second_demands_score.keys()),
# ",".join(first_positions_score.keys()), ",".join(second_positions_score.keys()),
# ",".join(projects_score.keys()))
first_solutions = []
first_positions = []
......@@ -111,12 +113,13 @@ def update_tag3_user_portrait(cl_id):
# cl_ids = [1, 3]
print('*'*100)
print('cl_ids',cl_id)
print('INPUT cl_ids:',cl_id)
print('OUTPUT data:')
print(data)
data = user_portrait_action_statistic(cl_id)
for key, values in data.items():
cl_id_single = key
print("val", values.keys())
for item in values.keys():
if values[item]:
first_solutions = values[item].get("first_solutions", [])
......
......@@ -120,7 +120,7 @@ if __name__ == '__main__':
projects = []
# cl_ids = [1,3]
cl_ids = ['3D878D3E-9C19-4CC9-BB7A-0082B38996F2', '03BF3310-C5AF-4049-8041-DC5ECE927A81']
cl_ids = '3D878D3E-9C19-4CC9-BB7A-0082B38996F2'
data = user_portrait_action_statistic(cl_ids)
for key, values in data.items():
......
......@@ -446,8 +446,7 @@ def get_user_portrait_log(cl_id):
# try:
sql = """select cl_id,event_cn, first_solutions, second_solutions, first_demands,
second_demands, first_positions, second_positions, projects
from kafka_tag3_log where cl_id in {} """.format(tuple(cl_id))
print("sql", sql)
from kafka_tag3_log where cl_id = '{}' """.format(cl_id)
db, cursor = get_jerry_test()
cursor.execute(sql)
data = list(cursor.fetchall())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment