Commit 02f63f7e authored by 王浩's avatar 王浩

Merge branch 'haow/pin_crawl' into 'test'

add pictorial tag ids

See merge request !53
parents eef6be89 c7a64803
...@@ -25,6 +25,7 @@ class CreateTopicForBatch(BaseView): ...@@ -25,6 +25,7 @@ class CreateTopicForBatch(BaseView):
is_online = request.POST.get("is_online", 0) is_online = request.POST.get("is_online", 0)
platform = int(request.POST.get("platform")) platform = int(request.POST.get("platform"))
topic_list = json.loads(request.POST.get("topic_list", '[]')) topic_list = json.loads(request.POST.get("topic_list", '[]'))
pictorial_tag_ids = json.loads(request.POST.get("tag_ids", '[]'))
if not user_id: if not user_id:
return self.parameter_invalid_response() return self.parameter_invalid_response()
...@@ -66,6 +67,7 @@ class CreateTopicForBatch(BaseView): ...@@ -66,6 +67,7 @@ class CreateTopicForBatch(BaseView):
item["card_level"] = card_level item["card_level"] = card_level
item["tag_id"] = tag_id if tag_id else None item["tag_id"] = tag_id if tag_id else None
item["is_online"] = is_online item["is_online"] = is_online
item["pictorial_tag_ids"] = pictorial_tag_ids
if item.get("location") and item.get("location").get("name"): if item.get("location") and item.get("location").get("name"):
_tag_error, _location_tag_data = self.call_rpc( _tag_error, _location_tag_data = self.call_rpc(
"venus/community/tag/batch_create_tag_by_name", "venus/community/tag/batch_create_tag_by_name",
...@@ -112,9 +114,7 @@ class CreateTopicForBatch(BaseView): ...@@ -112,9 +114,7 @@ class CreateTopicForBatch(BaseView):
) )
if _tag_error: if _tag_error:
return self.error(_tag_error) return self.error(_tag_error)
#_tag_data.update(location_tags)
for item in location_tags:
_tag_data.update(item)
# 更新发帖 # 更新发帖
# 处理标签,将文本中的标签处理成现有标签 # 处理标签,将文本中的标签处理成现有标签
...@@ -125,7 +125,7 @@ class CreateTopicForBatch(BaseView): ...@@ -125,7 +125,7 @@ class CreateTopicForBatch(BaseView):
#添加地域标签 #添加地域标签
if item.get("location") and item.get("location").get("name"): if item.get("location") and item.get("location").get("name"):
tags.append(item.get("location").get("name")) tags.append(item.get("location").get("name"))
content = item["content"] content = item.get("content")
for tag_name, tag_id in _tag_data.items(): for tag_name, tag_id in _tag_data.items():
if tag_name in tags: if tag_name in tags:
alpha_tag = '<topic>{' + '"id":{},"name":"{}"'.format(tag_id, tag_name) + '}</topic>' alpha_tag = '<topic>{' + '"id":{},"name":"{}"'.format(tag_id, tag_name) + '}</topic>'
...@@ -213,7 +213,7 @@ class CreateTopicForBatchByOne(BaseView): ...@@ -213,7 +213,7 @@ class CreateTopicForBatchByOne(BaseView):
for item in need_create_topics: for item in need_create_topics:
tags = item.get("tags") or [] tags = item.get("tags") or []
tags = [tag.replace("#", '').strip() for tag in tags] tags = [tag.replace("#", '').strip() for tag in tags]
content = item["content"] content = item.get("content")
for tag_name, tag_id in _tag_data.items(): for tag_name, tag_id in _tag_data.items():
if tag_name in tags: if tag_name in tags:
alpha_tag = '<topic>{' + '"id":{},"name":"{}"'.format(tag_id, tag_name) + '}</topic>' alpha_tag = '<topic>{' + '"id":{},"name":"{}"'.format(tag_id, tag_name) + '}</topic>'
......
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