Commit 0a15553d authored by 吴升宇's avatar 吴升宇

fix setting and 解析response

parent b86d6452
...@@ -42,9 +42,10 @@ def batch_handle(topic_id_list): ...@@ -42,9 +42,10 @@ def batch_handle(topic_id_list):
response = reply_answer(cookies, topic_id, comment1) response = reply_answer(cookies, topic_id, comment1)
response = json.loads(response) response = json.loads(response)
cookies = login() cookies = login()
reply_id = response["data"]["id"] reply_id = response["data"].get('id')
time = get_rand_time() if reply_id:
reply2.apply_async(args=(cookies, topic_id, comment2, reply_id), eta=time) time = get_rand_time()
reply2.apply_async(args=(cookies, topic_id, comment2, reply_id), eta=time)
......
...@@ -41,9 +41,10 @@ def batch_handle(topic_id_list): ...@@ -41,9 +41,10 @@ def batch_handle(topic_id_list):
response = reply_answer(cookies, topic_id, comment1) response = reply_answer(cookies, topic_id, comment1)
response = json.loads(response) response = json.loads(response)
cookies = login() cookies = login()
reply_id = response["data"]["id"] reply_id = response["data"].get('id')
time = get_rand_time(hourup=0) if reply_id:
reply2.apply_async(args=(cookies, topic_id, comment2, reply_id), eta=time) time = get_rand_time(hourup=0)
reply2.apply_async(args=(cookies, topic_id, comment2, reply_id), eta=time)
except: except:
logging_exception() logging_exception()
......
...@@ -122,7 +122,7 @@ def click(cookies_get, id): ...@@ -122,7 +122,7 @@ def click(cookies_get, id):
return return
else: else:
click_cache.set(click_key, 1) click_cache.set(click_key, 1)
click_cache.expire(click_key, settings.cache_seconds) click_cache.expire(click_key, settings.CACHE_SECONDS)
# 点赞 # 点赞
try: try:
...@@ -164,7 +164,7 @@ def reply(cookies_get, id, content): ...@@ -164,7 +164,7 @@ def reply(cookies_get, id, content):
return return
else: else:
reply_cache.set(reply_key, 1) reply_cache.set(reply_key, 1)
reply_cache.expire(reply_key, settings.cache_seconds) reply_cache.expire(reply_key, settings.CACHE_SECONDS)
try: try:
post_dict = { post_dict = {
'topic_id': id, 'topic_id': id,
...@@ -295,7 +295,7 @@ def follow(cookies_get, id): ...@@ -295,7 +295,7 @@ def follow(cookies_get, id):
return return
else: else:
follow_cache.set(follow_key, 1) follow_cache.set(follow_key, 1)
follow_cache.expire(follow_key, settings.cache_seconds) follow_cache.expire(follow_key, settings.CACHE_SECONDS)
try: try:
post_dict = { post_dict = {
'type': 1, 'type': 1,
...@@ -468,7 +468,7 @@ def reply2(cookies_get, id, content, replied_id): ...@@ -468,7 +468,7 @@ def reply2(cookies_get, id, content, replied_id):
return return
else: else:
reply_cache.set(reply_key, 1) reply_cache.set(reply_key, 1)
reply_cache.expire(reply_key, settings.cache_seconds) reply_cache.expire(reply_key, settings.CACHE_SECONDS)
try: try:
post_dict = { post_dict = {
'topic_id': id, 'topic_id': id,
...@@ -496,7 +496,7 @@ def pictorial_reply(cookies_get, id, content): ...@@ -496,7 +496,7 @@ def pictorial_reply(cookies_get, id, content):
return return
else: else:
reply_cache.set(reply_key, 1) reply_cache.set(reply_key, 1)
reply_cache.expire(reply_key, settings.cache_seconds) reply_cache.expire(reply_key, settings.CACHE_SECONDS)
try: try:
post_dict = { post_dict = {
'pictorial_id': id, 'pictorial_id': id,
......
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