Commit 1e2860ff authored by 赵威's avatar 赵威

get body

parent f0d5922a
......@@ -4,15 +4,17 @@ import json
import operator
from collections import Counter
import pymysql
import pytz
import redis
from pyspark import SparkConf
from pyspark.sql import SparkSession
import pymysql
from es_tool import es_insert_device_info
from tool import (get_doris_prod, get_jerry_test, get_redis_client, get_tag3_user_log, get_user_portrait_tag3_from_redis,
get_user_portrait_tag3_with_score, send_email, write_user_portrait, write_user_portrait_by_event,
write_user_portrait_doris)
from pyspark import SparkConf
from pyspark.sql import SparkSession
from tool import (get_doris_prod, get_jerry_test, get_redis_client,
get_tag3_user_log, get_user_portrait_tag3_from_redis,
get_user_portrait_tag3_with_score, send_email, write_user_portrait,
write_user_portrait_by_event, write_user_portrait_doris)
# [{'激光': 1.949194898204873}, {'手术': 1.949194898204873}, {'手术': 1.949194898204873}, {'手术': 1.949194898204873, '植发际线': 7.1}]
......@@ -261,7 +263,6 @@ def update_tag3_user_portrait(cl_id):
anecdote_tags_scores = get_user_portrait_tag3_with_score(cl_id).get("anecdote_tags", {})
res["anecdote_tags"] = anecdote_tags_scores
print(res)
if (len(first_demands_score.keys()) > 0) or (len(second_demands_score.keys()) > 0) or \
(len(first_solutions_score.keys()) > 0) or (len(second_solutions_score.keys()) > 0) or \
......@@ -277,6 +278,17 @@ def update_tag3_user_portrait(cl_id):
# ",".join(first_positions_score.keys()), ",".join(second_positions_score.keys()),
# ",".join(projects_score.keys()))
body = {}
for (k, v) in res.items():
body[k] = list(v.keys())
body["device_id"] = cl_id
body["last_modified"] = datetime.datetime.strftime(datetime.datetime.now(pytz.timezone("Asia/Shanghai")),
"%Y-%m-%dT%H:%M:%S.%f")[:-7] + "Z"
print(body)
# es_insert_device_info(cl_id, body)
# # write_user_portrait_doris(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()),
......
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