Commit 89891280 authored by 王浩's avatar 王浩

Merge branch 'haow/dev' into 'test'

fix

See merge request !41
parents faf7b6f7 36d813d5
......@@ -21,4 +21,5 @@ urlpatterns = [
url(r'^v1/validate_3party_or_account$', user.Validate3PartyOrAccount.as_view(), name='validate_3party_or_account'),
url(r'^v1/validate_3party_account$', user.Validate3PartyAccount.as_view(), name='validate_3party_account$'),
url(r'^v1/user/batch_create_shadow_user$', user.BatchCreateShadowUser.as_view(), name='batch_create_shadow_user$'),
url(r'^v1/user/batch_update_user_level_fans$', user.BatchUpdateUserLevelFansNum.as_view(), name='batch_update_user_level_fans$'),
]
......@@ -15,9 +15,9 @@ class CreateTagForBatch(BaseView):
tags = []
if need_check:
# 敏感词检测,获取可用的帖子
check_info = Sensitive.check([item["name"] for item in tag_list if item.get("name")])
check_info = Sensitive.check([item for item in tag_list if item])
for tag in tag_list:
succ = check_info.get(tag.get("name")) if tag.get("name") else True
succ = check_info.get(tag) if tag else True
if not succ:
tags.append({"name": tag})
else:
......
......@@ -57,7 +57,7 @@ class CreateTopicForBatch(BaseView):
if not topics:
return self.ok()
locations = []
location_tags = []
tag_names = []
for item in topics:
tags = item.get("tags") or []
......@@ -67,10 +67,13 @@ class CreateTopicForBatch(BaseView):
item["tag_id"] = tag_id if tag_id else None
item["is_online"] = is_online
if item.get("location") and item.get("location").get("name"):
locations.append({
"name": item.get("location").get("name"),
"is_location": True
})
_tag_error, _location_tag_data = self.call_rpc(
"venus/community/tag/batch_create_tag_by_name",
tags=tags, is_location=1, is_own=1,
)
if _tag_error:
return self.error(_tag_error)
location_tags.append(_location_tag_data)
not_exists_ids = []
topic_list = []
......@@ -98,20 +101,16 @@ class CreateTopicForBatch(BaseView):
# check_info = Sensitive.check(tag_names)
# tags = [tag_name for tag_name, succ in check_info.items() if not succ]
tags = [{
"name": item,
"is_own": True,
} for item in tag_names]
tags.extend(locations)
tags = tag_names
# 先创建标签
_tag_error, _tag_data = self.call_rpc(
"venus/community/tag/batch_create_tag_by_name",
tags=tags
tags=tags, is_own=1
)
if _tag_error:
return self.error(_tag_error)
_tag_data.extend(location_tags)
# 更新发帖
# 处理标签,将文本中的标签处理成现有标签
......
......@@ -113,3 +113,25 @@ class Validate3PartyOrAccount(BaseView):
return self.ok(data={
"users": data,
})
class BatchUpdateUserLevelFansNum(BaseView):
"""批量更新用户星级 粉丝数"""
def post(self, request):
try:
user_infos = json.loads(request.POST.get("user_infos", "[]"))
except:
update_data = []
if not update_data:
return self.error(self.get_ErrorInfo(CODES.PARAMS_INCOMPLETE))
err, ret = self.call_rpc(
"venus/community/user/batch_update_user_leven_fans",
user_infos=user_infos
)
if err:
return self.error(err)
return self.ok()
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