|
@@ -11,7 +11,7 @@ import logging
|
|
|
import time
|
|
|
|
|
|
from django.db import transaction
|
|
|
-from django.http import HttpResponse
|
|
|
+from django.http import HttpResponse, JsonResponse
|
|
|
from django.views.generic.base import View
|
|
|
|
|
|
from Model.models import UnicomDeviceInfo, UnicomCombo, Pay_Type, Order_Model, Store_Meal, AiStoreMeal, \
|
|
@@ -242,6 +242,7 @@ class UnicomComboView(View):
|
|
|
}
|
|
|
|
|
|
params = 'lang=cn' + '&activateType=' + activate_type
|
|
|
+ result = {'result_code': 0, 'reason': 'success', 'error_code': 0}
|
|
|
if pay_type == 2: # 支付宝
|
|
|
pay_price = PayService.get_two_float(price, 2)
|
|
|
notify_url = 'unicom/wap/pay/ali-notify'
|
|
@@ -255,17 +256,18 @@ class UnicomComboView(View):
|
|
|
notify_url = 'unicom/wap/pay/wechat-notify'
|
|
|
ip = CommonService.get_ip_address(request)
|
|
|
params = 'activateType=' + activate_type
|
|
|
- order_dict['pay_url'], sign_params = PayService.create_wechat_payment(params, order_id,
|
|
|
- price, ip,
|
|
|
- notify_url,
|
|
|
- unicom_combo_qs['remark'],
|
|
|
- response)
|
|
|
- res_data = {'redirectUrl': order_dict['pay_url'], 'orderID': order_id,
|
|
|
- 'result': sign_params}
|
|
|
+ sign_params = PayService.create_wechat_payment(params, order_id,
|
|
|
+ price, ip,
|
|
|
+ notify_url,
|
|
|
+ unicom_combo_qs['remark'],
|
|
|
+ response)
|
|
|
+ result['result'] = sign_params
|
|
|
else:
|
|
|
return response.json(444, {'param': 'pay_type'})
|
|
|
|
|
|
Order_Model.objects.create(**order_dict)
|
|
|
+ if pay_type == 3:
|
|
|
+ return JsonResponse(status=200, data=result)
|
|
|
return response.json(0, res_data)
|
|
|
except Exception as e:
|
|
|
print(e)
|