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
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
钟尚武
saturn
Commits
21fde0ad
Commit
21fde0ad
authored
Apr 12, 2019
by
haowang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://git.wanmeizhensuo.com/alpha/saturn
into haow/dev
parents
478d9c81
71028fb4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
topic.py
api/views/topic.py
+11
-4
No files found.
api/views/topic.py
View file @
21fde0ad
...
...
@@ -9,7 +9,7 @@ from alpha_types.venus import ERROR as CODES
from
alpha_types.venus
import
GRAP_PLATFORM
ins_account
_cache
=
"ins_account_cache"
topic_id
_cache
=
"ins_account_cache"
class
CreateTopicForBatch
(
BaseView
):
...
...
@@ -69,12 +69,19 @@ class CreateTopicForBatch(BaseView):
not_exists_ids
=
[]
topic_list
=
[]
if
platform
==
GRAP_PLATFORM
.
INS
:
cache_key
=
topic_id_cache
elif
platform
==
GRAP_PLATFORM
.
PIN
:
cache_key
=
topic_id_cache
+
":2"
else
:
return
if
platform
in
(
GRAP_PLATFORM
.
INS
,
GRAP_PLATFORM
.
PIN
):
for
item
in
topics
:
_id
=
item
.
get
(
"id"
)
if
not
_id
:
continue
exists
=
ins_cache
.
sismember
(
ins_account_cache
,
_id
)
exists
=
ins_cache
.
sismember
(
cache_key
,
_id
)
if
exists
:
continue
...
...
@@ -90,7 +97,7 @@ class CreateTopicForBatch(BaseView):
# 先创建标签
_tag_error
,
_tag_data
=
self
.
call_rpc
(
"venus/community/tag/batch_create_tag_by_name"
,
tag
_name
s
=
tags
,
is_own
=
1
tags
=
tags
,
is_own
=
1
)
if
_tag_error
:
return
self
.
error
(
_tag_error
)
...
...
@@ -121,7 +128,7 @@ class CreateTopicForBatch(BaseView):
# 将已经跑了的数据添加到缓存
if
not_exists_ids
:
ins_cache
.
sadd
(
ins_account_cache
,
*
not_exists_ids
)
ins_cache
.
sadd
(
cache_key
,
*
not_exists_ids
)
return
self
.
ok
(
data
=
result
)
...
...
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