Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
physical
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
physical
Commits
2703571b
Commit
2703571b
authored
Apr 20, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
e57e74f3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
95 additions
and
49 deletions
+95
-49
auto_instant_click.py
majia/auto_instant_click.py
+89
-42
get_session.py
majia/get_session.py
+4
-6
celery_task_router.py
physical/celery_task_router.py
+1
-1
settings_local.py.template
physical/settings_local.py.template
+1
-0
No files found.
majia/auto_instant_click.py
View file @
2703571b
...
...
@@ -13,26 +13,56 @@ from get_session import get_comments, get_cookies, click, time_conv, login, repl
@shared_task
def
auto_click
(
id
):
def
auto_click
(
es_type
,
id
):
try
:
cookies
=
login
()
if
cookies
is
not
None
:
num1
=
random
.
randint
(
0
,
500
)
time
.
sleep
(
num1
)
click
(
cookies
,
id
)
cookies
=
login
()
if
cookies
is
not
None
:
num2
=
random
.
randint
(
1000
,
1500
)
time
.
sleep
(
num2
)
click
(
cookies
,
id
)
cookies
=
login
()
if
cookies
is
not
None
:
num3
=
random
.
randint
(
2000
,
3000
)
time
.
sleep
(
num3
)
click
(
cookies
,
id
)
pc
=
pymysql
.
connect
(
host
=
host
,
user
=
user
,
passwd
=
passwd
,
db
=
db
,
port
=
3306
)
cursor
=
pc
.
cursor
()
cursor
.
execute
(
"SELECT id,user_id FROM topic WHERE id = "
+
str
(
id
)
+
" and user_id in (select user_id from user_extra where is_shadow = 0)"
)
data
=
cursor
.
fetchall
()
topic_id_list
=
list
(
data
)
logging
.
info
(
"Database version :
%
s "
%
topic_id_list
)
pc
.
close
()
topic_id_list
=
919337
exec_count
=
0
if
topic_id_list
:
def
fun_timer
():
cookies
=
login
()
if
cookies
:
click
(
cookies
,
topic_id_list
[
0
])
global
timer
global
exec_count
exec_count
+=
1
if
exec_count
==
1
:
# sleep_time = random.randint(300, 540)
sleep_time
=
30
timer
=
threading
.
Timer
(
sleep_time
,
fun_timer
)
timer
.
start
()
if
exec_count
==
2
:
# sleep_time = random.randint(1000, 1900)
sleep_time
=
50
timer
=
threading
.
Timer
(
sleep_time
,
fun_timer
)
timer
.
start
()
sleep_time
=
random
.
randint
(
300
,
540
)
timer
=
threading
.
Timer
(
10
,
fun_comment
)
# 首次启动
timer
.
start
()
sleep_time
=
random
.
randint
(
300
,
540
)
timer
=
threading
.
Timer
(
10
,
fun_timer
)
# 首次启动
timer
.
start
()
else
:
pass
except
:
logging
.
error
(
"catch exception,main:
%
s"
%
traceback
.
format_exc
())
...
...
@@ -40,30 +70,47 @@ def auto_click(id):
@shared_task
def
auto_reply
(
id
):
try
:
cookies
=
login
()
if
cookies
:
time
.
sleep
(
random
.
randint
(
0
,
500
))
num1
=
random
.
randint
(
0
,
500
)
time
.
sleep
(
num1
)
comment_content
=
get_comments
()
comment
=
comment_content
[
0
]
reply
(
cookies
,
id
,
comment
)
cookies
=
login
()
if
cookies
:
num2
=
random
.
randint
(
1000
,
1500
)
time
.
sleep
(
num2
)
comment_content
=
get_comments
()
comment
=
comment_content
[
0
]
reply
(
cookies
,
id
,
comment
)
cookies
=
login
()
if
cookies
:
num3
=
random
.
randint
(
2000
,
3500
)
time
.
sleep
(
num3
)
comment_content
=
get_comments
()
comment
=
comment_content
[
0
]
reply
(
cookies
,
id
,
comment
)
pc
=
pymysql
.
connect
(
host
=
host
,
user
=
user
,
passwd
=
passwd
,
db
=
db
,
port
=
3306
)
cursor
=
pc
.
cursor
()
cursor
.
execute
(
"SELECT id,user_id FROM topic WHERE id = "
+
str
(
id
)
+
" and user_id in (select user_id from user_extra where is_shadow = 0)"
)
data
=
cursor
.
fetchall
()
topic_id_list
=
list
(
data
)
logging
.
info
(
"Database version :
%
s "
%
topic_id_list
)
pc
.
close
()
topic_id_list
=
919337
exec_count
=
0
if
topic_id_list
:
def
fun_comment
():
cookies
=
login
()
if
cookies
:
comment_content
=
get_comments
()
comment
=
comment_content
[
0
]
reply
(
cookies
,
id
,
comment
)
global
timer
global
exec_count
exec_count
+=
1
if
exec_count
==
1
:
sleep_time
=
random
.
randint
(
300
,
540
)
sleep_time
=
30
timer
=
threading
.
Timer
(
sleep_time
,
fun_comment
)
timer
.
start
()
if
exec_count
==
2
:
sleep_time
=
random
.
randint
(
1000
,
1900
)
sleep_time
=
30
timer
=
threading
.
Timer
(
sleep_time
,
fun_comment
)
timer
.
start
()
sleep_time
=
random
.
randint
(
300
,
540
)
timer
=
threading
.
Timer
(
10
,
fun_comment
)
# 首次启动
timer
.
start
()
except
:
logging
.
error
(
"catch exception,main:
%
s"
%
traceback
.
format_exc
())
...
...
majia/get_session.py
View file @
2703571b
...
...
@@ -113,17 +113,15 @@ def get_comments():
list_guanshui
=
[]
for
i
in
data
:
list_guanshui
.
append
(
i
)
num1
=
random
.
randint
(
0
,
500
)
num2
=
random
.
randint
(
500
,
1000
)
num3
=
random
.
randint
(
1000
,
1500
)
num4
=
random
.
randint
(
1500
,
len
(
list_guanshui
))
num1
=
random
.
randint
(
0
,
30
)
num2
=
random
.
randint
(
30
,
70
)
num4
=
random
.
randint
(
70
,
len
(
list_guanshui
))
comment1
=
list_guanshui
[
num1
-
1
]
comment2
=
list_guanshui
[
num2
-
1
]
comment3
=
list_guanshui
[
num3
-
1
]
comment4
=
list_guanshui
[
num4
-
1
]
comment_list
=
[
comment1
,
comment2
,
comment3
,
comment4
]
comment_list
=
[
comment1
,
comment2
,
comment3
]
return
comment_list
except
:
...
...
physical/celery_task_router.py
View file @
2703571b
...
...
@@ -15,9 +15,9 @@ class CeleryTaskRouter(object):
"majia-alpha"
:
[
'injection.data_sync.auto_instant_click.auto_click'
,
]
}
# Map[TaskName, QueueName]
task_queue_map
=
dict
(
itertools
.
chain
.
from_iterable
(
[(
task
,
queue
)
for
task
in
task_list
]
...
...
physical/settings_local.py.template
View file @
2703571b
...
...
@@ -57,6 +57,7 @@ CELERYBEAT_SCHEDULE = {
'args': ()
},
}
"""
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
...
...
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