Commit 92719274 authored by 王浩's avatar 王浩

Merge branch 'haow/newdev' into 'test'

add tools virtual_vote api

See merge request !171
parents 13e70c15 db21648e
import time
from utils.base import APIView
from gm_upload import upload, upload_file
from openpyxl import load_workbook
class VirtualVote(APIView):
def post(self, request):
xls_file = request.FILES.get('file')
if not xls_file:
return u'文件上传出错'
wb = load_workbook(xls_file)
data = wb.get_sheet_by_name(wb.get_sheet_names()[0])
row_data = [item.value for row in data.rows for item in row if item.value]
user_ids = []
for item in row_data:
try:
user_id = int(item)
user_ids.append(user_id)
except:
continue
if not user_ids:
return u'上传文件失败'
self.rpc['venus/sun/tools/virtual_vote'](user_ids=user_ids).unwrap()
return u'Ok'
......@@ -22,6 +22,8 @@ from .channel_build import *
from .commons import *
from .pictorial import *
from .operation import *
from .tools import *
urlpatterns = [
# 登陆,注销相关
......@@ -132,8 +134,10 @@ urlpatterns = [
url(r'^pictorial/topics$', PictorialTopics.as_view()),
url(r'^pictorial/user/list$', PictorialUserList.as_view()),
# 工具
url(r'^tools/virtual_vote$', VirtualVote.as_view()),
#运营位
url(r'^topic/home_recommend/list', TopicHomeRecommendList.as_view()),
url(r'^topic/home_recommend/edit', TopicHomeRecommendEdit.as_view()),
url(r'^operation/home_fix', TopicHomeFixOperation.as_view()),
......
......@@ -18,4 +18,5 @@ Pillow==5.4.1
celery==4.2.1
kombu==4.2.2.post1
requests==2.21.0
redis==2.10.6
\ No newline at end of file
redis==2.10.6
openpyxl==2.6.2
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