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
1122f905
Commit
1122f905
authored
Oct 12, 2019
by
吴升宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix 5m_by_follow
parent
13c6e56e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
10 deletions
+12
-10
auto_follow_per_5m_by_followed.py
vest/follow/auto_follow_per_5m_by_followed.py
+5
-5
test.py
vest/test.py
+7
-5
No files found.
vest/follow/auto_follow_per_5m_by_followed.py
View file @
1122f905
import
pymysql
import
traceback
import
logging
from
vest.request.auto_request
import
login
,
follow
,
time_conv
from
vest.request.auto_request
import
login
,
follow
,
time_conv
_minute
from
vest.request.auto_request
import
host
,
user
,
db
,
passwd
from
vest.data.majia_user_ids
import
majia_user_ids_
list
,
majia_user_ids_
dict
from
vest.data.majia_user_ids
import
majia_user_ids_dict
from
libs.error
import
logging_exception
def
get_user_id
(
numtime
):
pc
=
pymysql
.
connect
(
host
=
host
,
user
=
user
,
passwd
=
passwd
,
db
=
db
,
port
=
3306
)
cursor
=
pc
.
cursor
()
majia_user_ids_tuple
=
tuple
(
majia_user_ids_list
)
cursor
.
execute
(
"SELECT user_id, follow_id FROM user_follow WHERE create_time > '
%
s' and follow_id in
%
s "
%
(
numtime
,
str
(
majia_user_ids_tuple
))
"SELECT f.user_id, f.follow_id FROM user_follow f left join user_extra on f.follow_id = e.user_id "
"WHERE f.create_time >= '
%
s' and e.is_shadow = 1 "
%
numtime
)
data_comment
=
cursor
.
fetchall
()
return
data_comment
and
[
i
for
i
in
data_comment
]
or
[]
...
...
@@ -21,7 +21,7 @@ def get_user_id(numtime):
def
auto_follow_per_5m_by_followed
():
# 如果马甲被用户关注,马甲即反向关注用户, 被关注5分钟后
try
:
numtime1
,
numtime2
=
time_conv
(
1
,
5
)
numtime1
,
numtime2
,
c
=
time_conv_minute
(
1
,
5
)
users
=
get_user_id
(
numtime2
)
try
:
for
user
in
users
and
users
:
...
...
vest/test.py
View file @
1122f905
...
...
@@ -119,15 +119,16 @@ def get_commnet_id(numtime, numtime2):
def
time_conv_
hour
(
minutest
,
minutest2
):
def
time_conv_
minute
(
minutest
,
minutest2
):
try
:
now
=
datetime
.
datetime
.
now
()
yes_time
=
now
-
datetime
.
timedelta
(
hours
=
minutest
)
yes_time2
=
now
-
datetime
.
timedelta
(
hours
=
minutest2
)
return
yes_time
,
yes_time2
minute
=
datetime
.
datetime
.
now
()
.
minute
yes_time
=
now
-
datetime
.
timedelta
(
minutes
=
minutest
)
yes_time2
=
now
-
datetime
.
timedelta
(
minutes
=
minutest2
)
return
yes_time
,
yes_time2
,
minute
except
:
return
None
a
,
b
=
time_conv_hour
(
0
,
2
)
a
,
b
,
c
=
time_conv_minute
(
0
,
5
)
print
(
a
,
b
)
\ No newline at end of file
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