Commit a246188b authored by zhongshangwu's avatar zhongshangwu

fix

parent dafbd47a
......@@ -73,9 +73,9 @@ class ProductListView(APIView):
sorted_condition = request.GET.get('sorted_condition', None)
data = self.rpc['neptune/commodity/product/list'](
offset=offset, count=count, id_=id_, cn_name=cn_name, en_name=en_name, alias=alias, is_online=is_online,
offset=offset, count=count, id_=id_, cn_name=cn_name, en_name=en_name, alias=alias, is_online=is_online,
has_area=has_area, has_brand=has_brand, has_image=has_image, brand_id=brand_id, classify_id=classify_id,
category_id=category_id, price_low=price_low, price_high=price_high, grade_low=grade_low, grade_high=grade_high,
category_id=category_id, price_low=price_low, price_high=price_high, grade_low=grade_low, grade_high=grade_high,
comment_nums_low=comment_nums_low, comment_nums_high=comment_nums_high, effect_name=effect_name,
sorted_condition=sorted_condition).unwrap()
......@@ -90,11 +90,11 @@ class ProductListView(APIView):
obj['brand_info'] = {
'id': brand_product_dict.get(str(product_id)).get('id'),
'cn_name': brand_product_dict.get(str(product_id)).get('cn_name')} if brand_product_dict.get(str(product_id)) else ''
obj['category_infos'] = [{'id': obj.get('id'), 'cn_name': obj.get('cn_name')}
obj['category_infos'] = [{'id': obj.get('id'), 'cn_name': obj.get('cn_name')}
for obj in category_product_dict.get(str(product_id))] if category_product_dict.get(str(product_id)) else []
obj['effect_infos'] = [{'id': obj.get('id'), 'cn_name': obj.get('cn_name')}
obj['effect_infos'] = [{'id': obj.get('id'), 'cn_name': obj.get('cn_name')}
for obj in effect_product_dict.get(str(product_id))] if effect_product_dict.get(str(product_id)) else []
obj['classify_infos'] = [{'id': obj.get('id'), 'cn_name': obj.get('cn_name')}
obj['classify_infos'] = [{'id': obj.get('id'), 'cn_name': obj.get('cn_name')}
for obj in classify_product_dict.get(str(product_id))] if classify_product_dict.get(str(product_id)) else []
obj.pop('norms')
......@@ -102,7 +102,7 @@ class ProductListView(APIView):
obj.pop('platform')
count = self.rpc['neptune/commodity/product/count'](
id_=id_, cn_name=cn_name, en_name=en_name, alias=alias, is_online=is_online, has_area=has_area, has_brand=has_brand,
id_=id_, cn_name=cn_name, en_name=en_name, alias=alias, is_online=is_online, has_area=has_area, has_brand=has_brand,
has_image=has_image, brand_id=brand_id, category_id=category_id, classify_id=classify_id, price_low=price_low,
price_high=price_high, grade_low=grade_low, grade_high=grade_high, comment_nums_low=comment_nums_low,
comment_nums_high=comment_nums_high, effect_name=effect_name).unwrap()
......@@ -163,6 +163,7 @@ class ProductCreateView(APIView):
effect_ids = json.loads(request.POST.get('effect_ids', '[]'))
is_online = request.POST.get('is_online')
brand_id = request.POST.get('brand_id')
period_of_use = request.POST.get('period_of_use')
if not cn_name or not image:
return r'缺少参数'
......@@ -170,13 +171,15 @@ class ProductCreateView(APIView):
data = self.rpc['neptune/commodity/product/create'](
cn_name=cn_name, en_name=en_name, alias=alias, image=image, norms=norms, grade=grade, price=price,
country=country, description=description, comment_nums=comment_nums, classify_ids=classify_ids,
category_ids=category_ids, effect_ids=effect_ids, is_online=is_online, brand_id=brand_id).unwrap()
category_ids=category_ids, effect_ids=effect_ids, is_online=is_online, brand_id=brand_id,
period_of_use=period_of_use
).unwrap()
return data
class ProductUpdateView(APIView):
def post(self, request):
id_ = request.POST.get('id')
cn_name = request.POST.get('cn_name', None)
......@@ -194,6 +197,7 @@ class ProductUpdateView(APIView):
effect_ids = json.loads(request.POST.get('effect_ids', '[]'))
is_online = request.POST.get('is_online')
brand_id = request.POST.get('brand_id')
period_of_use = request.POST.get('period_of_use', 0)
if not id_:
return r'缺少参数'
......@@ -201,7 +205,8 @@ class ProductUpdateView(APIView):
data = self.rpc['neptune/commodity/product/update'](
id_=id_, cn_name=cn_name, en_name=en_name, alias=alias, image=image, norms=norms, grade=grade, price=price,
country=country, description=description, comment_nums=comment_nums, classify_ids=classify_ids,
category_ids=category_ids, effect_ids=effect_ids, is_online=is_online, brand_id=brand_id).unwrap()
category_ids=category_ids, effect_ids=effect_ids, is_online=is_online, brand_id=brand_id,
period_of_use=period_of_use).unwrap()
return data
......
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