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
61f0ada2
Commit
61f0ada2
authored
Jul 22, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
d62d40fe
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
4 deletions
+40
-4
workspace.xml
.idea/workspace.xml
+0
-0
answer_reply1.py
answer_reply1.py
+8
-4
auto_request.py
auto_request.py
+32
-0
No files found.
.idea/workspace.xml
View file @
61f0ada2
This diff is collapsed.
Click to expand it.
answer_reply1.py
View file @
61f0ada2
...
...
@@ -4,7 +4,8 @@ import logging
import
datetime
import
json
from
log_settings
import
*
from
auto_request
import
login
,
time_conv_minute
,
get_answer_data
,
reply_answer
,
set_reply_to_redis
,
reply2
from
auto_request
import
login
,
time_conv_minute
,
get_answer_data
,
reply_answer
,
set_reply_to_redis
,
reply2
,
logins
,
\
get_majia
,
get_majia_reply
from
auto_request
import
host
,
user
,
db
,
passwd
...
...
@@ -49,7 +50,8 @@ if __name__ == "__main__":
reply_data_comment
=
[]
if
user_id
:
for
i
in
user_id
:
cook
=
login
()
majia_user_id
=
get_majia
()
cook
=
logins
(
majia_user_id
)
comment1
,
comment2
=
get_answer_data
()
logging
.
info
(
"get comment1:
%
s"
%
comment1
)
logging
.
info
(
"get comment2:
%
s"
%
comment2
)
...
...
@@ -61,7 +63,8 @@ if __name__ == "__main__":
reply_user_id
=
data_dict
[
"data"
][
"user"
][
"id"
]
topic_id
=
i
[
1
]
reply_data_comment
.
append
(
{
"id"
:
reply_id
,
"reply_user_id"
:
reply_user_id
,
"answer"
:
comment2
,
"topic_id"
:
topic_id
})
{
"id"
:
reply_id
,
"reply_user_id"
:
reply_user_id
,
"answer"
:
comment2
,
"topic_id"
:
topic_id
,
"majia_user_id"
:
majia_user_id
})
redis_client
=
set_reply_to_redis
()
redis_client
.
hset
(
redis_key1
,
str
(
minute
),
json
.
dumps
(
reply_data_comment
))
...
...
@@ -73,7 +76,8 @@ if __name__ == "__main__":
redis_client
.
hdel
(
redis_key1
,
str
(
minute
-
5
))
if
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"
])
except
:
...
...
auto_request.py
View file @
61f0ada2
...
...
@@ -46,6 +46,22 @@ db = DATABASES['default']['NAME']
passwd
=
DATABASES
[
'default'
][
'PASSWORD'
]
def
get_majia_reply
(
user_id
):
try
:
data
=
open
(
"/srv/apps/cybertron/batch_user_gen"
)
list
=
[]
for
i
in
data
:
if
i
!=
user_id
:
list
.
append
(
i
.
strip
(
'
\n
'
)
.
strip
(
','
))
maj
=
random
.
randint
(
1
,
len
(
list
))
user_id
=
list
[
maj
-
1
]
return
user_id
except
:
logging
.
error
(
"catch exception,get_majia:
%
s"
%
traceback
.
format_exc
())
return
None
def
get_majia
():
try
:
data
=
open
(
"/srv/apps/cybertron/batch_user_gen"
)
...
...
@@ -98,6 +114,22 @@ def login():
return
None
def
logins
(
user_id
):
try
:
cookies
=
get_cookies
(
user_id
)
if
cookies
is
not
None
:
return
{
'sessionid'
:
cookies
}
except
:
logging
.
error
(
"catch exception,logins:
%
s"
%
traceback
.
format_exc
())
return
None
def
click
(
cookies_get
,
id
):
try
:
post_dict
=
{
...
...
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