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
b2b82d2e
Commit
b2b82d2e
authored
Apr 25, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
7fb0a657
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
7 deletions
+18
-7
tasks.py
injection/data_sync/tasks.py
+18
-7
No files found.
injection/data_sync/tasks.py
View file @
b2b82d2e
...
...
@@ -43,7 +43,7 @@ def write_to_es(es_type, pk_list, use_batch_query_set=False):
# es=ESPerform.get_cli()
# )
if
es_type
==
'topic'
:
#
if es_type == 'topic':
auto_click
(
pk_list
)
auto_reply
(
pk_list
)
...
...
@@ -127,14 +127,20 @@ def auto_click(pk_list):
cursor
=
pc
.
cursor
()
topic_id_list
=
[]
if
len
(
pk_list
)
>
0
:
if
len
(
pk_list
)
==
1
:
cursor
.
execute
(
"SELECT id FROM topic WHERE id = "
+
str
(
pk_list
[
0
])
+
" and user_id in (select user_id from user_extra where is_shadow = 1)"
)
else
:
cursor
.
execute
(
"SELECT id FROM topic WHERE id in "
+
str
(
# and create_time LIKE '%%%%%s%%%%'% yes_time_str
tuple
(
pk_list
))
+
" 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 = 1)"
)
data
=
cursor
.
fetchall
()
topic_id_list
=
list
(
data
)
logging
.
info
(
"Database version :
%
s "
%
topic_id_list
)
pc
.
close
()
if
topic_id_list
:
try
:
def
fun_timer
():
...
...
@@ -185,10 +191,15 @@ def auto_reply(pk_list):
topic_id_list
=
[]
try
:
if
len
(
pk_list
)
>
0
:
if
len
(
pk_list
)
==
1
:
cursor
.
execute
(
"SELECT id FROM topic WHERE id = "
+
str
(
tuple
(
# and create_time LIKE '%%%%%s%%%%'
pk_list
))
+
" and user_id in (select user_id from user_extra where is_shadow = 0) "
)
else
:
cursor
.
execute
(
"SELECT id,user_id FROM topic WHERE id in "
+
str
(
tuple
(
pk_list
))
+
" and user_id in (select user_id from user_extra where is_shadow = 0) and create_time LIKE '
%%%%%
s
%%%%
' "
%
(
yes_time_str
))
"SELECT id FROM topic WHERE id in "
+
str
(
tuple
(
# and create_time LIKE '%%%%%s%%%%'
pk_list
))
+
" and user_id in (select user_id from user_extra where is_shadow = 0) "
)
data
=
cursor
.
fetchall
()
topic_id_list
=
list
(
data
)
...
...
@@ -204,7 +215,7 @@ def auto_reply(pk_list):
if
cookies
:
comment_content
=
get_comments
()
comment
=
comment_content
[
0
]
reply
(
cookies
,
topic_id_list
[
0
],
comment
)
reply
(
cookies
,
topic_id_list
[
0
]
[
0
]
,
comment
)
global
timer
global
exec_count
...
...
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