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
4b6e0c84
Commit
4b6e0c84
authored
Mar 27, 2019
by
zhanglu
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'hotfix/pin' into 'test'
Hotfix/pin See merge request
alpha/saturn!36
parents
a42d1344
41446ab6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
6 deletions
+13
-6
topic.py
api/views/topic.py
+13
-6
No files found.
api/views/topic.py
View file @
4b6e0c84
...
...
@@ -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
):
...
...
@@ -23,7 +23,7 @@ class CreateTopicForBatch(BaseView):
card_level
=
request
.
POST
.
get
(
"card_level"
,
0
)
tag_id
=
request
.
POST
.
get
(
"tag_id"
)
is_online
=
request
.
POST
.
get
(
"is_online"
,
0
)
platform
=
request
.
POST
.
get
(
"platform"
)
platform
=
int
(
request
.
POST
.
get
(
"platform"
)
)
topic_list
=
json
.
loads
(
request
.
POST
.
get
(
"topic_list"
,
'[]'
))
if
not
user_id
:
...
...
@@ -69,19 +69,26 @@ 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
item
[
"platform"
]
=
platform
item
[
"platform_id"
]
=
_id
topic_list
.
append
(
item
)
not_exists_ids
.
append
(
_id
)
else
:
topic_list
=
topics
# check_info = Sensitive.check(tag_names)
# tags = [tag_name for tag_name, succ in check_info.items() if not succ]
...
...
@@ -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