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
32f9ecdd
Commit
32f9ecdd
authored
Jun 28, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
6f49cab6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
28 deletions
+75
-28
workspace.xml
.idea/workspace.xml
+0
-0
auto_lunch_app.py
auto_lunch_app.py
+23
-28
auto_lunch_app2.py
auto_lunch_app2.py
+52
-0
No files found.
.idea/workspace.xml
View file @
32f9ecdd
This diff is collapsed.
Click to expand it.
auto_lunch_app.py
View file @
32f9ecdd
...
...
@@ -6,30 +6,33 @@ import random
import
traceback
from
log_settings
import
*
import
logging
from
auto_request
import
login
,
time_convs
,
follow
from
auto_request
import
login
,
time_convs
,
follow
,
Urge
from
auto_request
import
host
,
user
,
db
,
passwd
def
get_data
(
numtime
):
try
:
pc
=
pymysql
.
connect
(
host
=
host
,
user
=
user
,
passwd
=
passwd
,
db
=
db
,
port
=
3306
)
pc
=
pymysql
.
connect
(
host
=
host
,
user
=
user
,
passwd
=
passwd
,
db
=
"physical"
,
port
=
3306
)
cursor
=
pc
.
cursor
()
cursor
.
execute
(
"select
distinct(user_id) from pv_maidian where page_name ='home' and partiton_date > '
%
s'
"
%
numtime
)
"select
user_id from sl_user_login_status where last_visit_day < '
%
s' and is_shadow =0
"
%
numtime
)
data
=
cursor
.
fetchall
()
user_id
=
list
(
data
)
topic_id_list
=
[]
for
i
in
user_id
and
user_id
:
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
:
topic_id_list
.
append
(
i
)
logging
.
info
(
"Database version :
%
s "
%
user_id
)
# topic_id_list = []
# for i in user_id and user_id:
# pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=3306)
# cursor = pc.cursor()
# 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:
# topic_id_list.append(i)
logging
.
info
(
"Database version :
%
s "
%
topic_id_list
)
#
logging.info("Database version : %s " % topic_id_list)
pc
.
close
()
return
topic_id_list
return
user_id
except
:
logging
.
error
(
"catch exception,get_data:
%
s"
%
traceback
.
format_exc
())
return
None
...
...
@@ -37,20 +40,12 @@ def get_data(numtime):
if
__name__
==
"__main__"
:
try
:
numtime1
,
numtime2
=
time_convs
(
1
,
2
)
user_id
=
get_data
(
numtime1
)
urge_num
=
random
.
randint
(
0
,
1
)
for
j
in
range
(
urge_num
):
try
:
for
i
in
user_id
and
user_id
:
id
=
int
(
i
[
0
])
time
.
sleep
(
random
.
randint
(
10
,
30
))
cook
=
login
()
if
cook
is
not
None
:
follow
(
cook
,
id
)
except
:
pass
numtime1
,
numtime2
=
time_convs
(
1
,
3
)
user_id
=
get_data
(
numtime2
)
for
i
in
user_id
:
id
=
int
(
i
[
0
])
cook
=
login
()
if
cook
is
not
None
:
Urge
(
cook
,
id
)
except
:
logging
.
error
(
"catch exception,main:
%
s"
%
traceback
.
format_exc
())
auto_lunch_app2.py
0 → 100644
View file @
32f9ecdd
import
requests
import
time
import
datetime
import
pymysql
import
random
import
traceback
from
log_settings
import
*
import
logging
from
auto_request
import
login
,
time_convs
,
follow
,
Urge
from
auto_request
import
host
,
user
,
db
,
passwd
def
get_data
(
numtime
):
try
:
pc
=
pymysql
.
connect
(
host
=
host
,
user
=
user
,
passwd
=
passwd
,
db
=
"physical"
,
port
=
3306
)
cursor
=
pc
.
cursor
()
cursor
.
execute
(
"select user_id from sl_user_login_status where last_visit_day < '
%
s' and is_shadow = 0 "
%
numtime
)
data
=
cursor
.
fetchall
()
user_id
=
list
(
data
)
# topic_id_list = []
# for i in user_id and user_id:
# pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=3306)
# cursor = pc.cursor()
# 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:
# topic_id_list.append(i)
logging
.
info
(
"Database version :
%
s "
%
user_id
)
pc
.
close
()
return
user_id
except
:
logging
.
error
(
"catch exception,get_data:
%
s"
%
traceback
.
format_exc
())
return
None
if
__name__
==
"__main__"
:
try
:
numtime1
,
numtime2
=
time_convs
(
1
,
3
)
user_id
=
get_data
(
numtime2
)
num
=
random
.
randint
(
0
,
1
)
if
num
==
1
:
for
i
in
user_id
and
user_id
:
id
=
int
(
i
[
0
])
cook
=
login
()
if
cook
is
not
None
:
Urge
(
cook
,
id
)
except
:
logging
.
error
(
"catch exception,main:
%
s"
%
traceback
.
format_exc
())
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