Commit 6522610b authored by haowang's avatar haowang

fix code

parent 1ca74883
......@@ -19,6 +19,9 @@ class BrandListView(APIView):
is_online=is_online, has_icon=has_icon, classify_id=classify_id).unwrap()
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()
category_infos = self.rpc['neptune/commodity/category/infos'](brand_ids=brand_ids).unwrap()
......@@ -40,7 +43,7 @@ class BrandListView(APIView):
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['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))
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