Commit 8809c9e1 authored by lixiaofang's avatar lixiaofang

add

parent 62fb3e98
This diff is collapsed.
...@@ -3,7 +3,8 @@ import traceback ...@@ -3,7 +3,8 @@ import traceback
import logging import logging
import json import json
from log_settings import * from log_settings import *
from auto_request import login, reply, get_comment, time_conv, get_answer_data, reply_answer, set_reply_to_redis from auto_request import logins, reply, get_comment, time_conv, get_answer_data, reply_answer, get_majia, \
set_reply_to_redis
from auto_request import host, user, db, passwd from auto_request import host, user, db, passwd
...@@ -49,7 +50,8 @@ if __name__ == "__main__": ...@@ -49,7 +50,8 @@ if __name__ == "__main__":
reply_data_comment = [] reply_data_comment = []
if user_id: if user_id:
for i in user_id: for i in user_id:
cook = login() majia_user_id = get_majia()
cook = logins(majia_user_id)
comment1, comment2 = get_answer_data() comment1, comment2 = get_answer_data()
if cook is not None: if cook is not None:
response = reply_answer(cook, i[1], comment1) response = reply_answer(cook, i[1], comment1)
...@@ -58,11 +60,11 @@ if __name__ == "__main__": ...@@ -58,11 +60,11 @@ if __name__ == "__main__":
reply_id = data_dict["data"]["id"] reply_id = data_dict["data"]["id"]
reply_user_id = data_dict["data"]["user"]["id"] reply_user_id = data_dict["data"]["user"]["id"]
reply_data_comment.append( reply_data_comment.append(
{"id": reply_id, "reply_user_id": reply_user_id, "answer": comment2, "topic_id": i[1]}) {"id": reply_id, "reply_user_id": reply_user_id, "answer": comment2, "topic_id": i[1],
"majia_user_id": majia_user_id})
redis_client = set_reply_to_redis() redis_client = set_reply_to_redis()
redis_client.set(redis_key, json.dumps(reply_data_comment)) redis_client.set(redis_key, json.dumps(reply_data_comment))
except: except:
logging.error("catch exception,main:%s" % traceback.format_exc()) logging.error("catch exception,main:%s" % traceback.format_exc())
...@@ -3,7 +3,8 @@ import traceback ...@@ -3,7 +3,8 @@ import traceback
import logging import logging
import json import json
from log_settings import * from log_settings import *
from auto_request import login, reply, get_comment, time_conv, get_answer_data, reply_answer, set_reply_to_redis from auto_request import logins, reply, get_comment, time_conv, get_answer_data, reply_answer, set_reply_to_redis, \
get_majia
from auto_request import host, user, db, passwd from auto_request import host, user, db, passwd
...@@ -49,7 +50,8 @@ if __name__ == "__main__": ...@@ -49,7 +50,8 @@ if __name__ == "__main__":
reply_data_comment = [] reply_data_comment = []
if user_id: if user_id:
for i in user_id: for i in user_id:
cook = login() majia_user_id = get_majia()
cook = logins(majia_user_id)
comment1, comment2 = get_answer_data() comment1, comment2 = get_answer_data()
if cook is not None: if cook is not None:
response = reply_answer(cook, i[1], comment1) response = reply_answer(cook, i[1], comment1)
...@@ -58,7 +60,8 @@ if __name__ == "__main__": ...@@ -58,7 +60,8 @@ if __name__ == "__main__":
reply_id = data_dict["data"]["id"] reply_id = data_dict["data"]["id"]
reply_user_id = data_dict["data"]["user"]["id"] reply_user_id = data_dict["data"]["user"]["id"]
reply_data_comment.append( reply_data_comment.append(
{"id": reply_id, "reply_user_id": reply_user_id, "answer": comment2, "topic_id": i[1]}) {"id": reply_id, "reply_user_id": reply_user_id, "answer": comment2, "topic_id": i[1],
"majia_user_id": majia_user_id})
redis_client = set_reply_to_redis() redis_client = set_reply_to_redis()
redis_client.set(redis_key1, json.dumps(reply_data_comment)) redis_client.set(redis_key1, json.dumps(reply_data_comment))
......
...@@ -3,7 +3,7 @@ import redis ...@@ -3,7 +3,7 @@ import redis
import logging import logging
import json import json
from log_settings import * from log_settings import *
from auto_request import set_reply_to_redis, reply2, login from auto_request import set_reply_to_redis, reply2, logins, get_majia_reply
if __name__ == "__main__": if __name__ == "__main__":
...@@ -14,7 +14,8 @@ if __name__ == "__main__": ...@@ -14,7 +14,8 @@ if __name__ == "__main__":
result = json.loads(str(have_reply1, encoding="utf-8")) result = json.loads(str(have_reply1, encoding="utf-8"))
if result: if result:
for item in result: for item in result:
cook = login() majia_user_id = get_majia_reply(item["majia_user_id"])
cook = logins(majia_user_id)
reply2(cook, item["topic_id"], item["answer"], item["id"]) reply2(cook, item["topic_id"], item["answer"], item["id"])
redis_client.delete(redis_key1) redis_client.delete(redis_key1)
except: except:
......
...@@ -3,7 +3,7 @@ import redis ...@@ -3,7 +3,7 @@ import redis
import logging import logging
import json import json
from log_settings import * from log_settings import *
from auto_request import set_reply_to_redis, reply2, login from auto_request import set_reply_to_redis, reply2, logins,get_majia_reply
if __name__ == "__main__": if __name__ == "__main__":
...@@ -14,7 +14,8 @@ if __name__ == "__main__": ...@@ -14,7 +14,8 @@ if __name__ == "__main__":
result = json.loads(str(have_reply1, encoding="utf-8")) result = json.loads(str(have_reply1, encoding="utf-8"))
if result: if result:
for item in result: for item in result:
cook = login() majia_user_id = get_majia_reply(item["majia_user_id"])
cook = logins(majia_user_id)
reply2(cook, item["topic_id"], item["answer"], item["id"]) reply2(cook, item["topic_id"], item["answer"], item["id"])
redis_client.delete(redis_key1) redis_client.delete(redis_key1)
except: except:
......
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