Commit 29af2e6c authored by litaolemo's avatar litaolemo

update

parent f46acb3e
...@@ -189,10 +189,13 @@ WHERE spam_pv.device_id IS NULL ...@@ -189,10 +189,13 @@ WHERE spam_pv.device_id IS NULL
if portratit_res[demand]: if portratit_res[demand]:
try: try:
for tag in portratit_res[demand][0:3]: for tag in portratit_res[demand][0:3]:
if tag in portrait_dict[demand]: if tag == "吸脂瘦下颌缘" and demand == "projects":
print(res.device_id)
if tag in portrait_dict[demand]:
portrait_dict[demand][tag] += 1 portrait_dict[demand][tag] += 1
else: else:
portrait_dict[demand][tag] = 1 portrait_dict[demand][tag] = 1
except Exception as e: except Exception as e:
print("error ", e) print("error ", e)
...@@ -206,27 +209,27 @@ WHERE spam_pv.device_id IS NULL ...@@ -206,27 +209,27 @@ WHERE spam_pv.device_id IS NULL
print("-------------------------------") print("-------------------------------")
for protratit_type in portrait_dict["projects"]: # for protratit_type in portrait_dict["projects"]:
partition_date = today_str # partition_date = today_str
pid = hashlib.md5((partition_date + protratit_type).encode("utf8")).hexdigest() # pid = hashlib.md5((partition_date + protratit_type).encode("utf8")).hexdigest()
action_count = portrait_dict["projects"][protratit_type] # action_count = portrait_dict["projects"][protratit_type]
#
instert_sql = """replace into new_user_project_count( # instert_sql = """replace into new_user_project_count(
partition_day,pid,protratit_count,protratit_type) VALUES('{partition_day}','{pid}',{protratit_count},'{protratit_type}');""".format( # partition_day,pid,protratit_count,protratit_type) VALUES('{partition_day}','{pid}',{protratit_count},'{protratit_type}');""".format(
partition_day=today_str, pid=pid, protratit_count=action_count # partition_day=today_str, pid=pid, protratit_count=action_count
, protratit_type=protratit_type # , protratit_type=protratit_type
) # )
print(instert_sql) # print(instert_sql)
# cursor.execute("set names 'UTF8'") # # cursor.execute("set names 'UTF8'")
db = pymysql.connect(host='172.16.40.158', port=4000, user='st_user', passwd='aqpuBLYzEV7tML5RPsN1pntUzFy', # db = pymysql.connect(host='172.16.40.158', port=4000, user='st_user', passwd='aqpuBLYzEV7tML5RPsN1pntUzFy',
db='jerry_prod') # db='jerry_prod')
cursor = db.cursor() # cursor = db.cursor()
res = cursor.execute(instert_sql) # res = cursor.execute(instert_sql)
db.commit() # db.commit()
print(res) # print(res)
# cursor.executemany() # cursor.executemany()
db.close() # 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