Commit 00ec17d1 authored by 许俊鹏's avatar 许俊鹏

Merge branch 'xujunpeng/feature/2_0_1' into 'test'

增加虚拟粉丝

See merge request !218
parents d4cbfc27 8d919e97
...@@ -91,3 +91,27 @@ class BatchCreateTopicWithAiFashionTag(APIView): ...@@ -91,3 +91,27 @@ class BatchCreateTopicWithAiFashionTag(APIView):
self.rpc['venus/sun/tools/batch_create_topic_with_ai_fashion_tag'](infos=json_data).unwrap() self.rpc['venus/sun/tools/batch_create_topic_with_ai_fashion_tag'](infos=json_data).unwrap()
return {'message': u'上传成功', 'code': 200} return {'message': u'上传成功', 'code': 200}
class AddVirtFans(APIView):
def post(self, request):
xls_file = request.FILES.get('file')
if not xls_file:
return {'message': u'上传失败,请重新上传', 'code': 500}
wb = load_workbook(xls_file)
data = wb.get_sheet_by_name(wb.get_sheet_names()[0])
columns = [item for item in data.columns]
user_id_column = [item.value for item in columns[0]]
fans_num_column = [item.value for item in columns[1]]
user_id_fans_num_data = list(zip(user_id_column[1:], fans_num_column[1:]))
try:
self.rpc['venus/sun/tools/add_virt_fans'](data=user_id_fans_num_data).unwrap()
except:
return {'message': u'处理失败', 'code': 500}
return {'message': u'处理成功', 'code': 200}
...@@ -162,6 +162,7 @@ urlpatterns = [ ...@@ -162,6 +162,7 @@ urlpatterns = [
url(r'^tools/virtual_vote$', VirtualVote.as_view()), url(r'^tools/virtual_vote$', VirtualVote.as_view()),
url(r'^tools/batch_update_topic_tag$', BatchUpdateTopicTag.as_view()), url(r'^tools/batch_update_topic_tag$', BatchUpdateTopicTag.as_view()),
url(r'^tools/batch_create_topic_with_ai_fashion_tag$', BatchCreateTopicWithAiFashionTag.as_view()), url(r'^tools/batch_create_topic_with_ai_fashion_tag$', BatchCreateTopicWithAiFashionTag.as_view()),
url(r'^tools/add_virt_fans', AddVirtFans.as_view()),
# 母词 # 母词
url(r'^word_parent/list$', WordParentListView.as_view()), url(r'^word_parent/list$', WordParentListView.as_view()),
......
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