|
@@ -10,6 +10,7 @@ import os
|
|
import csv
|
|
import csv
|
|
import time
|
|
import time
|
|
from datetime import datetime
|
|
from datetime import datetime
|
|
|
|
+import calendar
|
|
from dateutil.relativedelta import relativedelta
|
|
from dateutil.relativedelta import relativedelta
|
|
from collections import defaultdict
|
|
from collections import defaultdict
|
|
from decimal import Decimal
|
|
from decimal import Decimal
|
|
@@ -221,6 +222,14 @@ class AgentDeviceView(View):
|
|
timeUnit = request_dict.get('timeUnit', 'month')
|
|
timeUnit = request_dict.get('timeUnit', 'month')
|
|
metric_type = int(request_dict.get('metric_type', 0))
|
|
metric_type = int(request_dict.get('metric_type', 0))
|
|
|
|
|
|
|
|
+ # endTime变成每个月最后一天
|
|
|
|
+ end_datetime = datetime.utcfromtimestamp(endTime)
|
|
|
|
+ month_str = end_datetime.strftime('%Y-%m')
|
|
|
|
+ year, month = int(month_str.split('-')[0]), int(month_str.split('-')[1])
|
|
|
|
+ end = calendar.monthrange(year, month)[1]
|
|
|
|
+ end_timestamp = datetime(year, month, end, 23, 59, 59).timestamp()
|
|
|
|
+ endTime = int(end_timestamp)
|
|
|
|
+
|
|
agent_customer_info = AgentCustomerInfo.objects.filter(user_id=userID).first()
|
|
agent_customer_info = AgentCustomerInfo.objects.filter(user_id=userID).first()
|
|
if not agent_customer_info:
|
|
if not agent_customer_info:
|
|
return response.json(104, 'Agent customer not found')
|
|
return response.json(104, 'Agent customer not found')
|