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
93377de8
Commit
93377de8
authored
Oct 11, 2019
by
吴升宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add auto follow after post and regist
parent
d07f21c9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
177 additions
and
49 deletions
+177
-49
trans2es_mapping2es.py
trans2es/management/commands/trans2es_mapping2es.py
+5
-2
auto_follow_per_1d_by_post.py
vest/follow/auto_follow_per_1d_by_post.py
+129
-0
auto_follow_per_1d_by_regist.py
vest/follow/auto_follow_per_1d_by_regist.py
+42
-46
auto_follow_per_5m_by_followed.py
vest/follow/auto_follow_per_5m_by_followed.py
+1
-1
No files found.
trans2es/management/commands/trans2es_mapping2es.py
View file @
93377de8
...
...
@@ -10,7 +10,7 @@ from trans2es.type_info import get_type_info_map, TypeInfo
from
vest.reply
import
true_comment_one
,
true_comment_two
,
true_comment_three
,
one_seven_topic_comment
from
vest.click
import
true_click_five
,
true_click_two
,
true_click_four
,
true_click_one
,
true_click_three
,
\
one_seven_star_topic
from
vest.follow
import
auto_follow
,
auto_follow_new
,
auto_follow_per_5m_by_followed
from
vest.follow
import
auto_follow
,
auto_follow_new
,
auto_follow_per_5m_by_followed
,
auto_follow_per_1d_by_regist
,
auto_follow_per_1d_by_post
from
vest.urge
import
auto_star_urge
,
auto_lunch_app
,
auto_lunch_app2
,
auto_urge1
,
auto_urge2
from
vest.fix
import
fix_no_comment_click
from
vest.reply_answer
import
reply_comment2
,
reply_comment3
,
answer_reply2
,
answer_reply3
,
answer_reply1
,
\
...
...
@@ -116,7 +116,10 @@ class Command(BaseCommand):
auto_follow_new
.
auto_follow_new
()
if
options
[
'mvest'
]
==
"auto_follow_per_5m_by_followed"
:
auto_follow_per_5m_by_followed
.
auto_follow_per_5m_by_followed
()
if
options
[
'mvest'
]
==
"auto_follow_per_1d_by_regist"
:
auto_follow_per_1d_by_regist
.
auto_follow_per_1d_by_regist
()
if
options
[
'mvest'
]
==
"auto_follow_per_1d_by_post"
:
auto_follow_per_1d_by_post
.
auto_follow_per_1d_by_post
()
# 补足
if
options
[
"mvest"
]
==
"fix_no_comment_click"
:
...
...
vest/follow/auto_follow_per_1d_by_post.py
0 → 100644
View file @
93377de8
import
pymysql
import
random
import
traceback
import
logging
from
vest.request.auto_request
import
login
,
time_convs
,
follow
from
vest.request.auto_request
import
host
,
user
,
db
,
passwd
from
libs.error
import
logging_exception
def
get_commnet_id
(
numtime
,
numtime2
):
pc
=
pymysql
.
connect
(
host
=
host
,
user
=
user
,
passwd
=
passwd
,
db
=
db
,
port
=
3306
)
cursor
=
pc
.
cursor
()
# 发贴后
cursor
.
execute
(
"select user_id from topic WHERE create_time > '
%
s' and create_time < '
%
s' "
%
(
numtime
,
numtime2
))
data_new_user
=
cursor
.
fetchall
()
all_data
=
list
(
data_new_user
)
user_id_list
=
[]
for
i
in
all_data
and
all_data
:
cursor
.
execute
(
"select user_id from user_extra where user_id ="
+
str
(
i
[
0
])
+
" and is_shadow =0 "
)
data
=
cursor
.
fetchall
()
user_id
=
list
(
data
)
if
(
user_id
and
user_id
[
0
][
1
]
==
0
)
or
len
(
user_id
)
==
0
:
user_id_list
.
append
(
i
)
logging
.
info
(
"Database version :
%
s "
%
user_id_list
)
pc
.
close
()
return
user_id_list
def
auto_follow_per_1d_by_post
():
# 发帖触发自动加粉丝
try
:
# 0-3星
# 1天前发的帖子:[2-6]个粉丝
numtime1
,
numtime2
=
time_convs
(
1
,
1
)
user_id
=
get_commnet_id
(
numtime2
,
numtime1
,
)
try
:
for
j
in
user_id
and
user_id
:
id
=
int
(
j
[
0
])
follow_num
=
random
.
randint
(
2
,
6
)
for
i
in
range
(
follow_num
):
cookies
=
login
()
if
cookies
is
not
None
:
follow
(
cookies
,
id
)
except
:
pass
# 2-15天前发的帖子:[0-1]个粉丝
numtime1
,
numtime2
=
time_convs
(
2
,
15
)
user_id
=
get_commnet_id
(
numtime2
,
numtime1
)
try
:
for
j
in
user_id
and
user_id
:
id
=
int
(
j
[
0
])
follow_num
=
random
.
randint
(
0
,
1
)
for
i
in
range
(
follow_num
):
cookies
=
login
()
if
cookies
is
not
None
:
follow
(
cookies
,
id
)
except
:
pass
# 15天前或更早发的帖子:每隔11天[0-2]个粉丝
numtime1
,
numtime2
=
time_convs
(
2
,
15
)
user_id
=
get_commnet_id
(
'0'
,
numtime2
)
try
:
for
j
in
user_id
and
user_id
:
id
=
int
(
j
[
0
])
follow_num
=
random
.
randint
(
1
,
6
)
if
follow_num
==
6
:
cookies
=
login
()
if
cookies
is
not
None
:
follow
(
cookies
,
id
)
except
:
pass
# 4-6星
# 1天前发的帖子:[5-10]个粉丝
numtime1
,
numtime2
=
time_convs
(
1
,
1
)
user_id
=
get_commnet_id
(
numtime2
,
numtime1
)
try
:
for
j
in
user_id
and
user_id
:
id
=
int
(
j
[
0
])
follow_num
=
random
.
randint
(
5
,
10
)
for
i
in
range
(
follow_num
):
cookies
=
login
()
if
cookies
is
not
None
:
follow
(
cookies
,
id
)
except
:
pass
# 2-15天前发的帖子:[0-5]个粉丝
numtime1
,
numtime2
=
time_convs
(
2
,
15
)
user_id
=
get_commnet_id
(
numtime2
,
numtime1
)
try
:
for
j
in
user_id
and
user_id
:
id
=
int
(
j
[
0
])
follow_num
=
random
.
randint
(
0
,
5
)
for
i
in
range
(
follow_num
):
cookies
=
login
()
if
cookies
is
not
None
:
follow
(
cookies
,
id
)
except
:
pass
# 15天前或更早发的帖子:每隔11天[0-2]个粉丝
numtime1
,
numtime2
=
time_convs
(
2
,
15
)
user_id
=
get_commnet_id
(
'0'
,
numtime2
)
try
:
for
j
in
user_id
and
user_id
:
id
=
int
(
j
[
0
])
follow_num
=
random
.
randint
(
1
,
6
)
if
follow_num
==
6
:
cookies
=
login
()
if
cookies
is
not
None
:
follow
(
cookies
,
id
)
except
:
pass
except
:
logging_exception
()
logging
.
error
(
"catch exception,main:
%
s"
%
traceback
.
format_exc
())
vest/follow/auto_follow_per_
2h
.py
→
vest/follow/auto_follow_per_
1d_by_regist
.py
View file @
93377de8
...
...
@@ -2,76 +2,58 @@ import pymysql
import
random
import
traceback
import
logging
from
vest.request.auto_request
import
login
,
time_convs
_hours
,
follow
from
vest.request.auto_request
import
login
,
time_convs
,
follow
from
vest.request.auto_request
import
host
,
user
,
db
,
passwd
from
libs.error
import
logging_exception
def
get_commnet_id
(
numtime
):
def
get_commnet_id
(
numtime
,
numtime2
):
pc
=
pymysql
.
connect
(
host
=
host
,
user
=
user
,
passwd
=
passwd
,
db
=
db
,
port
=
3306
)
cursor
=
pc
.
cursor
()
# 注册后
cursor
.
execute
(
"SELECT user_id FROM reply WHERE create_time > '
%
s' "
%
numtime
)
data_comment
=
cursor
.
fetchall
()
cursor
.
execute
(
"SELECT t.user_id from topic t left join reply r on r.topic_id = t.id WHERE r.create_time > '
%
s'"
%
numtime
)
data_reply_topic
=
cursor
.
fetchall
()
cursor
.
execute
(
"SELECT r.user_id from reply r left join reply p on r.replied_id = p.replied_id WHERE p.create_time > '
%
s'"
%
numtime
)
data_reply_reply
=
cursor
.
fetchall
()
cursor
.
execute
(
"SELECT user_id FROM group_user_role WHERE create_time > '
%
s' "
%
numtime
)
data_group_follow
=
cursor
.
fetchall
()
cursor
.
execute
(
"select user_id from account_user WHERE create_time > '
%
s'"
%
numtime
)
"select user_id from account_user WHERE create_time > '
%
s' and create_time < '
%
s' "
%
(
numtime
,
numtime2
))
data_new_user
=
cursor
.
fetchall
()
data_id
=
list
(
data_comment
)
data1_id
=
list
(
data_reply_topic
)
data2_id
=
list
(
data_group_follow
)
data3_id
=
list
(
data_new_user
)
data_reply
=
list
(
data_reply_reply
)
all_data
=
[]
all_data
.
extend
(
data_id
)
all_data
.
extend
(
data2_id
)
all_data
.
extend
(
data3_id
)
all_data
.
extend
(
data_reply
)
all_data
.
extend
(
data1_id
)
all_data
=
list
(
data_new_user
)
topic
_id_list
=
[]
user
_id_list
=
[]
for
i
in
all_data
and
all_data
:
cursor
.
execute
(
"select user_id from user_extra where user_id ="
+
str
(
i
[
0
])
+
" and is_shadow =0 "
)
data
=
cursor
.
fetchall
()
user_id
=
list
(
data
)
if
(
user_id
and
user_id
[
0
][
1
]
==
0
)
or
len
(
user_id
)
==
0
:
topic
_id_list
.
append
(
i
)
user
_id_list
.
append
(
i
)
logging
.
info
(
"Database version :
%
s "
%
topic
_id_list
)
logging
.
info
(
"Database version :
%
s "
%
user
_id_list
)
pc
.
close
()
return
topic_id_list
return
user_id_list
def
auto_follow_per_2h
():
# 注册,发帖 2个事件触发自动加粉丝(在2个小时内加1-3个粉)
def
auto_follow_per_1d_by_regist
():
# 注册事件触发自动加粉丝
try
:
numtime1
,
numtime2
=
time_convs_hours
(
1
,
2
)
user_id
=
get_commnet_id
(
numtime1
)
# 1天前注册:[1-3]个粉丝
numtime1
,
numtime2
=
time_convs
(
1
,
1
)
user_id
=
get_commnet_id
(
numtime2
,
numtime1
)
try
:
for
j
in
user_id
and
user_id
:
id
=
int
(
j
[
0
])
follow_num
=
random
.
randint
(
1
,
3
)
for
i
in
range
(
follow_num
):
cookies
=
login
()
if
cookies
is
not
None
:
follow
(
cookies
,
id
)
except
:
pass
# 2-10天前注册:[0-1]个粉丝
numtime1
,
numtime2
=
time_convs
(
2
,
12
)
user_id
=
get_commnet_id
(
numtime2
,
numtime1
)
try
:
for
j
in
user_id
and
user_id
:
id
=
int
(
j
[
0
])
...
...
@@ -83,6 +65,20 @@ def auto_follow_per_2h():
except
:
pass
# 10天前注册:每隔12天[0-1]个赞
numtime1
,
numtime2
=
time_convs
(
1
,
12
)
user_id
=
get_commnet_id
(
'0'
,
numtime2
)
try
:
for
j
in
user_id
and
user_id
:
id
=
int
(
j
[
0
])
follow_num
=
random
.
randint
(
1
,
24
)
if
follow_num
==
12
:
cookies
=
login
()
if
cookies
is
not
None
:
follow
(
cookies
,
id
)
except
:
pass
except
:
logging_exception
()
logging
.
error
(
"catch exception,main:
%
s"
%
traceback
.
format_exc
())
vest/follow/auto_follow_per_5m_by_followed.py
View file @
93377de8
...
...
@@ -26,7 +26,7 @@ def auto_follow_per_5m_by_followed():
try
:
for
user
in
users
and
users
:
user_id
=
user
[
0
]
cookies
=
login
(
majia_user_ids_dict
.
get
(
user
[
1
]
))
cookies
=
login
(
str
(
majia_user_ids_dict
.
get
(
user
[
1
])
))
if
cookies
is
not
None
:
follow
(
cookies
,
user_id
)
except
:
...
...
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