Forráskód Böngészése

套餐信息:增加是否隐藏字段,修改相应接口

lhq 4 éve
szülő
commit
9ab9c7d0ca
2 módosított fájl, 6 hozzáadás és 2 törlés
  1. 5 2
      Controller/MealManage.py
  2. 1 0
      Model/models.py

+ 5 - 2
Controller/MealManage.py

@@ -95,6 +95,7 @@ class MealManage(View):
         discount_price = request_dict.get('discount_price', None)
         expire = request_dict.get('expire', None)
         symbol = request_dict.get('symbol', None)
+        is_show = request_dict.get('is_show', None)
 
         # if not title or not id or not price or not day or not content:
         if not id or not price or not day:
@@ -108,7 +109,7 @@ class MealManage(View):
                 return response.json(10, '已存在')
             store_meal = Store_Meal(id=id, price=price, day=day, bucket_id=bucketID, commodity_code=commodity_code,
                                     currency=currency, virtual_price=virtual_price, is_discounts=is_discounts,
-                                    discount_price=discount_price, expire=expire, symbol=symbol)
+                                    discount_price=discount_price, expire=expire, symbol=symbol, is_show=is_show)
             store_meal.save()
             paytype = paytype.split(',')
             if len(paytype) > 0:
@@ -140,7 +141,7 @@ class MealManage(View):
         qs = qs.annotate(title=F('lang__title'), content=F('lang__content'))
         qs = qs.values("id", "title", "price", "day", "add_time", "update_time", "currency", "expire", "symbol"
                        , "commodity_type", "commodity_code", "virtual_price", "is_discounts", "discount_price"
-                       , "bucket_id", "bucket__bucket", "bucket__area", "bucket__storeDay", "bucket__mold")
+                       , "bucket_id", "bucket__bucket", "bucket__area", "bucket__storeDay", "bucket__mold", "is_show")
         res = {}
         items_list = []
         if qs.exists():
@@ -175,6 +176,7 @@ class MealManage(View):
         expire = request_dict.get('expire', None)
         symbol = request_dict.get('symbol', None)
         type = request_dict.get('type', None)
+        is_show = request_dict.get('is_show', None)
         # if not id or not title or not price or not content or not day or not type:
         if not id or not price or not day or not type:
             # return response.json(444, 'id, title, price, content, day,type')
@@ -196,6 +198,7 @@ class MealManage(View):
             store_meal.discount_price = discount_price
             store_meal.expire = expire
             store_meal.symbol = symbol
+            store_meal.is_show = is_show
             store_meal.day = day
             if bucketID:
                 store_meal.bucket_id = bucketID

+ 1 - 0
Model/models.py

@@ -438,6 +438,7 @@ class Store_Meal(models.Model):
                                default=1, verbose_name='存储空间')
     commodity_type = models.SmallIntegerField(default=0, verbose_name='云存储套餐类型')  # 0:事件型 1:连续型
     commodity_code = models.CharField(default='', max_length=32, verbose_name='套餐规格码')
+    is_show = models.SmallIntegerField(default=0, verbose_name=u'该套餐是否隐藏 [0=否,1是]')
     # lang = models.CharField(default='', max_length=20, verbose_name='语言/国家')
     lang = models.ManyToManyField(to='Lang', verbose_name='套餐语言', db_table='store_meal_lang')