|
@@ -1,6 +1,7 @@
|
|
import datetime as date_time
|
|
import datetime as date_time
|
|
import json
|
|
import json
|
|
import logging
|
|
import logging
|
|
|
|
+import threading
|
|
import time
|
|
import time
|
|
import traceback
|
|
import traceback
|
|
|
|
|
|
@@ -10,6 +11,7 @@ from django.db.models import Q, F
|
|
from django.http import HttpResponseRedirect, HttpResponse
|
|
from django.http import HttpResponseRedirect, HttpResponse
|
|
from django.views.generic.base import View
|
|
from django.views.generic.base import View
|
|
|
|
|
|
|
|
+from AdminController.CloudServiceManage.AgentOrderController import AgentOrderView
|
|
from Ansjer.config import PAYPAL_CRD, SERVER_DOMAIN_SSL, PAYPAL_WEB_HOOK_ID, CONFIG_INFO, \
|
|
from Ansjer.config import PAYPAL_CRD, SERVER_DOMAIN_SSL, PAYPAL_WEB_HOOK_ID, CONFIG_INFO, \
|
|
CONFIG_US, CONFIG_EUR
|
|
CONFIG_US, CONFIG_EUR
|
|
from Controller import CloudStorage
|
|
from Controller import CloudStorage
|
|
@@ -436,7 +438,7 @@ class PaypalCycleNotify(View):
|
|
order_qs = Order_Model.objects.filter(paymentID=paymentID).values('UID', 'userID__region_country',
|
|
order_qs = Order_Model.objects.filter(paymentID=paymentID).values('UID', 'userID__region_country',
|
|
'create_vod', 'orderID',
|
|
'create_vod', 'orderID',
|
|
'channel', 'rank__is_ai',
|
|
'channel', 'rank__is_ai',
|
|
- 'rank__expire',
|
|
|
|
|
|
+ 'rank__expire', 'rank_id',
|
|
'rank__bucket__id',
|
|
'rank__bucket__id',
|
|
'isSelectDiscounts',
|
|
'isSelectDiscounts',
|
|
'userID__username',
|
|
'userID__username',
|
|
@@ -451,6 +453,14 @@ class PaypalCycleNotify(View):
|
|
if not self.config_match_region(uid, country_id):
|
|
if not self.config_match_region(uid, country_id):
|
|
return HttpResponse('Fail', status=500)
|
|
return HttpResponse('Fail', status=500)
|
|
|
|
|
|
|
|
+ # 检查是否云服务代理订单
|
|
|
|
+ order_id = order_qs[0]['orderID']
|
|
|
|
+ rank = order_qs[0]['rank_id']
|
|
|
|
+ check_thread = threading.Thread(
|
|
|
|
+ target=AgentOrderView.check_agent_service_package, args=(order_id, uid, rank)
|
|
|
|
+ )
|
|
|
|
+ check_thread.start()
|
|
|
|
+
|
|
if order_qs[0]['create_vod']:
|
|
if order_qs[0]['create_vod']:
|
|
order_qs.update(status=1, trade_no=paypal_transaction_id, updTime=nowTime, fee=fee)
|
|
order_qs.update(status=1, trade_no=paypal_transaction_id, updTime=nowTime, fee=fee)
|
|
else:
|
|
else:
|
|
@@ -462,7 +472,6 @@ class PaypalCycleNotify(View):
|
|
bucketId = order_qs[0]['rank__bucket__id']
|
|
bucketId = order_qs[0]['rank__bucket__id']
|
|
userid = order_qs[0]['userID__userID']
|
|
userid = order_qs[0]['userID__userID']
|
|
username = order_qs[0]['userID__username']
|
|
username = order_qs[0]['userID__username']
|
|
- order_id = order_qs[0]['orderID']
|
|
|
|
coupon_id = order_qs[0]['coupon_id']
|
|
coupon_id = order_qs[0]['coupon_id']
|
|
promotion = PromotionRuleModel.objects.filter(status=1, startTime__lte=nowTime,
|
|
promotion = PromotionRuleModel.objects.filter(status=1, startTime__lte=nowTime,
|
|
endTime__gte=nowTime).values('id', 'ruleConfig')
|
|
endTime__gte=nowTime).values('id', 'ruleConfig')
|
|
@@ -668,6 +677,13 @@ class PaypalCycleNotify(View):
|
|
# 记录新订单号和更新状态
|
|
# 记录新订单号和更新状态
|
|
PaypalWebHookEvent.objects.filter(id=paypal_webhook_event_qs.id).update(newOrderID=orderID,
|
|
PaypalWebHookEvent.objects.filter(id=paypal_webhook_event_qs.id).update(newOrderID=orderID,
|
|
update_status=update_status)
|
|
update_status=update_status)
|
|
|
|
+
|
|
|
|
+ # 检查是否云服务代理订单
|
|
|
|
+ check_thread = threading.Thread(
|
|
|
|
+ target=AgentOrderView.check_agent_service_package, args=(orderID, UID, rank)
|
|
|
|
+ )
|
|
|
|
+ check_thread.start()
|
|
|
|
+
|
|
PAY_LOGGER.info('{} PayPal周期扣款成功'.format(UID))
|
|
PAY_LOGGER.info('{} PayPal周期扣款成功'.format(UID))
|
|
return HttpResponse('success')
|
|
return HttpResponse('success')
|
|
except Exception as e:
|
|
except Exception as e:
|