Browse Source

套餐语言4

chenshibin 4 years ago
parent
commit
e6edd94f65
1 changed files with 6 additions and 1 deletions
  1. 6 1
      Controller/OrderContrller.py

+ 6 - 1
Controller/OrderContrller.py

@@ -14,6 +14,7 @@
 import time
 
 import paypalrestsdk
+from django.db.models import F
 from django.utils.decorators import method_decorator
 from django.views.decorators.csrf import csrf_exempt
 from django.views.generic.base import View
@@ -102,11 +103,12 @@ class OrderView(View):
             return response.json(173)
             # return response.json(10, '订单不存在')
         count = omqs.count()
+        omqs = omqs.annotate(rank__title=F('rank__lang__title'), rank__content=F('rank__lang__content'))
         order_ql = omqs[(page - 1) * line:page * line].values("orderID", "UID", "channel", "desc", "price", "currency",
                                                               "addTime",
                                                               "updTime", "paypal", "rank__day", "payType",
                                                               "rank__price", "status",
-                                                              "rank__content", "rank__title", "rank__currency",
+                                                              "rank__lang__content", "rank__lang__title", "rank__currency",
                                                               "rank_id")
         order_list = list(order_ql)
         data = []
@@ -158,6 +160,7 @@ class OrderView(View):
             if not omqs.exists():
                 return response.json(0, [])
             count = omqs.count()
+            omqs = omqs.annotate(rank__title=F('rank__lang__title'), rank__content=F('rank__lang__content'))
             order_ql = omqs[(page - 1) * line:page * line].values("orderID", "UID", "channel", "desc", "price",
                                                                   "currency", "addTime", "updTime", "paypal",
                                                                   "payType",
@@ -194,6 +197,7 @@ class OrderView(View):
             start = (page - 1) * line
             end = status + line
             count = order_qs.count()
+            order_qs = order_qs.annotate(rank__title=F('rank__lang__title'))
             order_qs = order_qs[start:end].values("orderID", "UID", "channel", "desc", "price",
                                                   "currency", "addTime", "payType", "rank__day", "rank__price",
                                                   "status", 'channel', "rank__title", "currency")
@@ -208,6 +212,7 @@ class OrderView(View):
             order_qs = Order_Model.objects.filter(orderID=orderID, userID__userID=userID)
             if order_qs.exists():
                 print(order_qs)
+                order_qs = order_qs.annotate(rank__title=F('rank__lang__title'))
                 order = order_qs.values("orderID", "UID", "channel", "desc", "price",
                                         "currency", "addTime", "endTime", "payType",
                                         "rank__day", "rank__price", "status", 'channel', "rank__title", "currency")[0]