From 13353ac326f9306e787f7fe54fd464dbd7bab7d4 Mon Sep 17 00:00:00 2001 From: haowang <yousangdandan@yeah.net> Date: Sun, 28 Apr 2019 19:53:22 +0800 Subject: [PATCH] tools api add post params to suit more data form --- api/tools.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/api/tools.py b/api/tools.py index 72a39cc..ed08c5f 100644 --- a/api/tools.py +++ b/api/tools.py @@ -79,11 +79,14 @@ class BatchCreateTopicWithAiFashionTag(APIView): def post(self, request): json_file = request.FILES.get('file') - if not json_file: + tag_infos = request.POST.get('tag_infos') + if not json_file and not tag_infos: 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() + if json_file: + json_data = json.load(json_file) + self.rpc['venus/sun/tools/batch_create_topic_with_ai_fashion_tag'](infos=json_data).unwrap() + if tag_infos: + self.rpc['venus/sun/tools/batch_create_topic_with_ai_fashion_tag'](infos=tag_infos).unwrap() return {'message': u'ä¸Šä¼ æˆåŠŸ', 'code': 200} -- 2.18.0