Commit 4043f4d5 authored by lixiaofang's avatar lixiaofang

add

parent 603a0d28
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="7b835479-ee84-40d6-9b97-0e9285d92119" name="Default Changelist" comment="" /> <list default="true" id="7b835479-ee84-40d6-9b97-0e9285d92119" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/answer_reply1.py" beforeDir="false" afterPath="$PROJECT_DIR$/answer_reply1.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
...@@ -24,13 +27,13 @@ ...@@ -24,13 +27,13 @@
<usages-collector id="statistics.file.extensions.edit"> <usages-collector id="statistics.file.extensions.edit">
<counts> <counts>
<entry key="dummy" value="1" /> <entry key="dummy" value="1" />
<entry key="py" value="1018" /> <entry key="py" value="1033" />
</counts> </counts>
</usages-collector> </usages-collector>
<usages-collector id="statistics.file.types.edit"> <usages-collector id="statistics.file.types.edit">
<counts> <counts>
<entry key="PLAIN_TEXT" value="1" /> <entry key="PLAIN_TEXT" value="1" />
<entry key="Python" value="1018" /> <entry key="Python" value="1033" />
</counts> </counts>
</usages-collector> </usages-collector>
</session> </session>
...@@ -40,11 +43,11 @@ ...@@ -40,11 +43,11 @@
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/auto_request.py"> <entry file="file://$PROJECT_DIR$/auto_request.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="378"> <state relative-caret-position="109">
<caret line="354" column="49" selection-start-line="354" selection-start-column="49" selection-end-line="354" selection-end-column="49" /> <caret line="27" column="32" lean-forward="true" selection-start-line="27" selection-start-column="21" selection-end-line="27" selection-end-column="32" />
<folding> <folding>
<element signature="e#0#15#0" expanded="true" /> <element signature="e#0#15#0" expanded="true" />
<marker date="1562917088000" expanded="true" signature="9493:9498" ph="..." /> <marker date="1562917613000" expanded="true" signature="9513:9518" ph="..." />
</folding> </folding>
</state> </state>
</provider> </provider>
...@@ -62,8 +65,8 @@ ...@@ -62,8 +65,8 @@
<file pinned="false" current-in-tab="true"> <file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/answer_reply1.py"> <entry file="file://$PROJECT_DIR$/answer_reply1.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="199"> <state relative-caret-position="202">
<caret line="62" lean-forward="true" selection-start-line="62" selection-end-line="62" /> <caret line="48" column="31" lean-forward="true" selection-start-line="48" selection-start-column="31" selection-end-line="48" selection-end-column="31" />
<folding> <folding>
<element signature="e#0#14#0" expanded="true" /> <element signature="e#0#14#0" expanded="true" />
</folding> </folding>
...@@ -222,6 +225,7 @@ ...@@ -222,6 +225,7 @@
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="0" y="23" width="1280" height="717" extended-state="0" /> <frame x="0" y="23" width="1280" height="717" extended-state="0" />
<editor active="true" />
<layout> <layout>
<window_info id="Structure" order="0" sideWeight="0.21188119" side_tool="true" weight="0.19112115" /> <window_info id="Structure" order="0" sideWeight="0.21188119" side_tool="true" weight="0.19112115" />
<window_info id="Favorites" order="1" side_tool="true" /> <window_info id="Favorites" order="1" side_tool="true" />
...@@ -235,7 +239,7 @@ ...@@ -235,7 +239,7 @@
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" /> <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
<window_info anchor="bottom" id="TODO" order="6" /> <window_info anchor="bottom" id="TODO" order="6" />
<window_info anchor="bottom" id="Version Control" order="7" show_stripe_button="false" /> <window_info anchor="bottom" id="Version Control" order="7" show_stripe_button="false" />
<window_info active="true" anchor="bottom" id="Terminal" order="8" sideWeight="0.49960285" visible="true" weight="0.32890365" /> <window_info active="true" anchor="bottom" id="Terminal" order="8" sideWeight="0.49960285" visible="true" weight="0.0" />
<window_info anchor="bottom" id="Event Log" order="9" sideWeight="0.50039715" side_tool="true" weight="0.32890365" /> <window_info anchor="bottom" id="Event Log" order="9" sideWeight="0.50039715" side_tool="true" weight="0.32890365" />
<window_info anchor="bottom" id="Python Console" order="10" /> <window_info anchor="bottom" id="Python Console" order="10" />
<window_info anchor="bottom" id="DB Execution Console" order="11" /> <window_info anchor="bottom" id="DB Execution Console" order="11" />
...@@ -465,31 +469,31 @@ ...@@ -465,31 +469,31 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/auto_request.py"> <entry file="file://$PROJECT_DIR$/reply_comment1.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="378"> <state relative-caret-position="150">
<caret line="354" column="49" selection-start-line="354" selection-start-column="49" selection-end-line="354" selection-end-column="49" /> <caret line="10" column="8" selection-start-line="10" selection-start-column="8" selection-end-line="10" selection-end-column="44" />
<folding> <folding>
<element signature="e#0#15#0" expanded="true" /> <element signature="e#0#16#0" expanded="true" />
<marker date="1562917088000" expanded="true" signature="9493:9498" ph="..." />
</folding> </folding>
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/reply_comment1.py"> <entry file="file://$PROJECT_DIR$/auto_request.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="150"> <state relative-caret-position="109">
<caret line="10" column="8" selection-start-line="10" selection-start-column="8" selection-end-line="10" selection-end-column="44" /> <caret line="27" column="32" lean-forward="true" selection-start-line="27" selection-start-column="21" selection-end-line="27" selection-end-column="32" />
<folding> <folding>
<element signature="e#0#16#0" expanded="true" /> <element signature="e#0#15#0" expanded="true" />
<marker date="1562917613000" expanded="true" signature="9513:9518" ph="..." />
</folding> </folding>
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/answer_reply1.py"> <entry file="file://$PROJECT_DIR$/answer_reply1.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="199"> <state relative-caret-position="202">
<caret line="62" lean-forward="true" selection-start-line="62" selection-end-line="62" /> <caret line="48" column="31" lean-forward="true" selection-start-line="48" selection-start-column="31" selection-end-line="48" selection-end-column="31" />
<folding> <folding>
<element signature="e#0#14#0" expanded="true" /> <element signature="e#0#14#0" expanded="true" />
</folding> </folding>
......
...@@ -4,7 +4,7 @@ import logging ...@@ -4,7 +4,7 @@ import logging
import datetime import datetime
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 login, time_conv_minute, get_answer_data, reply_answer, set_reply_to_redis
from auto_request import host, user, db, passwd from auto_request import host, user, db, passwd
...@@ -43,7 +43,7 @@ if __name__ == "__main__": ...@@ -43,7 +43,7 @@ if __name__ == "__main__":
try: try:
logging.info("comment answer one") logging.info("comment answer one")
numtime1, numtime2 = time_conv(5, 0) numtime1, numtime2, minute = time_conv_minute(5, 0)
user_id = get_data(numtime1, numtime2) user_id = get_data(numtime1, numtime2)
redis_key1 = "cybertron:set_reply_id:one" redis_key1 = "cybertron:set_reply_id:one"
reply_data_comment = [] reply_data_comment = []
...@@ -53,7 +53,6 @@ if __name__ == "__main__": ...@@ -53,7 +53,6 @@ if __name__ == "__main__":
comment1, comment2 = get_answer_data() comment1, comment2 = get_answer_data()
logging.info("get comment1:%s" % comment1) logging.info("get comment1:%s" % comment1)
logging.info("get comment2:%s" % comment2) logging.info("get comment2:%s" % comment2)
if cook is not None: if cook is not None:
response = reply_answer(cook, i[1], comment1) response = reply_answer(cook, i[1], comment1)
if len(response) > 1: if len(response) > 1:
...@@ -64,7 +63,7 @@ if __name__ == "__main__": ...@@ -64,7 +63,7 @@ if __name__ == "__main__":
{"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]})
redis_client = set_reply_to_redis() redis_client = set_reply_to_redis()
now = datetime.datetime.now().minute logging.info("get nowwwwwwwww:%s" % minute)
redis_client.hset(redis_key1, str(now), reply_data_comment) redis_client.hset(redis_key1, str(minute), reply_data_comment)
except: except:
logging.error("catch exception,main:%s" % traceback.format_exc()) logging.error("catch exception,main:%s" % traceback.format_exc())
...@@ -143,6 +143,17 @@ def time_conv(minutest, minutest2): ...@@ -143,6 +143,17 @@ def time_conv(minutest, minutest2):
return None return None
def time_conv_minute(minutest, minutest2):
try:
now = datetime.datetime.now()
minute = datetime.datetime.now().minute
yes_time = now - datetime.timedelta(minutes=minutest)
yes_time2 = now - datetime.timedelta(minutes=minutest2)
return yes_time, yes_time2, minute
except:
return None
def time_now(minutest): def time_now(minutest):
try: try:
now = datetime.datetime.now() now = datetime.datetime.now()
......
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