Commit 00a87055 authored by haowang's avatar haowang

fix code

parent 70fd4500
...@@ -43,39 +43,51 @@ class ProductBatchCreate(BaseView): ...@@ -43,39 +43,51 @@ class ProductBatchCreate(BaseView):
if not product_id: if not product_id:
return error, None # 创建商品失败 未获取到商品ID return error, None # 创建商品失败 未获取到商品ID
self.add_parallel_rpc_call_info('create_brand', 'neptune/commodity/brand/create', if brand_info:
cn_name=brand_info.get('cnName'), icon=brand_info.get('imgSrc'), self.add_parallel_rpc_call_info('create_brand', 'neptune/commodity/brand/create',
description=brand_info.get('description'), en_name=brand_info.get('en_name'), cn_name=brand_info.get('cnName'), icon=brand_info.get('imgSrc'),
origin_brand_id=brand_info.get('id'), platform=PRODUCT_FLATFORM.BEVOL, product_id=product_id) description=brand_info.get('description'), en_name=brand_info.get('en_name'),
self.add_parallel_rpc_call_info('batch_create_composition', 'neptune/commodity/composition/batch_create', origin_brand_id=brand_info.get('id'), platform=PRODUCT_FLATFORM.BEVOL, product_id=product_id)
infos=composition_infos, platform=PRODUCT_FLATFORM.BEVOL, product_id=product_id) if composition_infos:
self.add_parallel_rpc_call_info('batch_create_composition', 'neptune/commodity/composition/batch_create',
self.add_parallel_rpc_call_info('create_category', 'neptune/commodity/category/create', infos=composition_infos, platform=PRODUCT_FLATFORM.BEVOL, product_id=product_id)
cn_name=category_info.get('name'), platform=PRODUCT_FLATFORM.BEVOL,
origin_category_id=category_info.get('id'), product_id=product_id) if category_info:
self.add_parallel_rpc_call_info('create_category', 'neptune/commodity/category/create',
cn_name=category_info.get('name'), platform=PRODUCT_FLATFORM.BEVOL,
origin_category_id=category_info.get('id'), product_id=product_id)
self.add_parallel_rpc_call_info('create_effect', 'neptune/commodity/effect/create', if effect_info:
cn_name=effect_info.get('name'), origin_effect_id=effect_info.get('id'), self.add_parallel_rpc_call_info('create_effect', 'neptune/commodity/effect/create',
platform=PRODUCT_FLATFORM.BEVOL, product_id=product_id) cn_name=effect_info.get('name'), origin_effect_id=effect_info.get('id'),
platform=PRODUCT_FLATFORM.BEVOL, product_id=product_id)
self.shoot_rpc_calls_in_parallel() self.shoot_rpc_calls_in_parallel()
error, _ = self.parallel_rpc_call_result['create_brand'] if brand_info:
if error: error, _ = self.parallel_rpc_call_result['create_brand']
return error, None if error:
print('create_brand')
return error, None
error, _ = self.parallel_rpc_call_result['batch_create_composition'] if composition_infos:
if error: error, _ = self.parallel_rpc_call_result['batch_create_composition']
return error, None if error:
print('batch_create_composition')
return error, None
error, _ = self.parallel_rpc_call_result['create_category'] if category_info:
if error: error, _ = self.parallel_rpc_call_result['create_category']
return error, None if error:
print('create_category')
return error, None
error, _ = self.parallel_rpc_call_result['create_effect'] if effect_info:
if error: error, _ = self.parallel_rpc_call_result['create_effect']
return error, None if error:
print('create_effect', effect_info)
return error, None
return None, result return None, result
......
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