Commit 00268486 authored by 王浩's avatar 王浩

modify batch create tag and topic

parent 59618e60
......@@ -10,14 +10,16 @@ class CreateTagForBatch(BaseView):
"""
def post(self, request):
tag_list = json.loads(request.POST.get("tags", '[]'))
need_check = request.POST.get('need_check', 1)
tags = []
# 敏感词检测,获取可用的帖子
check_info = Sensitive.check([item["name"] for item in tag_list if item.get("name")])
for tag in tag_list:
succ = check_info.get(tag.get("name")) if tag.get("name") else True
if not succ:
tags.append(tag)
if need_check:
# 敏感词检测,获取可用的帖子
check_info = Sensitive.check([item["name"] for item in tag_list if item.get("name")])
for tag in tag_list:
succ = check_info.get(tag.get("name")) if tag.get("name") else True
if not succ:
tags.append(tag)
error, data = self.call_rpc('venus/community/tag/batch_create_not_classify', data=tags)
......
......@@ -49,7 +49,7 @@ class CreateTopicForBatch(BaseView):
tag_names.extend([tag.replace("#", '').strip() for tag in tags])
item["user_id"] = user_id
item["card_level"] = card_level
item["tag_id"] = tag_id
item["tag_id"] = tag_id if tag_id else None
item["is_online"] = is_online
check_info = Sensitive.check(tag_names)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment