Commit 8c673fe3 authored by lixiaofang's avatar lixiaofang

add

parent 6e5b6d60
This diff is collapsed.
...@@ -30,7 +30,7 @@ def get_data(numtime): ...@@ -30,7 +30,7 @@ def get_data(numtime):
return topic_id_list return topic_id_list
except: except:
logging.error("catch exception,get_data:%s" % traceback.format_exc()) logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None return []
if __name__ == "__main__": if __name__ == "__main__":
......
...@@ -19,6 +19,7 @@ def get_data(numtime): ...@@ -19,6 +19,7 @@ def get_data(numtime):
data = cursor.fetchall() data = cursor.fetchall()
topic_id = list(data) topic_id = list(data)
topic_id_list = [] topic_id_list = []
if topic_id:
for i in topic_id: for i in topic_id:
cursor.execute( cursor.execute(
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0") "select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0")
...@@ -32,7 +33,7 @@ def get_data(numtime): ...@@ -32,7 +33,7 @@ def get_data(numtime):
except: except:
logging.error("catch exception,get_data:%s" % traceback.format_exc()) logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None return []
if __name__ == "__main__": if __name__ == "__main__":
...@@ -49,6 +50,8 @@ if __name__ == "__main__": ...@@ -49,6 +50,8 @@ if __name__ == "__main__":
dict = {} dict = {}
if user_id:
for i in user_id: for i in user_id:
if i[0] not in dict.keys(): if i[0] not in dict.keys():
......
...@@ -22,6 +22,7 @@ def get_topic_id(numtime): ...@@ -22,6 +22,7 @@ def get_topic_id(numtime):
topic_id = list(data) topic_id = list(data)
logging.info("Database version : %s " % topic_id) logging.info("Database version : %s " % topic_id)
topic_id_list = [] topic_id_list = []
if topic_id:
for i in topic_id: for i in topic_id:
cursor.execute( cursor.execute(
"select user_id from user_extra where user_id =" + str(i[1]) + " and is_shadow =0 ") "select user_id from user_extra where user_id =" + str(i[1]) + " and is_shadow =0 ")
...@@ -35,7 +36,7 @@ def get_topic_id(numtime): ...@@ -35,7 +36,7 @@ def get_topic_id(numtime):
return topic_id_list return topic_id_list
except: except:
logging.error("catch exception,get_data:%s" % traceback.format_exc()) logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None return []
if __name__ == "__main__": if __name__ == "__main__":
...@@ -52,6 +53,8 @@ if __name__ == "__main__": ...@@ -52,6 +53,8 @@ if __name__ == "__main__":
dicts = {} dicts = {}
if topic_id:
for i in topic_id: for i in topic_id:
if i[1] not in dicts.keys(): if i[1] not in dicts.keys():
......
...@@ -25,6 +25,7 @@ def get_topic_new_user(numtime): ...@@ -25,6 +25,7 @@ def get_topic_new_user(numtime):
new_user_data = list(new_user_data) new_user_data = list(new_user_data)
topic_id_list = [] topic_id_list = []
if topic_data :
for i in topic_data: for i in topic_data:
cursor.execute( cursor.execute(
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0") "select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0")
...@@ -33,6 +34,7 @@ def get_topic_new_user(numtime): ...@@ -33,6 +34,7 @@ def get_topic_new_user(numtime):
if user_id: if user_id:
topic_id_list.append(i) topic_id_list.append(i)
if new_user_data:
for i in new_user_data: for i in new_user_data:
cursor.execute( cursor.execute(
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0") "select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0")
...@@ -46,7 +48,7 @@ def get_topic_new_user(numtime): ...@@ -46,7 +48,7 @@ def get_topic_new_user(numtime):
return topic_id_list return topic_id_list
except: except:
logging.error("catch exception,get_data:%s" % traceback.format_exc()) logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None return []
if __name__ == "__main__": if __name__ == "__main__":
...@@ -60,6 +62,8 @@ if __name__ == "__main__": ...@@ -60,6 +62,8 @@ if __name__ == "__main__":
for i in range(follow_num): for i in range(follow_num):
if user_id:
for j in user_id: for j in user_id:
id = int(j[0]) id = int(j[0])
......
...@@ -19,6 +19,7 @@ def get_data(numtime): ...@@ -19,6 +19,7 @@ def get_data(numtime):
data = cursor.fetchall() data = cursor.fetchall()
user_id = list(data) user_id = list(data)
topic_id_list = [] topic_id_list = []
if user_id:
for i in user_id: for i in user_id:
cursor.execute( cursor.execute(
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0") "select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0")
...@@ -31,7 +32,7 @@ def get_data(numtime): ...@@ -31,7 +32,7 @@ def get_data(numtime):
return topic_id_list return topic_id_list
except: except:
logging.error("catch exception,get_data:%s" % traceback.format_exc()) logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None return []
if __name__ == "__main__": if __name__ == "__main__":
...@@ -52,6 +53,8 @@ if __name__ == "__main__": ...@@ -52,6 +53,8 @@ if __name__ == "__main__":
for i in range(follow_num): for i in range(follow_num):
if user_id:
for j in user_id: for j in user_id:
id = int(j[0]) id = int(j[0])
......
...@@ -26,7 +26,7 @@ def get_follw_majia(numtime): ...@@ -26,7 +26,7 @@ def get_follw_majia(numtime):
return data return data
except: except:
logging.error("catch exception,get_data:%s" % traceback.format_exc()) logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None return []
if __name__ == "__main__": if __name__ == "__main__":
...@@ -39,6 +39,8 @@ if __name__ == "__main__": ...@@ -39,6 +39,8 @@ if __name__ == "__main__":
dict_follow_id = {} dict_follow_id = {}
if data:
for j in data: for j in data:
if j[2] != None: if j[2] != None:
...@@ -54,6 +56,8 @@ if __name__ == "__main__": ...@@ -54,6 +56,8 @@ if __name__ == "__main__":
dict_email = {} dict_email = {}
if data:
for j in data: for j in data:
if j[2] != None: if j[2] != None:
......
...@@ -50,7 +50,7 @@ def get_commnet_id(numtime): ...@@ -50,7 +50,7 @@ def get_commnet_id(numtime):
data_reply = list(data_reply_reply) data_reply = list(data_reply_reply)
topic_id_list = [] topic_id_list = []
for i in data_id: for i in data_id and data_id:
cursor.execute( cursor.execute(
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0 ") "select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0 ")
data = cursor.fetchall() data = cursor.fetchall()
...@@ -58,7 +58,7 @@ def get_commnet_id(numtime): ...@@ -58,7 +58,7 @@ def get_commnet_id(numtime):
if user_id: if user_id:
topic_id_list.append(i) topic_id_list.append(i)
for i in data1_id: for i in data1_id and data1_id:
cursor.execute( cursor.execute(
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0 ") "select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0 ")
data = cursor.fetchall() data = cursor.fetchall()
...@@ -66,7 +66,7 @@ def get_commnet_id(numtime): ...@@ -66,7 +66,7 @@ def get_commnet_id(numtime):
if user_id: if user_id:
topic_id_list.append(i) topic_id_list.append(i)
for i in data2_id: for i in data2_id and data2_id:
cursor.execute( cursor.execute(
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0 ") "select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0 ")
data = cursor.fetchall() data = cursor.fetchall()
...@@ -74,7 +74,7 @@ def get_commnet_id(numtime): ...@@ -74,7 +74,7 @@ def get_commnet_id(numtime):
if user_id: if user_id:
topic_id_list.append(i) topic_id_list.append(i)
for i in data3_id: for i in data3_id and data3_id:
cursor.execute( cursor.execute(
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0 ") "select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0 ")
data = cursor.fetchall() data = cursor.fetchall()
...@@ -82,15 +82,7 @@ def get_commnet_id(numtime): ...@@ -82,15 +82,7 @@ def get_commnet_id(numtime):
if user_id: if user_id:
topic_id_list.append(i) topic_id_list.append(i)
for i in data1_id: for i in data_reply and data_reply:
cursor.execute(
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0 ")
data = cursor.fetchall()
user_id = list(data)
if user_id:
topic_id_list.append(i)
for i in data_reply:
cursor.execute( cursor.execute(
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0 ") "select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0 ")
data = cursor.fetchall() data = cursor.fetchall()
...@@ -113,7 +105,7 @@ if __name__ == "__main__": ...@@ -113,7 +105,7 @@ if __name__ == "__main__":
user_id = get_commnet_id(numtime) user_id = get_commnet_id(numtime)
for j in user_id: for j in user_id and user_id:
id = int(j[0]) id = int(j[0])
......
...@@ -19,7 +19,7 @@ def get_data(numtime): ...@@ -19,7 +19,7 @@ def get_data(numtime):
data = cursor.fetchall() data = cursor.fetchall()
user_id = list(data) user_id = list(data)
topic_id_list = [] topic_id_list = []
for i in user_id: for i in user_id and user_id:
cursor.execute( cursor.execute(
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0 ") "select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0 ")
data = cursor.fetchall() data = cursor.fetchall()
...@@ -42,7 +42,7 @@ if __name__ == "__main__": ...@@ -42,7 +42,7 @@ if __name__ == "__main__":
user_id = get_data(numtime) user_id = get_data(numtime)
urge_num = random.randint(0, 1) urge_num = random.randint(0, 1)
for j in range(urge_num): for j in range(urge_num):
for i in user_id: for i in user_id and user_id:
id = int(i[0]) id = int(i[0])
time.sleep(random.randint(10, 30)) time.sleep(random.randint(10, 30))
cook = login() cook = login()
......
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