chenjunkai 6 yıl önce
ebeveyn
işleme
a45ae21076
1 değiştirilmiş dosya ile 6 ekleme ve 2 silme
  1. 6 2
      Controller/MealManage.py

+ 6 - 2
Controller/MealManage.py

@@ -79,12 +79,13 @@ class MealManage(View):
         price = request_dict.get('price', None)
         content = request_dict.get('content', None)
         day = request_dict.get('day', None)
+        currency = request_dict.get('currency', None)
         bucketID = request_dict.get('bucketID', None)
         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')
         try:
             bucketQs = VodBucketModel.objects.filter(id=bucketID)
-            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)
             store_meal.save()
         except Exception:
             errorInfo = traceback.format_exc()
@@ -99,6 +100,7 @@ class MealManage(View):
                     'title': title,
                     'price': price,
                     'content': content,
+                    'currency': currency,
                     'day': day,
                     'add_time': str(store_meal.add_time),
                     'update_time': str(store_meal.update_time)})
@@ -108,7 +110,7 @@ class MealManage(View):
         line = int(request_dict.get('line', None))
         if page is None or line is None:
             return response.json(444)
-        qs = Store_Meal.objects.values("id", "title", "price", "content", "day", "add_time", "update_time", "bucket_id",
+        qs = Store_Meal.objects.values("id", "title", "price", "content", "day", "add_time", "update_time", "currency","bucket_id",
                                        "bucket__bucket","bucket__storeDay")
         res = {}
         if qs.exists():
@@ -124,6 +126,7 @@ class MealManage(View):
             price = request_dict.get('price', None)
             day = request_dict.get('day', None)
             content = request_dict.get('content', None)
+            currency = request_dict.get('currency', None)
             bucketID = request_dict.get('bucketID', None)
             param_flag = CommonService.get_param_flag(
                 data=[id, title, price, content, day])
@@ -143,6 +146,7 @@ class MealManage(View):
                         store_meal.content = content
                         store_meal.day = day
                         store_meal.bucket_id = bucketID
+                        store_meal.currency = currency
                         store_meal.save()
                         return response.json(0, {'update_id': store_meal.id,
                                                  'update_time': str(now_time)})