Commit 8d919e97 authored by 许俊鹏's avatar 许俊鹏

增加虚拟粉丝

parent 1ead0077
......@@ -91,3 +91,27 @@ class BatchCreateTopicWithAiFashionTag(APIView):
self.rpc['venus/sun/tools/batch_create_topic_with_ai_fashion_tag'](infos=json_data).unwrap()
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}
......@@ -157,6 +157,7 @@ urlpatterns = [
url(r'^tools/virtual_vote$', VirtualVote.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/add_virt_fans', AddVirtFans.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