소스 검색

套餐信息 title字段显示

chenshibin 4 년 전
부모
커밋
3fe1218190
1개의 변경된 파일7개의 추가작업 그리고 1개의 파일을 삭제
  1. 7 1
      Controller/MealManage.py

+ 7 - 1
Controller/MealManage.py

@@ -13,6 +13,7 @@
 """
 import traceback
 
+from django.db.models import F
 from django.utils import timezone
 from django.utils.decorators import method_decorator
 from django.views.decorators.csrf import csrf_exempt
@@ -132,10 +133,15 @@ class MealManage(View):
 
         page = int(request_dict.get('page', None))
         line = int(request_dict.get('line', None))
+        lang = int(request_dict.get('lang', None))
         if page is None or line is None:
             return response.json(444)
+        if not lang:
+            lang = 'cn'
 
-        qs = Store_Meal.objects.values("id", "price", "day", "add_time", "update_time", "currency"
+        qs = Store_Meal.objects.filter(lang__lang=lang)
+        qs = qs.annotate(title=F('lang__title'),content=F('lang__content'))
+        qs = qs.values("id", "price", "day", "add_time", "update_time", "currency"
                                        , "bucket_id", "commodity_type", "commodity_code", "virtual_price", "is_discounts"
                                        , "discount_price", "expire", "symbol"
                                        , "bucket__bucket", "bucket__area", "bucket__storeDay")