Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
cybertron
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alpha
cybertron
Commits
9afbd4e0
Commit
9afbd4e0
authored
Jul 12, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
8d9faa86
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
24 deletions
+8
-24
workspace.xml
.idea/workspace.xml
+0
-0
answer_reply1.py
answer_reply1.py
+3
-12
reply_comment1.py
reply_comment1.py
+5
-12
No files found.
.idea/workspace.xml
View file @
9afbd4e0
This diff is collapsed.
Click to expand it.
answer_reply1.py
View file @
9afbd4e0
...
...
@@ -44,8 +44,8 @@ if __name__ == "__main__":
logging
.
info
(
"comment answer one"
)
numtime1
,
numtime2
=
time_conv
(
5
,
0
)
user_id
=
get_data
(
numtime1
,
numtime2
)
redis_key1
=
"cybertron:set_reply_id:one
1
"
redis_key2
=
"cybertron:set_reply_id:one2"
redis_key1
=
"cybertron:set_reply_id:one"
#
redis_key2 = "cybertron:set_reply_id:one2"
reply_data_comment
=
[]
if
user_id
:
for
i
in
user_id
:
...
...
@@ -61,15 +61,6 @@ if __name__ == "__main__":
{
"id"
:
reply_id
,
"reply_user_id"
:
reply_user_id
,
"answer"
:
comment2
,
"topic_id"
:
i
[
1
]})
redis_client
=
set_reply_to_redis
()
have_reply
=
redis_client
.
get
(
redis_key1
)
if
have_reply
:
result
=
json
.
loads
(
str
(
have_reply
,
encoding
=
"utf-8"
))
if
result
:
redis_client
.
set
(
redis_key2
,
json
.
dumps
(
reply_data_comment
))
else
:
redis_client
.
set
(
redis_key1
,
json
.
dumps
(
reply_data_comment
))
else
:
redis_client
.
set
(
redis_key1
,
json
.
dumps
(
reply_data_comment
))
redis_client
.
hset
(
redis_key1
,
str
(
numtime1
),
reply_data_comment
)
except
:
logging
.
error
(
"catch exception,main:
%
s"
%
traceback
.
format_exc
())
reply_comment1.py
View file @
9afbd4e0
...
...
@@ -2,29 +2,22 @@ import traceback
import
redis
import
logging
import
json
import
datetime
from
auto_request
import
set_reply_to_redis
,
reply2
,
login
if
__name__
==
"__main__"
:
try
:
redis_key1
=
"cybertron:set_reply_id:one1"
redis_key2
=
"cybertron:set_reply_id:one2"
now
=
datetime
.
datetime
.
now
()
.
minute
redis_key1
=
"cybertron:set_reply_id:one"
redis_client
=
set_reply_to_redis
()
have_reply1
=
redis_client
.
get
(
redis_key1
)
have_reply1
=
redis_client
.
hget
(
redis_key1
,
now
-
5
)
result
=
json
.
loads
(
str
(
have_reply1
,
encoding
=
"utf-8"
))
if
result
:
for
item
in
result
:
cook
=
login
()
reply2
(
cook
,
item
[
"topic_id"
],
item
[
"answer"
],
item
[
"id"
])
redis_client
.
delete
(
redis_key1
)
else
:
have_reply2
=
redis_client
.
get
(
redis_key2
)
result
=
json
.
loads
(
str
(
have_reply2
,
encoding
=
"utf-8"
))
for
item
in
result
:
cook
=
login
()
reply2
(
cook
,
item
[
"topic_id"
],
item
[
"answer"
],
item
[
"id"
])
redis_client
.
delete
(
redis_key2
)
except
:
logging
.
error
(
"catch exception,main:
%
s"
%
traceback
.
format_exc
())
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment