|
@@ -14,7 +14,7 @@ from django.db import transaction
|
|
from django.http import HttpResponse
|
|
from django.http import HttpResponse
|
|
from django.views.generic.base import View
|
|
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.ResponseObject import ResponseObject
|
|
from Object.TokenObject import TokenObject
|
|
from Object.TokenObject import TokenObject
|
|
from Object.UnicomObject import UnicomObjeect
|
|
from Object.UnicomObject import UnicomObjeect
|
|
@@ -220,14 +220,15 @@ class UnicomComboView(View):
|
|
if not unicom_device_qs.exists():
|
|
if not unicom_device_qs.exists():
|
|
return response.json(173)
|
|
return response.json(173)
|
|
unicom_combo_qs = unicom_combo_qs.first()
|
|
unicom_combo_qs = unicom_combo_qs.first()
|
|
- price = unicom_device_qs['price']
|
|
|
|
|
|
+ price = unicom_combo_qs['price']
|
|
if not price:
|
|
if not price:
|
|
return response.json(173)
|
|
return response.json(173)
|
|
unicom_device_qs = unicom_device_qs.first()
|
|
unicom_device_qs = unicom_device_qs.first()
|
|
device_uid = CommonService.query_uid_with_serial(unicom_device_qs['serial_no'])
|
|
device_uid = CommonService.query_uid_with_serial(unicom_device_qs['serial_no'])
|
|
order_id = CommonService.createOrderID()
|
|
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,
|
|
'userID_id': user_id, 'desc': unicom_combo_qs['combo_name'], 'payType': pay_type,
|
|
'payTime': now_time, 'price': price, 'currency': 'CNY', 'addTime': now_time,
|
|
'payTime': now_time, 'price': price, 'currency': 'CNY', 'addTime': now_time,
|
|
'updTime': now_time,
|
|
'updTime': now_time,
|
|
@@ -248,7 +249,8 @@ class UnicomComboView(View):
|
|
notify_url,
|
|
notify_url,
|
|
unicom_combo_qs['remark'],
|
|
unicom_combo_qs['remark'],
|
|
response)
|
|
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:
|
|
else:
|
|
return response.json(444, {'param': 'pay_type'})
|
|
return response.json(444, {'param': 'pay_type'})
|
|
|
|
|
|
@@ -258,6 +260,16 @@ class UnicomComboView(View):
|
|
print(e)
|
|
print(e)
|
|
return response.json(500, repr(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
|
|
@classmethod
|
|
def query_device_usage_history(cls):
|
|
def query_device_usage_history(cls):
|
|
"""
|
|
"""
|