Commit fe8ae258 authored by 吴升宇's avatar 吴升宇

fix conflicts

parents e29a263d d2a85655
crontab: crontab:
cp crontab.py /data/log/physical/app/crontab.py && python /data/log/physical/app/crontab.py && python /data/log/physical/app/crontabs.py cp crontab.py /data/log/physical/app/crontab.py && python /data/log/physical/app/crontab.py && python /data/log/physical/app/crontabs.py
celery: celery:
celery -A physcical worker -c 1 -Q vest -l debug celery -A physical worker -c 1 -Q vest -l debug
...@@ -23,18 +23,13 @@ def eta_2_push_time(eta): ...@@ -23,18 +23,13 @@ def eta_2_push_time(eta):
return push_time return push_time
def get_rand_time(hourlow=0, hourup=13, minutelow=0, miniteup=60): def get_rand_time(hourlow=0, hourup=13, minutelow=0, minuteup=60):
hours = random.randint(hourlow, hourup) hours = random.randint(hourlow, hourup)
minutes = random.randint(minutelow, miniteup) minutes = random.randint(minutelow, minuteup)
now_time = NOW + timedelta(hours=hours, minutes=minutes) # todo redis会自动给加8个小时,所以这边先写死减少8小时
now_time = NOW + timedelta(hours=hours, minutes=minutes) - timedelta(hours=8)
time = eta_2_push_time(now_time.strftime("%Y-%m-%d %H:%M:%S")) time = eta_2_push_time(now_time.strftime("%Y-%m-%d %H:%M:%S"))
print(datetime.fromtimestamp(time))
return datetime.fromtimestamp(time) return datetime.fromtimestamp(time)
...@@ -42,7 +42,7 @@ def batch_handle(auto_click_list): ...@@ -42,7 +42,7 @@ def batch_handle(auto_click_list):
try: try:
cookies = login() cookies = login()
if cookies is not None: if cookies is not None:
click.async_apply(args=(cookies, topic_id), eta=get_rand_time()) click.apply_async(args=(cookies, topic_id), eta=get_rand_time())
# click(cookies, topic_id) # click(cookies, topic_id)
except: except:
pass pass
......
...@@ -44,7 +44,7 @@ def batch_handle(auto_click_list): ...@@ -44,7 +44,7 @@ def batch_handle(auto_click_list):
cookies = login() cookies = login()
if cookies is not None: if cookies is not None:
# click(cookies, topic_id) # click(cookies, topic_id)
click.async_apply(args=(cookies, topic_id), eta=get_rand_time(hourup=1)) click.apply_async(args=(cookies, topic_id), eta=get_rand_time(hourup=1))
except: except:
pass pass
......
...@@ -30,7 +30,7 @@ def batch_handle(auto_follow_list): ...@@ -30,7 +30,7 @@ def batch_handle(auto_follow_list):
cookies = login() cookies = login()
if cookies is not None: if cookies is not None:
# follow(cookies, user_id) # follow(cookies, user_id)
follow.async_apply(args=(cookies, user_id), eta=get_rand_time()) follow.apply_async(args=(cookies, user_id), eta=get_rand_time())
except: except:
pass pass
......
...@@ -29,7 +29,7 @@ def batch_handle(auto_follow_list): ...@@ -29,7 +29,7 @@ def batch_handle(auto_follow_list):
cookies = login() cookies = login()
if cookies is not None: if cookies is not None:
# follow(cookies, user_id) # follow(cookies, user_id)
follow.async_apply(args=(cookies, user_id), eta=get_rand_time()) follow.apply_async(args=(cookies, user_id), eta=get_rand_time())
except: except:
pass pass
......
...@@ -41,7 +41,7 @@ def batch_handle(auto_follow_list): ...@@ -41,7 +41,7 @@ def batch_handle(auto_follow_list):
cookies = login() cookies = login()
if cookies is not None: if cookies is not None:
# follow(cookies, user_id) # follow(cookies, user_id)
follow.async_apply(args=(cookies, user_id), eta=get_rand_time(hourup=1)) follow.apply_async(args=(cookies, user_id), eta=get_rand_time(hourup=1))
except: except:
pass pass
......
...@@ -30,7 +30,7 @@ def auto_follow_per_5m_by_followed(): ...@@ -30,7 +30,7 @@ def auto_follow_per_5m_by_followed():
cookies = login(str(majia_user_ids_dict.get(str(user[1])))) cookies = login(str(majia_user_ids_dict.get(str(user[1]))))
if cookies is not None: if cookies is not None:
# follow(cookies, user_id) # follow(cookies, user_id)
follow.async_apply(args=(cookies, user_id), eta=get_rand_time()) follow.apply_async(args=(cookies, user_id), eta=get_rand_time())
except: except:
pass pass
......
...@@ -57,7 +57,7 @@ def batch_handle(pictorial_id_list): ...@@ -57,7 +57,7 @@ def batch_handle(pictorial_id_list):
if cookies is not None: if cookies is not None:
comment = judge_pictorial_info_get_comment(pictorial_id) comment = judge_pictorial_info_get_comment(pictorial_id)
# pictorial_reply(cookies, pictorial_id, comment) # pictorial_reply(cookies, pictorial_id, comment)
pictorial_reply.async_apply(args=(cookies, pictorial_id, comment), eta=get_rand_time()) pictorial_reply.apply_async(args=(cookies, pictorial_id, comment), eta=get_rand_time())
except: except:
pass pass
......
import pymysql import pymysql
import traceback import traceback
import logging import logging
import json
import random import random
from threading import Thread from threading import Thread
from vest.request.auto_request import login, time_convs, get_answer_data, reply_answer, get_majia, \ from vest.request.auto_request import login, time_convs, get_answer_data, reply_answer, get_majia, \
...@@ -34,13 +35,14 @@ def batch_handle(topic_id_list): ...@@ -34,13 +35,14 @@ def batch_handle(topic_id_list):
comment = judge_topic_info_get_comment(topic_id) comment = judge_topic_info_get_comment(topic_id)
if comment: if comment:
# reply(cookies, topic_id, comment) # reply(cookies, topic_id, comment)
reply.async_apply(args=(cookies, topic_id, comment), eta=get_rand_time()) reply.apply_async(args=(cookies, topic_id, comment), eta=get_rand_time())
else: else:
comment1, comment2 = get_answer_data() comment1, comment2 = get_answer_data()
response = reply_answer(cookies, topic_id, comment1) response = reply_answer(cookies, topic_id, comment1)
response = json.loads(response)
cookies = login() cookies = login()
reply_id = response["data"]["id"] reply_id = response["data"]["id"]
reply2.async_apply(args=(cookies, topic_id, comment2, reply_id), eta=get_rand_time()) reply2.apply_async(args=(cookies, topic_id, comment2, reply_id), eta=get_rand_time())
......
import pymysql import pymysql
import traceback import traceback
import logging import logging
import json
from threading import Thread from threading import Thread
from vest.request.auto_request import login, time_conv_hour, get_answer_data, reply_answer, get_majia, \ from vest.request.auto_request import login, time_conv_hour, get_answer_data, reply_answer, get_majia, \
set_reply_to_redis, judge_topic_info_get_comment, reply, reply2 set_reply_to_redis, judge_topic_info_get_comment, reply, reply2
...@@ -33,13 +34,14 @@ def batch_handle(topic_id_list): ...@@ -33,13 +34,14 @@ def batch_handle(topic_id_list):
comment = judge_topic_info_get_comment(topic_id) comment = judge_topic_info_get_comment(topic_id)
if comment: if comment:
# reply(cookies, topic_id, comment) # reply(cookies, topic_id, comment)
reply.async_apply(args=(cookies, topic_id, comment), eta=get_rand_time(hourup=1)) reply.apply_async(args=(cookies, topic_id, comment), eta=get_rand_time(hourup=1))
else: else:
comment1, comment2 = get_answer_data() comment1, comment2 = get_answer_data()
response = reply_answer(cookies, topic_id, comment1) response = reply_answer(cookies, topic_id, comment1)
response = json.loads(response)
cookies = login() cookies = login()
reply_id = response["data"]["id"] reply_id = response["data"]["id"]
reply2.async_apply(args=(cookies, topic_id, comment2, reply_id), eta=get_rand_time(hourup=1)) reply2.apply_async(args=(cookies, topic_id, comment2, reply_id), eta=get_rand_time(hourup=1))
except: except:
logging_exception() logging_exception()
......
...@@ -139,6 +139,7 @@ def click(cookies_get, id): ...@@ -139,6 +139,7 @@ def click(cookies_get, id):
cookies=cookies_get, cookies=cookies_get,
data=post_dict) data=post_dict)
print(response.text)
logging.info("response.text:%s" % response.text) logging.info("response.text:%s" % response.text)
get_error(response.text, "click", id) get_error(response.text, "click", id)
...@@ -159,6 +160,7 @@ def reply(cookies_get, id, content): ...@@ -159,6 +160,7 @@ def reply(cookies_get, id, content):
cookies=cookies_get, cookies=cookies_get,
data=post_dict) data=post_dict)
print(response.text)
logging.info("response.text:%s" % response.text) logging.info("response.text:%s" % response.text)
get_error(response.text, "reply", id) get_error(response.text, "reply", id)
except: except:
...@@ -281,6 +283,7 @@ def follow(cookies_get, id): ...@@ -281,6 +283,7 @@ def follow(cookies_get, id):
cookies=cookies_get, cookies=cookies_get,
data=post_dict) data=post_dict)
print(response.text)
logging.info("response.text:%s" % response.text) logging.info("response.text:%s" % response.text)
get_error(response.text, "follow", id) get_error(response.text, "follow", id)
except: except:
...@@ -448,6 +451,7 @@ def reply2(cookies_get, id, content, replied_id): ...@@ -448,6 +451,7 @@ def reply2(cookies_get, id, content, replied_id):
cookies=cookies_get, cookies=cookies_get,
data=post_dict) data=post_dict)
print(response.text)
logging.info("response.text:%s" % response.text) logging.info("response.text:%s" % response.text)
get_error(response.text, "reply2", id) get_error(response.text, "reply2", id)
except: except:
...@@ -467,6 +471,7 @@ def pictorial_reply(cookies_get, id, content): ...@@ -467,6 +471,7 @@ def pictorial_reply(cookies_get, id, content):
cookies=cookies_get, cookies=cookies_get,
data=post_dict) data=post_dict)
print(response.text)
logging.info("response.text:%s" % response.text) logging.info("response.text:%s" % response.text)
get_error(response.text, "pictorial_reply", id) get_error(response.text, "pictorial_reply", id)
except: except:
...@@ -610,7 +615,9 @@ def judge_topic_info_get_comment(topic_id): ...@@ -610,7 +615,9 @@ def judge_topic_info_get_comment(topic_id):
comment = get_face_comment() comment = get_face_comment()
# 原始评论 # 原始评论
else: else:
comment = get_comment() # 返回空就会去拿多级评论
if random.randint(0, 1):
comment = get_comment()
else: else:
# 判断有没有商品信息 # 判断有没有商品信息
...@@ -628,7 +635,9 @@ def judge_topic_info_get_comment(topic_id): ...@@ -628,7 +635,9 @@ def judge_topic_info_get_comment(topic_id):
comment = get_face_comment() comment = get_face_comment()
# 原始评论 # 原始评论
else: else:
comment = get_comment() # 返回空就会去拿多级评论
if random.randint(0, 1):
comment = get_comment()
logging.info("get judge_topic_info_get_comment:%s" % comment) logging.info("get judge_topic_info_get_comment:%s" % comment)
return comment return comment
......
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