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
吴升宇
physical
Commits
69b5b059
Commit
69b5b059
authored
Apr 23, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
69f8e88c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
24 deletions
+21
-24
auto_instant_click.py
majia/auto_instant_click.py
+21
-24
majia_email.txt
majia/majia_email.txt
+0
-0
No files found.
majia/auto_instant_click.py
View file @
69b5b059
# -*- coding: UTF-8 -*-
# -*- coding: UTF-8 -*-
import
requests
import
time
import
datetime
import
pymysql
import
pymysql
import
random
import
random
import
pandas
as
pd
import
threading
import
traceback
import
traceback
from
log_settings
import
*
import
logging
import
logging
from
celery
import
shared_task
from
django.conf
import
settings
from
django.conf
import
settings
from
get_session
import
get_comments
,
get_cookies
,
click
,
time_conv
,
login
,
reply
from
majia
import
get_comments
,
get_cookies
,
click
,
time_conv
,
login
,
reply
from
majia
import
host
,
user
,
passwd
,
db
exec_count
=
0
@shared_task
@shared_task
def
auto_click
(
es_type
,
id
):
def
auto_click
(
pk_list
):
exec_count
=
0
try
:
try
:
pc
=
pymysql
.
connect
(
host
=
host
,
user
=
user
,
passwd
=
passwd
,
db
=
db
,
port
=
3306
)
pc
=
pymysql
.
connect
(
host
=
host
,
user
=
user
,
passwd
=
passwd
,
db
=
db
,
port
=
3306
)
cursor
=
pc
.
cursor
()
cursor
=
pc
.
cursor
()
cursor
.
execute
(
cursor
.
execute
(
"SELECT id,user_id FROM topic WHERE id
=
"
+
str
(
"SELECT id,user_id FROM topic WHERE id
in
"
+
str
(
id
)
+
"
and user_id in (select user_id from user_extra where is_shadow = 0)"
)
tuple
(
pk_list
))
+
"
and user_id in (select user_id from user_extra where is_shadow = 0)"
)
data
=
cursor
.
fetchall
()
data
=
cursor
.
fetchall
()
topic_id_list
=
list
(
data
)
topic_id_list
=
list
(
data
)
logging
.
info
(
"Database version :
%
s "
%
topic_id_list
)
logging
.
info
(
"Database version :
%
s "
%
topic_id_list
)
pc
.
close
()
pc
.
close
()
topic_id_list
=
919337
exec_count
=
0
exec_count
=
0
if
topic_id_list
:
if
topic_id_list
:
...
@@ -39,23 +40,19 @@ def auto_click(es_type, id):
...
@@ -39,23 +40,19 @@ def auto_click(es_type, id):
exec_count
+=
1
exec_count
+=
1
if
exec_count
==
1
:
if
exec_count
==
1
:
logging
.
info
(
"-----1-------"
)
# sleep_time = random.randint(300, 540)
# sleep_time = random.randint(300, 540)
sleep_time
=
30
sleep_time
=
30
timer
=
threading
.
Timer
(
sleep_time
,
fun_timer
)
timer
=
threading
.
Timer
(
sleep_time
,
fun_timer
)
timer
.
start
()
timer
.
start
()
if
exec_count
==
2
:
if
exec_count
==
2
:
logging
.
info
(
"-----2-------"
)
# sleep_time = random.randint(1000, 1900)
# sleep_time = random.randint(1000, 1900)
sleep_time
=
50
sleep_time
=
50
timer
=
threading
.
Timer
(
sleep_time
,
fun_timer
)
timer
=
threading
.
Timer
(
sleep_time
,
fun_timer
)
timer
.
start
()
timer
.
start
()
sleep_time
=
random
.
randint
(
300
,
540
)
timer
=
threading
.
Timer
(
10
,
fun_comment
)
# 首次启动
timer
.
start
()
sleep_time
=
random
.
randint
(
300
,
540
)
sleep_time
=
random
.
randint
(
300
,
540
)
timer
=
threading
.
Timer
(
10
,
fun_timer
)
# 首次启动
timer
=
threading
.
Timer
(
10
,
fun_timer
)
# 首次启动
timer
.
start
()
timer
.
start
()
...
@@ -67,19 +64,18 @@ def auto_click(es_type, id):
...
@@ -67,19 +64,18 @@ def auto_click(es_type, id):
@shared_task
@shared_task
def
auto_reply
(
es_type
,
id
):
def
auto_reply
(
pk_list
):
exec_count
=
0
try
:
try
:
pc
=
pymysql
.
connect
(
host
=
host
,
user
=
user
,
passwd
=
passwd
,
db
=
db
,
port
=
3306
)
pc
=
pymysql
.
connect
(
host
=
host
,
user
=
user
,
passwd
=
passwd
,
db
=
db
,
port
=
3306
)
cursor
=
pc
.
cursor
()
cursor
=
pc
.
cursor
()
cursor
.
execute
(
cursor
.
execute
(
"SELECT id,user_id FROM topic WHERE id
=
"
+
str
(
"SELECT id,user_id FROM topic WHERE id
in
"
+
str
(
id
)
+
" and user_id in (select user_id from user_extra where is_shadow = 0)"
)
tuple
(
pk_list
)
)
+
" and user_id in (select user_id from user_extra where is_shadow = 0)"
)
data
=
cursor
.
fetchall
()
data
=
cursor
.
fetchall
()
topic_id_list
=
list
(
data
)
topic_id_list
=
list
(
data
)
logging
.
info
(
"Database version :
%
s "
%
topic_id_list
)
logging
.
info
(
"Database version :
%
s "
%
topic_id_list
)
pc
.
close
()
pc
.
close
()
topic_id_list
=
919337
exec_count
=
0
exec_count
=
0
if
topic_id_list
:
if
topic_id_list
:
...
@@ -88,19 +84,21 @@ def auto_reply(es_type,id):
...
@@ -88,19 +84,21 @@ def auto_reply(es_type,id):
if
cookies
:
if
cookies
:
comment_content
=
get_comments
()
comment_content
=
get_comments
()
comment
=
comment_content
[
0
]
comment
=
comment_content
[
0
]
reply
(
cookies
,
id
,
comment
)
reply
(
cookies
,
topic_id_list
[
0
]
,
comment
)
global
timer
global
timer
global
exec_count
global
exec_count
exec_count
+=
1
exec_count
+=
1
if
exec_count
==
1
:
if
exec_count
==
1
:
logging
.
info
(
"-----13-------"
)
sleep_time
=
random
.
randint
(
300
,
540
)
sleep_time
=
random
.
randint
(
300
,
540
)
sleep_time
=
30
sleep_time
=
30
timer
=
threading
.
Timer
(
sleep_time
,
fun_comment
)
timer
=
threading
.
Timer
(
sleep_time
,
fun_comment
)
timer
.
start
()
timer
.
start
()
if
exec_count
==
2
:
if
exec_count
==
2
:
logging
.
info
(
"-----14-------"
)
sleep_time
=
random
.
randint
(
1000
,
1900
)
sleep_time
=
random
.
randint
(
1000
,
1900
)
sleep_time
=
30
sleep_time
=
30
timer
=
threading
.
Timer
(
sleep_time
,
fun_comment
)
timer
=
threading
.
Timer
(
sleep_time
,
fun_comment
)
...
@@ -113,4 +111,3 @@ def auto_reply(es_type,id):
...
@@ -113,4 +111,3 @@ def auto_reply(es_type,id):
except
:
except
:
logging
.
error
(
"catch exception,main:
%
s"
%
traceback
.
format_exc
())
logging
.
error
(
"catch exception,main:
%
s"
%
traceback
.
format_exc
())
majia/majia_email.txt
deleted
100644 → 0
View file @
69f8e88c
This diff is collapsed.
Click to expand it.
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