Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
saturn
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
1
Merge Requests
1
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
saturn
Commits
dd262629
Commit
dd262629
authored
Sep 19, 2019
by
zhongshangwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复小红书入库马甲用户逻辑
parent
3bffffdb
Pipeline
#1978
passed with stage
Changes
1
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
12 deletions
+22
-12
reply_commands.py
api/management/commands/reply_commands.py
+22
-12
No files found.
api/management/commands/reply_commands.py
View file @
dd262629
...
@@ -3,6 +3,7 @@ import os
...
@@ -3,6 +3,7 @@ import os
from
datetime
import
datetime
from
datetime
import
datetime
import
json
import
json
import
requests
import
requests
import
random
from
random
import
randint
from
random
import
randint
from
django.core.management
import
BaseCommand
from
django.core.management
import
BaseCommand
from
engine.rpc
import
rpc_invoker
from
engine.rpc
import
rpc_invoker
...
@@ -16,7 +17,7 @@ from engine.logger import info_logger, error_logger, logging_exception
...
@@ -16,7 +17,7 @@ from engine.logger import info_logger, error_logger, logging_exception
IMAGE_SUFFIX
=
'-w'
IMAGE_SUFFIX
=
'-w'
FILE_PATH
=
'/Users/
haowei/Desktop/xhs
/'
FILE_PATH
=
'/Users/
zhongshangwu/workspace/gengmei/like/saturn/xiaohongshu
/'
class
Command
(
BaseCommand
):
class
Command
(
BaseCommand
):
...
@@ -37,23 +38,32 @@ class Command(BaseCommand):
...
@@ -37,23 +38,32 @@ class Command(BaseCommand):
second_pictorial_error_comments
=
[]
second_pictorial_error_comments
=
[]
second_reply_error_create
=
[]
second_reply_error_create
=
[]
shadow_user_ids
=
[]
def
del_cache
(
self
):
def
del_cache
(
self
):
for
obj
in
self
.
del_cache_keys
:
for
obj
in
self
.
del_cache_keys
:
ins_cache
.
delete
(
obj
)
ins_cache
.
delete
(
obj
)
def
load_shadow_users
(
self
):
data
=
rpc_invoker
[
'venus/community/crawl/load_shawdow_user'
](
start_user_id
=
self
.
user_id_start
,
end_user_id
=
self
.
user_id_start
+
5000
)
.
unwrap
()
print
(
data
,
">>>>>"
)
self
.
shadow_user_ids
=
data
def
get_random_user_id
(
self
):
def
get_random_user_id
(
self
):
# 随机获取用户ID
# 随机获取用户ID
while
True
:
return
random
.
choice
(
self
.
shadow_user_ids
)
index
=
randint
(
0
,
5000
)
# while True:
user_id
=
self
.
user_id_start
+
index
# index = randint(0, 5000)
data
=
rpc_invoker
[
'venus/community/user/is_shadow'
](
user_id
=
user_id
)
.
unwrap
()
# user_id = self.user_id_start + index
if
not
data
:
# data = rpc_invoker['venus/community/user/is_shadow'](user_id=user_id).unwrap()
continue
# if not data:
ret
=
data
.
get
(
'user_id'
)
# continue
if
ret
:
# ret = data.get('user_id')
return
user_id
# if ret:
# return user_id
def
get_user_id
(
self
,
id_
,
platform
):
def
get_user_id
(
self
,
id_
,
platform
):
# 获取用户ID 缓存记录保留用户关系
# 获取用户ID 缓存记录保留用户关系
...
@@ -255,7 +265,7 @@ class Command(BaseCommand):
...
@@ -255,7 +265,7 @@ class Command(BaseCommand):
return
None
,
None
return
None
,
None
def
handle
(
self
,
*
args
,
**
options
):
def
handle
(
self
,
*
args
,
**
options
):
self
.
load_shadow_users
()
platform
=
4
platform
=
4
# 帖子
# 帖子
print
(
'----- start deal topic at {} -----'
.
format
(
datetime
.
now
()
.
strftime
(
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S
%
f'
)))
print
(
'----- start deal topic at {} -----'
.
format
(
datetime
.
now
()
.
strftime
(
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S
%
f'
)))
...
...
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