Commit a32ae366 authored by 王浩's avatar 王浩

Merge branch 'haow/dev' into 'test'

add ai fashion insert api

See merge request !179
parents 31d55bb0 6f52ffab
import time import time
import json
from utils.base import APIView from utils.base import APIView
from gm_upload import upload, upload_file from gm_upload import upload, upload_file
from openpyxl import load_workbook from openpyxl import load_workbook
...@@ -71,3 +72,18 @@ class BatchUpdateTopicTag(APIView): ...@@ -71,3 +72,18 @@ class BatchUpdateTopicTag(APIView):
self.rpc['venus/sun/tools/batch_update_topic_tags'](topic_infos=topic_infos).unwrap() self.rpc['venus/sun/tools/batch_update_topic_tags'](topic_infos=topic_infos).unwrap()
return {'message': u'上传成功', 'code': 200} return {'message': u'上传成功', 'code': 200}
class BatchCreateTopicWithAiFashionTag(APIView):
def post(self, request):
json_file = request.FILES.get('file')
if not json_file:
return {'message': u'上传失败,请重新上传', 'code': 500}
json_data = json.load(json_file)
self.rpc['venus/sun/tools/batch_create_topic_with_ai_fashion_tag'](infos=json_data).unwrap()
return {'message': u'上传成功', 'code': 200}
...@@ -144,6 +144,7 @@ urlpatterns = [ ...@@ -144,6 +144,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()),
] ]
......
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