Browse Source

修改生成联通4G套餐订单报错

zhangdongming 3 năm trước cách đây
mục cha
commit
f336453dd8
1 tập tin đã thay đổi với 16 bổ sung4 xóa
  1. 16 4
      Controller/UnicomCombo/UnicomComboController.py

+ 16 - 4
Controller/UnicomCombo/UnicomComboController.py

@@ -14,7 +14,7 @@ from django.db import transaction
 from django.http import HttpResponse
 from django.views.generic.base import View
 
-from Model.models import UnicomDeviceInfo, UnicomCombo, Pay_Type, Order_Model
+from Model.models import UnicomDeviceInfo, UnicomCombo, Pay_Type, Order_Model, Store_Meal, AiStoreMeal
 from Object.ResponseObject import ResponseObject
 from Object.TokenObject import TokenObject
 from Object.UnicomObject import UnicomObjeect
@@ -220,14 +220,15 @@ class UnicomComboView(View):
                 if not unicom_device_qs.exists():
                     return response.json(173)
                 unicom_combo_qs = unicom_combo_qs.first()
-                price = unicom_device_qs['price']
+                price = unicom_combo_qs['price']
                 if not price:
                     return response.json(173)
                 unicom_device_qs = unicom_device_qs.first()
                 device_uid = CommonService.query_uid_with_serial(unicom_device_qs['serial_no'])
                 order_id = CommonService.createOrderID()
+                rank_id, ai_rank_id = cls.get_cloud_or_ai_combo()
 
-                order_dict = {'orderID': order_id, 'UID': device_uid,
+                order_dict = {'rank_id': rank_id, 'ai_rank_id': ai_rank_id, 'orderID': order_id, 'UID': device_uid,
                               'userID_id': user_id, 'desc': unicom_combo_qs['combo_name'], 'payType': pay_type,
                               'payTime': now_time, 'price': price, 'currency': 'CNY', 'addTime': now_time,
                               'updTime': now_time,
@@ -248,7 +249,8 @@ class UnicomComboView(View):
                                                                                           notify_url,
                                                                                           unicom_combo_qs['remark'],
                                                                                           response)
-                    res_data = {'redirectUrl': order_dict['pay_url'], 'orderID': order_id, 'result': sign_params}
+                    res_data = {'redirectUrl': order_dict['pay_url'], 'orderID': order_id,
+                                'result': sign_params}
                 else:
                     return response.json(444, {'param': 'pay_type'})
 
@@ -258,6 +260,16 @@ class UnicomComboView(View):
             print(e)
             return response.json(500, repr(e))
 
+    @staticmethod
+    def get_cloud_or_ai_combo():
+        """
+        获取云存或者AI套餐id
+        @return:
+        """
+        rank_id = Store_Meal.objects.all().order_by('sort').values().first()['id']
+        ai_rank_id = AiStoreMeal.objects.all().values().first()['id']
+        return rank_id, ai_rank_id
+
     @classmethod
     def query_device_usage_history(cls):
         """