Commit d236e1d3 authored by 王浩's avatar 王浩

Merge branch 'haow/dev' into 'test'

fix code

See merge request alpha/sun!258
parents 2bd5bce2 6522610b
...@@ -19,6 +19,9 @@ class BrandListView(APIView): ...@@ -19,6 +19,9 @@ class BrandListView(APIView):
is_online=is_online, has_icon=has_icon, classify_id=classify_id).unwrap() is_online=is_online, has_icon=has_icon, classify_id=classify_id).unwrap()
brand_ids = [obj.get('id') for obj in data] brand_ids = [obj.get('id') for obj in data]
brands_grade = self.rpc['neptune/commodity/brand/grade'](ids=brand_ids).unwrap()
grade_dict = {str(obj.get('brand_id')): obj.get('grade') for obj in brands_grade}
product_count = self.rpc['neptune/commodity/brand/product_count'](ids=brand_ids).unwrap() product_count = self.rpc['neptune/commodity/brand/product_count'](ids=brand_ids).unwrap()
category_infos = self.rpc['neptune/commodity/category/infos'](brand_ids=brand_ids).unwrap() category_infos = self.rpc['neptune/commodity/category/infos'](brand_ids=brand_ids).unwrap()
...@@ -40,7 +43,7 @@ class BrandListView(APIView): ...@@ -40,7 +43,7 @@ class BrandListView(APIView):
category_info_list = category_dict.get(str(brand_id)) category_info_list = category_dict.get(str(brand_id))
obj['category_infos'] = [{'id': obj.get('id'), 'cn_name': obj.get('cn_name')} for obj in category_info_list] if category_info_list else [] obj['category_infos'] = [{'id': obj.get('id'), 'cn_name': obj.get('cn_name')} for obj in category_info_list] if category_info_list else []
obj['grade'] = 0 obj['grade'] = grade_dict.get(str(brand_id)) if grade_dict.get(str(brand_id)) else 0
classify_info = classify_dict.get(str(brand_id)) classify_info = classify_dict.get(str(brand_id))
obj['classify_info'] = [{'id': classify_info.get('id'), 'cn_name': classify_info.get('cn_name')}] if classify_info else [] obj['classify_info'] = [{'id': classify_info.get('id'), 'cn_name': classify_info.get('cn_name')}] if classify_info else []
......
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