Commit ffc94efc authored by 赵威's avatar 赵威

add tag3 update user portrait

parent 25060603
from tool import get_tag3_user_log
if __name__ == "__main__":
log = get_tag3_user_log("866017030837899")
print(log)
......@@ -36,8 +36,8 @@ def send_email(app,id,e):
try:
with open('error.txt','w') as f:
f.write(e)
f.close()
f.write(e)
f.close()
part = MIMEApplication(open('error.txt', 'r').read())
part.add_header('Content-Disposition', 'attachment', filename="error.txt")
msg.attach(part)
......@@ -353,3 +353,31 @@ def get_user_log(cl_id, all_word_tags, pay_time=0, debug=0):
return user_df_service
def get_jerry_test_cursor():
db = pymysql.connect(host="172.16.40.158",
port=4000,
user="st_user",
passwd="aqpuBLYzEV7tML5RPsN1pntUzFy",
db="jerry_test",
charset="utf8")
return db.cursor()
def get_tag3_user_log(cl_id):
columns = [
"log_time", "cl_id", "tag_referrer", "score_type", "action", "event", "event_cn", "first_solutions",
"second_solutions", "first_demands", "second_demands", "first_positions", "second_positions",
"projects", "card_type"
]
sql = """select log_time, cl_id, tag_referrer, score_type, action, event, event_cn, first_solutions,
second_solutions, first_demands, second_demands, first_positions, second_positions,
projects, card_type from kafka_tag3_log where cl_id = '{}'""".format(cl_id)
cursor = get_jerry_test_cursor()
cursor.execute(sql)
data = list(cursor.fetchall())
if data:
user_df = pd.DataFrame(data)
user_df.columns = columns
else:
return pd.DataFrame(columns=columns)
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