|
@@ -81,6 +81,11 @@ class MealManage(View):
|
|
bucketID = request_dict.get('bucketID', None)
|
|
bucketID = request_dict.get('bucketID', None)
|
|
paytype = request_dict.get('paytype', None)
|
|
paytype = request_dict.get('paytype', None)
|
|
virtual_price = request_dict.get('virtual_price', None)
|
|
virtual_price = request_dict.get('virtual_price', None)
|
|
|
|
+ is_discounts = request_dict.get('is_discounts', None)
|
|
|
|
+ discount_price = request_dict.get('discount_price', None)
|
|
|
|
+ discount_content = request_dict.get('discount_content', None)
|
|
|
|
+ expire = request_dict.get('expire', None)
|
|
|
|
+
|
|
if not title or not id or not price or not day or not content:
|
|
if not title or not id or not price or not day or not content:
|
|
return response.json(444, 'title,id,price,content,day,bucketID')
|
|
return response.json(444, 'title,id,price,content,day,bucketID')
|
|
own_perm = ModelService.check_perm(userID=userID, permID=40)
|
|
own_perm = ModelService.check_perm(userID=userID, permID=40)
|
|
@@ -91,7 +96,8 @@ class MealManage(View):
|
|
if Store_Meal.objects.filter(id=id):
|
|
if Store_Meal.objects.filter(id=id):
|
|
return response.json(10, '已存在')
|
|
return response.json(10, '已存在')
|
|
store_meal = Store_Meal(id=id, title=title, price=price, content=content, day=day, bucket_id=bucketID,
|
|
store_meal = Store_Meal(id=id, title=title, price=price, content=content, day=day, bucket_id=bucketID,
|
|
- currency=currency, virtual_price=virtual_price)
|
|
|
|
|
|
+ currency=currency, virtual_price=virtual_price, is_discounts=is_discounts,
|
|
|
|
+ discount_price=discount_price, discount_content=discount_content, expire=expire)
|
|
store_meal.save()
|
|
store_meal.save()
|
|
paytype = paytype.split(',')
|
|
paytype = paytype.split(',')
|
|
if len(paytype) > 0:
|
|
if len(paytype) > 0:
|
|
@@ -122,7 +128,7 @@ class MealManage(View):
|
|
return response.json(444)
|
|
return response.json(444)
|
|
qs = Store_Meal.objects.values("id", "title", "price", "content", "day", "add_time", "update_time", "currency"
|
|
qs = Store_Meal.objects.values("id", "title", "price", "content", "day", "add_time", "update_time", "currency"
|
|
, "bucket_id", "bucket__bucket", "bucket__area", "commodity_type", "commodity_code",
|
|
, "bucket_id", "bucket__bucket", "bucket__area", "commodity_type", "commodity_code",
|
|
- "bucket__storeDay", "virtual_price")
|
|
|
|
|
|
+ "bucket__storeDay", "virtual_price", "is_discounts", "discount_price", "discount_content", "expire")
|
|
res = {}
|
|
res = {}
|
|
if qs.exists():
|
|
if qs.exists():
|
|
ql = list(qs)
|
|
ql = list(qs)
|
|
@@ -153,6 +159,10 @@ class MealManage(View):
|
|
commodity_type = request_dict.get('commodity_type', None)
|
|
commodity_type = request_dict.get('commodity_type', None)
|
|
commodity_code = request_dict.get('commodity_code', None)
|
|
commodity_code = request_dict.get('commodity_code', None)
|
|
virtual_price = request_dict.get('virtual_price', None)
|
|
virtual_price = request_dict.get('virtual_price', None)
|
|
|
|
+ is_discounts = request_dict.get('is_discounts', None)
|
|
|
|
+ discount_price = request_dict.get('discount_price', None)
|
|
|
|
+ discount_content = request_dict.get('discount_content', None)
|
|
|
|
+ expire = request_dict.get('expire', None)
|
|
type = request_dict.get('type', None)
|
|
type = request_dict.get('type', None)
|
|
if not id or not title or not price or not content or not day or not type:
|
|
if not id or not title or not price or not content or not day or not type:
|
|
return response.json(444, 'id, title, price, content, day,type')
|
|
return response.json(444, 'id, title, price, content, day,type')
|
|
@@ -169,6 +179,10 @@ class MealManage(View):
|
|
store_meal.commodity_type = commodity_type
|
|
store_meal.commodity_type = commodity_type
|
|
store_meal.commodity_code = commodity_code
|
|
store_meal.commodity_code = commodity_code
|
|
store_meal.virtual_price = virtual_price
|
|
store_meal.virtual_price = virtual_price
|
|
|
|
+ store_meal.is_discounts = is_discounts
|
|
|
|
+ store_meal.discount_price = discount_price
|
|
|
|
+ store_meal.discount_content = discount_content
|
|
|
|
+ store_meal.expire = expire
|
|
store_meal.day = day
|
|
store_meal.day = day
|
|
if bucketID:
|
|
if bucketID:
|
|
store_meal.bucket_id = bucketID
|
|
store_meal.bucket_id = bucketID
|