|
@@ -1046,6 +1046,7 @@ class serveManagement(View):
|
|
|
uid = request_dict.get('uid', None)
|
|
|
channel = request_dict.get('channel', None)
|
|
|
orderID = request_dict.get('orderID', None)
|
|
|
+ order_list = request_dict.get('order_list', None)
|
|
|
userID__username = request_dict.get('userID__username', None)
|
|
|
currency = request_dict.get('currency', None)
|
|
|
payType = request_dict.get('payType', None)
|
|
@@ -1084,6 +1085,9 @@ class serveManagement(View):
|
|
|
omqs = omqs.filter(trade_no=trade_no)
|
|
|
if userID__phone:
|
|
|
omqs = omqs.filter(userID__phone=userID__phone)
|
|
|
+ if order_list:
|
|
|
+ order_list = order_list.split(',')
|
|
|
+ omqs = omqs.filter(Q(orderID__in=order_list) | Q(trade_no__in=order_list))
|
|
|
if serialNumber:
|
|
|
device_uid = CommonService.query_uid_with_serial(serialNumber)
|
|
|
omqs = omqs.filter(UID=device_uid)
|
|
@@ -1262,16 +1266,62 @@ class serveManagement(View):
|
|
|
page = int(page_no)
|
|
|
line = int(page_size)
|
|
|
try:
|
|
|
- order_qs = DailyReconciliation.objects.all()
|
|
|
+ daily_reconciliation = DailyReconciliation.objects.all()
|
|
|
# 筛选指定订单
|
|
|
if start_time and end_time:
|
|
|
- order_qs = order_qs.filter(time__gte=start_time, time__lt=end_time)
|
|
|
- if not order_qs.exists():
|
|
|
+ daily_reconciliation = daily_reconciliation.filter(time__gte=start_time, time__lt=end_time)
|
|
|
+ if not daily_reconciliation.exists():
|
|
|
return response.json(0, [])
|
|
|
- count = order_qs.count()
|
|
|
- order_qs = order_qs.values("id", "trade_nos", "ansjer_total", "ansjer_num", "paypal_num", "paypal_total",
|
|
|
- "time").order_by('-time')[(page - 1) * line:page * line]
|
|
|
- return response.json(0, {'list': list(order_qs), 'total': count})
|
|
|
+ count = daily_reconciliation.count()
|
|
|
+ daily_reconciliation_qs = daily_reconciliation.values("id", "order_ids", "ansjer_total", "ansjer_num",
|
|
|
+ "paypal_num", "paypal_total", "time").order_by(
|
|
|
+ '-time')[(page - 1) * line:page * line]
|
|
|
+ for item in daily_reconciliation_qs:
|
|
|
+ item['order_info'] = []
|
|
|
+ if not item['order_ids']:
|
|
|
+ continue
|
|
|
+ order_list = item['order_ids'].split(',')
|
|
|
+ order_qs = Order_Model.objects.filter(Q(orderID__in=order_list) | Q(trade_no__in=order_list)).values(
|
|
|
+ "orderID", "UID", "userID__username", "userID__NickName", "channel", "desc", "price",
|
|
|
+ "refunded_amount", "currency", "addTime", "updTime", "paypal", "payType", "rank__day",
|
|
|
+ "rank__price", "status", "order_type", "paymentID", "trade_no", "payTime", "userID__region_country",
|
|
|
+ "userID__phone").order_by('-addTime')
|
|
|
+ while True:
|
|
|
+ params = {'pageNo': 1, 'pageSize': 100, 'order_list': item['order_ids']}
|
|
|
+ eur_response = requests.get('https://www.zositeche.com/serveManagement/getDeviceOrderList', params)
|
|
|
+ if eur_response.status_code == 200:
|
|
|
+ result = eur_response.json()
|
|
|
+ if result['result_code'] == 0:
|
|
|
+ item['order_info'] = result['result']['list']
|
|
|
+ break
|
|
|
+ for order in order_qs:
|
|
|
+ # 查询国家信息
|
|
|
+ country = 'N/A'
|
|
|
+ country_qs = CountryModel.objects.filter(id=order['userID__region_country']).values('country_name')
|
|
|
+ if country_qs.exists():
|
|
|
+ country = country_qs[0]['country_name']
|
|
|
+ serial_number = CommonService.query_serial_with_uid(order['UID'])
|
|
|
+ data = {'orderID': order['orderID'], 'UID': order['UID'],
|
|
|
+ 'userID__username': order['userID__username'],
|
|
|
+ 'userID__NickName': order['userID__NickName'], 'channel': order['channel'],
|
|
|
+ 'desc': order['desc'], 'price': order['price'], 'refunded_amount': order['refunded_amount'],
|
|
|
+ 'currency': order['currency'], 'addTime': order['addTime'], 'updTime': order['updTime'],
|
|
|
+ 'paypal': order['paypal'], 'payType': order['payType'], 'rank__day': order['rank__day'],
|
|
|
+ 'rank__price': order['rank__price'], 'status': order['status'],
|
|
|
+ 'order_type': order['order_type'],
|
|
|
+ 'payTime': order['payTime'] if order['payTime'] else 'N/A',
|
|
|
+ 'serialNumber': 'N/A' if serial_number == order['UID'] else serial_number,
|
|
|
+ 'country': country, 'userID__phone': order['userID__phone'], 'trade_no': 'N/A'}
|
|
|
+ # 添加PayPal交易号字段
|
|
|
+ if data['payType'] == 1:
|
|
|
+ data['trade_no'] = order['trade_no'] if order['trade_no'] else 'N/A'
|
|
|
+ data['express_id'] = ''
|
|
|
+ if data['payType'] == 11:
|
|
|
+ cdk_context_qs = CDKcontextModel.objects.filter(order=data['orderID']).values('express_id')
|
|
|
+ if cdk_context_qs.exists():
|
|
|
+ data['express_id'] = cdk_context_qs[0]['express_id']
|
|
|
+ item['order_info'].append(data)
|
|
|
+ return response.json(0, {'list': list(daily_reconciliation_qs), 'total': count})
|
|
|
except Exception as e:
|
|
|
return response.json(500, 'error_line:{}, error_msg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
|
|
|
|