|
@@ -59,12 +59,12 @@ class OperatingCostsDataView(View):
|
|
|
return response.json(444, {'error param': 'page or line'})
|
|
|
page = int(page)
|
|
|
line = int(line)
|
|
|
- params = {'page': page, 'line': line}
|
|
|
+ # params = {'page': page, 'line': line}
|
|
|
try:
|
|
|
if start_time and end_time:
|
|
|
operating_costs_qs = OperatingCosts.objects.filter(Q(time__gte=start_time), Q(time__lt=end_time))
|
|
|
- params['startTime'] = start_time
|
|
|
- params['endTime'] = end_time
|
|
|
+ # params['startTime'] = start_time
|
|
|
+ # params['endTime'] = end_time
|
|
|
else:
|
|
|
operating_costs_qs = OperatingCosts.objects.all()
|
|
|
count = operating_costs_qs.count()
|
|
@@ -73,7 +73,7 @@ class OperatingCostsDataView(View):
|
|
|
'purchase_quantity', 'actual_storage', 'actual_api',
|
|
|
'monthly_income', 'settlement_days', 'remaining_usage_time',
|
|
|
'end_time', 'created_time', 'time').order_by('-time')[
|
|
|
- :page * line]
|
|
|
+ (page - 1) * line:page * line]
|
|
|
all_order_qs = Order_Model.objects.filter(orderID__in=order_list)
|
|
|
country_qs = CountryModel.objects.values('id', 'country_name')
|
|
|
country_dict = {}
|
|
@@ -134,21 +134,22 @@ class OperatingCostsDataView(View):
|
|
|
'actual_api': item['actual_api'],
|
|
|
'storage_cost': storage_cost,
|
|
|
'api_cost': api_cost,
|
|
|
- 'profit': profit
|
|
|
+ 'profit': profit,
|
|
|
+ 'time': item['time']
|
|
|
})
|
|
|
- if CONFIG_INFO == CONFIG_US:
|
|
|
- headers = {
|
|
|
- 'Authorization': request.META.get('HTTP_AUTHORIZATION')
|
|
|
- }
|
|
|
- eur_response = requests.get('https://www.zositeche.com/dataManagement/costsData/getOperatingCosts',
|
|
|
- params=params, headers=headers)
|
|
|
- if eur_response.status_code == 200:
|
|
|
- eur_result = eur_response.json()
|
|
|
- if eur_result['result_code'] == 0:
|
|
|
- res += eur_result['result']['res']
|
|
|
- count += eur_result['result']['count']
|
|
|
- res = CommonService.list_sort_v2(res, 'time')
|
|
|
+ # if CONFIG_INFO == CONFIG_US:
|
|
|
+ # headers = {
|
|
|
+ # 'Authorization': request.META.get('HTTP_AUTHORIZATION')
|
|
|
+ # }
|
|
|
+ # eur_response = requests.get('https://www.zositeche.com/dataManagement/costsData/getOperatingCosts',
|
|
|
+ # params=params, headers=headers)
|
|
|
+ # if eur_response.status_code == 200:
|
|
|
+ # eur_result = eur_response.json()
|
|
|
+ # if eur_result['result_code'] == 0:
|
|
|
+ # res += eur_result['result']['res']
|
|
|
+ # count += eur_result['result']['count']
|
|
|
+ # res = CommonService.list_sort_v2(res, 'time')
|
|
|
return response.json(0, {'count': count,
|
|
|
- 'res': res[(page - 1) * line:page * line]})
|
|
|
+ 'res': res})
|
|
|
except Exception as e:
|
|
|
return response.json(500, 'error_line:{}, error_msg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
|