Commit 184cc208 authored by litaolemo's avatar litaolemo

update

parent f912ba9e
......@@ -40,6 +40,17 @@ def con_sql(sql):
return result
second_demands_zero_dict = {
"answer":{},
"tractate":{},
"diary":{},
}
project_zero_dict = {
"answer":{},
"tractate":{},
"diary":{},
}
bulk_dict = {
0: [0, 0, 0],
10: [0, 0, 0],
......@@ -67,6 +78,21 @@ for redis_count,res in enumerate(user_portrait_scan):
for key in tag:
total_answer_content, total_tractate_content, total_diary_content, sum_num = \
tag[key]
if not total_answer_content:
if second_demands_zero_dict["answer"].get(key):
second_demands_zero_dict["answer"][key] += 1
else:
second_demands_zero_dict["answer"][key] = 1
if not total_tractate_content:
if second_demands_zero_dict["tractate"].get(key):
second_demands_zero_dict["tractate"][key] += 1
else:
second_demands_zero_dict["tractate"][key] = 1
if not total_diary_content:
if second_demands_zero_dict["diary"].get(key):
second_demands_zero_dict["diary"][key] += 1
else:
second_demands_zero_dict["diary"][key] = 1
total_answer_content_num += total_answer_content
total_tractate_content_num += total_tractate_content
total_diary_content_num += total_diary_content
......@@ -79,6 +105,21 @@ for redis_count,res in enumerate(user_portrait_scan):
for key in tag:
total_answer_content, total_tractate_content, total_diary_content, sum_num = \
tag[key]
if not total_answer_content:
if project_zero_dict["answer"].get(key):
project_zero_dict["answer"][key] += 1
else:
project_zero_dict["answer"][key] = 1
if not total_tractate_content:
if project_zero_dict["tractate"].get(key):
project_zero_dict["tractate"][key] += 1
else:
project_zero_dict["tractate"][key] = 1
if not total_diary_content:
if project_zero_dict["diary"].get(key):
project_zero_dict["diary"][key] += 1
else:
project_zero_dict["diary"][key] = 1
total_answer_content_num += total_answer_content
total_tractate_content_num += total_tractate_content
total_diary_content_num += total_diary_content
......@@ -131,7 +172,7 @@ for redis_count,res in enumerate(user_portrait_scan):
bulk_dict[1000][2] += 1
# print(bulk_dict)
if redis_count % 5000 == 0:
if redis_count % 50000 == 0:
print(redis_count)
for page_type in range(3):
if page_type == 0:
......@@ -156,6 +197,8 @@ for redis_count,res in enumerate(user_portrait_scan):
res = cursor.execute(instert_sql)
db.commit()
# print(res)
print(second_demands_zero_dict)
print(project_zero_dict)
for page_type in range(3):
......@@ -171,13 +214,13 @@ for page_type in range(3):
page_type,num_type,num_value,pid) VALUES('{page_type_str}','{num_type}',{num_value},'{pid}');""".format(
page_type_str=page_type_str,pid=pid ,num_type=str(count_num),num_value=bulk_dict[count_num][page_type]
)
print(instert_sql)
# print(instert_sql)
# cursor.execute("set names 'UTF8'")
db = pymysql.connect(host='172.16.40.158', port=4000, user='st_user', passwd='aqpuBLYzEV7tML5RPsN1pntUzFy',
db='jerry_prod')
cursor = db.cursor()
res = cursor.execute(instert_sql)
db.commit()
print(res)
# print(res)
# cursor.executemany()
db.close()
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