|
@@ -1464,22 +1464,26 @@ class CronComparedDataView(View):
|
|
def validation(self, request_dict, request, operation):
|
|
def validation(self, request_dict, request, operation):
|
|
response = ResponseObject()
|
|
response = ResponseObject()
|
|
if operation == 'PaypalOrder': # 定时对比paypal订单
|
|
if operation == 'PaypalOrder': # 定时对比paypal订单
|
|
- return self.compared_paypal_order(response)
|
|
|
|
|
|
+ return self.compared_paypal_order(request_dict, response)
|
|
elif operation == 'WechatOrder': # 定时对比微信订单
|
|
elif operation == 'WechatOrder': # 定时对比微信订单
|
|
return self.compared_wechat_order(response)
|
|
return self.compared_wechat_order(response)
|
|
elif operation == 'AlipayOrder': # 定时对比阿里订单
|
|
elif operation == 'AlipayOrder': # 定时对比阿里订单
|
|
return self.compared_alipay_order(response)
|
|
return self.compared_alipay_order(response)
|
|
elif operation == 'AnsjerOrder': # 定时对比后台订单
|
|
elif operation == 'AnsjerOrder': # 定时对比后台订单
|
|
- return self.compared_ansjer_order(response)
|
|
|
|
|
|
+ return self.compared_ansjer_order(request_dict, response)
|
|
else:
|
|
else:
|
|
return response.json(404)
|
|
return response.json(404)
|
|
|
|
|
|
@staticmethod
|
|
@staticmethod
|
|
- def compared_paypal_order(response):
|
|
|
|
- today = datetime.datetime.today()
|
|
|
|
- start_date = today - datetime.timedelta(days=2)
|
|
|
|
- start_date = datetime.datetime(start_date.year, start_date.month, start_date.day)
|
|
|
|
- end_date = start_date + datetime.timedelta(days=1)
|
|
|
|
|
|
+ def compared_paypal_order(request_dict, response):
|
|
|
|
+ time_stamp = request_dict.get('time', None)
|
|
|
|
+ if time_stamp:
|
|
|
|
+ end_date = datetime.datetime.fromtimestamp(int(time_stamp))
|
|
|
|
+ start_date = end_date - datetime.timedelta(days=1)
|
|
|
|
+ else:
|
|
|
|
+ today = datetime.datetime.today()
|
|
|
|
+ start_date = today - datetime.timedelta(days=2)
|
|
|
|
+ end_date = start_date + datetime.timedelta(days=1)
|
|
try:
|
|
try:
|
|
data = (
|
|
data = (
|
|
('start_date', '{}-{}-{}T08:00:00-0800'.format(start_date.year, start_date.month, start_date.day)),
|
|
('start_date', '{}-{}-{}T08:00:00-0800'.format(start_date.year, start_date.month, start_date.day)),
|
|
@@ -1663,13 +1667,19 @@ class CronComparedDataView(View):
|
|
AbnormalOrder.objects.create(**order_dict)
|
|
AbnormalOrder.objects.create(**order_dict)
|
|
|
|
|
|
@staticmethod
|
|
@staticmethod
|
|
- def compared_ansjer_order(response):
|
|
|
|
- today = datetime.datetime.today()
|
|
|
|
- start_date = today - datetime.timedelta(days=1)
|
|
|
|
- start_date = datetime.datetime(start_date.year, start_date.month, start_date.day)
|
|
|
|
- end_date = datetime.datetime(today.year, today.month, today.day)
|
|
|
|
- start_date_stamp = int(start_date.timestamp())
|
|
|
|
- end_date_stamp = int(end_date.timestamp())
|
|
|
|
|
|
+ def compared_ansjer_order(request_dict, response):
|
|
|
|
+ start_date_stamp = request_dict.get('time', None)
|
|
|
|
+ if start_date_stamp:
|
|
|
|
+ start_date = datetime.datetime.fromtimestamp(int(start_date_stamp))
|
|
|
|
+ end_date = start_date + datetime.timedelta(days=1)
|
|
|
|
+ end_date_stamp = int(end_date.timestamp())
|
|
|
|
+ else:
|
|
|
|
+ today = datetime.datetime.today()
|
|
|
|
+ start_date = today - datetime.timedelta(days=1)
|
|
|
|
+ start_date = datetime.datetime(start_date.year, start_date.month, start_date.day)
|
|
|
|
+ end_date = datetime.datetime(today.year, today.month, today.day)
|
|
|
|
+ start_date_stamp = int(start_date.timestamp())
|
|
|
|
+ end_date_stamp = int(end_date.timestamp())
|
|
try:
|
|
try:
|
|
order_qs = Order_Model.objects.filter(status__in=[1, 5, 6], payType=1, payTime__gte=start_date_stamp,
|
|
order_qs = Order_Model.objects.filter(status__in=[1, 5, 6], payType=1, payTime__gte=start_date_stamp,
|
|
payTime__lt=end_date_stamp).values('orderID', 'trade_no', 'price')
|
|
payTime__lt=end_date_stamp).values('orderID', 'trade_no', 'price')
|
|
@@ -1687,7 +1697,8 @@ class CronComparedDataView(View):
|
|
@staticmethod
|
|
@staticmethod
|
|
def thread_compared_ansjer_order(order_list, start_time):
|
|
def thread_compared_ansjer_order(order_list, start_time):
|
|
while True:
|
|
while True:
|
|
- response = requests.get('https://www.zositeche.com/cron/compared/AnsjerOrder')
|
|
|
|
|
|
+ response = requests.get('https://www.zositeche.com/cron/compared/AnsjerOrder',
|
|
|
|
+ params={'time': int(start_time.timestamp())})
|
|
if response.status_code == 200:
|
|
if response.status_code == 200:
|
|
result = response.json()
|
|
result = response.json()
|
|
if result['result_code'] == 0:
|
|
if result['result_code'] == 0:
|