|
@@ -80,6 +80,8 @@ class AdminManage(TemplateView):
|
|
return self.getAllAppFrequency(userID, response)
|
|
return self.getAllAppFrequency(userID, response)
|
|
if operation == 'getPushStatistics':
|
|
if operation == 'getPushStatistics':
|
|
return self.query_push_by_level(userID, request_dict, response)
|
|
return self.query_push_by_level(userID, request_dict, response)
|
|
|
|
+ if operation == 'getPushFailures':
|
|
|
|
+ return self.query_failures_push(userID, request_dict, response)
|
|
|
|
|
|
def resetUserPwd(self, request_dict, userID, response):
|
|
def resetUserPwd(self, request_dict, userID, response):
|
|
own_permission = ModelService.check_perm(userID=userID, permID=50)
|
|
own_permission = ModelService.check_perm(userID=userID, permID=50)
|
|
@@ -518,7 +520,7 @@ class AdminManage(TemplateView):
|
|
failures += 1
|
|
failures += 1
|
|
tmp['total'] += 1
|
|
tmp['total'] += 1
|
|
|
|
|
|
- tmp_dict[start_time] = tmp
|
|
|
|
|
|
+ tmp_dict[current_time] = tmp
|
|
|
|
|
|
for item in data:
|
|
for item in data:
|
|
if tmp_dict.__contains__(item['date_time']):
|
|
if tmp_dict.__contains__(item['date_time']):
|
|
@@ -537,6 +539,56 @@ class AdminManage(TemplateView):
|
|
|
|
|
|
return response.json(0, res)
|
|
return response.json(0, res)
|
|
|
|
|
|
|
|
+ # def query_push_month_statistics(self, level, response):
|
|
|
|
+ # start_time = 0
|
|
|
|
+ # end_time = 0
|
|
|
|
+ # localtime = time.localtime()
|
|
|
|
+ # current_month = localtime.tm_mon
|
|
|
|
+ #
|
|
|
|
+ # time_struct = [localtime.tm_year, current_month, 1, 0, 0, 0, 0, 0, 0]
|
|
|
|
+ # current_time = int(time.mktime(tuple(time_struct)))
|
|
|
|
+ # current_time = current_time - time.timezone - 8 * 60 * 60
|
|
|
|
+ # count = 0
|
|
|
|
+ # start_month = 0
|
|
|
|
+ # if level == 3: # 6个月
|
|
|
|
+ # start_month = current_month - 5
|
|
|
|
+ # count = 5
|
|
|
|
+ # elif level == 4:
|
|
|
|
+ # start_month = current_month - 11
|
|
|
|
+ # count = 10
|
|
|
|
+ #
|
|
|
|
+ #
|
|
|
|
+ # return
|
|
|
|
+
|
|
|
|
+ def query_failures_push(self, userID, request_dict, response):
|
|
|
|
+ own_permission = ModelService.check_perm(userID=userID, permID=30)
|
|
|
|
+ if own_permission is not True:
|
|
|
|
+ return response.json(404)
|
|
|
|
+
|
|
|
|
+ start_time = request_dict.get('start_time', None)
|
|
|
|
+ end_time = request_dict.get('end_time', None)
|
|
|
|
+ page = request_dict.get('page', None)
|
|
|
|
+ line = request_dict.get('line', None)
|
|
|
|
+
|
|
|
|
+ if not start_time or not end_time or not page or not line:
|
|
|
|
+ return response.json(444)
|
|
|
|
+
|
|
|
|
+ start_time = int(start_time)
|
|
|
|
+ end_time = int(end_time)
|
|
|
|
+ page = int(page)
|
|
|
|
+ line = int(line)
|
|
|
|
+ if page <= 0 or line < 0:
|
|
|
|
+ return response.json(444, 'page, line')
|
|
|
|
+
|
|
|
|
+ eq_qs = Equipment_Info.objects.filter(addTime__gte=start_time, addTime__lte=end_time)\
|
|
|
|
+ .filter(~Q(push_server_status=200)).values('id', 'devUid', 'devNickName', 'Channel', 'alarm', 'eventType', 'eventTime', 'receiveTime', 'userID__username')
|
|
|
|
+ if eq_qs.exists():
|
|
|
|
+ count = eq_qs.count()
|
|
|
|
+ eq_qs = eq_qs[(page-1)*line: page * line]
|
|
|
|
+ return response.json(0, {'count': count, 'data': list(eq_qs)})
|
|
|
|
+ else:
|
|
|
|
+ return response.json(0, {'count': 0, 'data': []})
|
|
|
|
+
|
|
|
|
|
|
@require_http_methods(["GET"])
|
|
@require_http_methods(["GET"])
|
|
def getUserIds(request):
|
|
def getUserIds(request):
|