Commit 80029a3d authored by haowang's avatar haowang

fix branch batch create api

parent 0d00e609
...@@ -91,10 +91,20 @@ class ProductBatchCreate(BaseView): ...@@ -91,10 +91,20 @@ class ProductBatchCreate(BaseView):
class BrandBatchCreate(BaseView): class BrandBatchCreate(BaseView):
'''批量创建品牌''' '''批量创建品牌'''
def post(self, request): def post(self, request):
brand_infos = request.POST.get('data') brand_infos = json.loads(request.POST.get('data', '[]'))
if not brand_infos: if not brand_infos:
return self.error(self.get_ErrorInfo(ERROR.PARAMS_INCOMPLETE)) return self.error(self.get_ErrorInfo(ERROR.PARAMS_INCOMPLETE))
error, ret = self.call_rpc('neptune/commodity/brand/batch_create', infos = [{
infos=brand_infos, platform=PRODUCT_FLATFORM.BEVOL) 'id': item.get('brandId'),
return error, ret 'cn_name': item.get('displayName'),
'en_name': item.get('aliasName'),
'icon': item.get('imgPath'),
'description': item.get('description')
} for item in brand_infos]
error, _ = self.call_rpc('neptune/commodity/brand/batch_create',
infos=infos, platform=PRODUCT_FLATFORM.BEVOL)
if error:
return self.error(error)
return self.ok()
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