|
@@ -17,9 +17,8 @@ import traceback
|
|
|
import botocore
|
|
|
import cv2
|
|
|
from botocore import client
|
|
|
-from django.db import transaction
|
|
|
+from django.db import transaction, connection
|
|
|
|
|
|
-from Ansjer.cn_config.config_formal import CONFIG_INFO
|
|
|
from Ansjer.config import CONFIG_INFO
|
|
|
from Controller.DeviceConfirmRegion import Device_Region
|
|
|
from Object.AWS.AmazonS3Util import AmazonS3Util
|
|
@@ -142,6 +141,8 @@ class testView(View):
|
|
|
return self.do_comb(request_dict, response)
|
|
|
elif operation == 'count_ts':
|
|
|
return self.count_ts(request_dict, response)
|
|
|
+ elif operation == 'tsCount':
|
|
|
+ return self.ts_count(request_dict, response)
|
|
|
elif operation == 'upload-s3':
|
|
|
return self.file_upload_s3(request, request_dict, response)
|
|
|
elif operation == 'v2/upload-s3':
|
|
@@ -829,11 +830,35 @@ class testView(View):
|
|
|
sumSec += (fg >> shift) & 0xf
|
|
|
size = 0
|
|
|
return HttpResponse(
|
|
|
- "{year}年{month}月 </br>上传的TS总数:{sumTs} </br> 总秒数:{sumSec} </br> 总大小:{size}GB (1秒约等150KB计算)".format(year=year,
|
|
|
- month=month,
|
|
|
- sumTs=sumTs,
|
|
|
- sumSec=sumSec,
|
|
|
- size=size))
|
|
|
+ "{year}年{month}月 </br>上传的TS总数:{sumTs} </br> 总秒数:{sumSec} </br> 总大小:{size}GB (1秒约等150KB计算)".format(
|
|
|
+ year=year,
|
|
|
+ month=month,
|
|
|
+ sumTs=sumTs,
|
|
|
+ sumSec=sumSec,
|
|
|
+ size=size))
|
|
|
+
|
|
|
+ @staticmethod
|
|
|
+ def ts_count(request_dict, response):
|
|
|
+ uid = request_dict.get('uid', None)
|
|
|
+ start_time = request_dict.get('start_time', None)
|
|
|
+ end_time = request_dict.get('end_time', None)
|
|
|
+
|
|
|
+ cursor = connection.cursor()
|
|
|
+ sql = 'SELECT fg FROM `vod_hls_mon` WHERE uid=%s AND start_time BETWEEN 1685289600 AND 1685548800 UNION ALL SELECT fg FROM `vod_hls_tues` WHERE uid=%s AND start_time BETWEEN 1685289600 AND 1685548800 UNION ALL SELECT fg FROM `vod_hls_wed` WHERE uid=%s AND start_time BETWEEN 1685289600 AND 1685548800 UNION ALL SELECT fg FROM `vod_hls_thur` WHERE uid=%s AND start_time BETWEEN 1685289600 AND 1685548800 UNION ALL SELECT fg FROM `vod_hls_fri` WHERE uid=%s AND start_time BETWEEN 1685289600 AND 1685548800 UNION ALL SELECT fg FROM `vod_hls_sat` WHERE uid=%s AND start_time BETWEEN 1685289600 AND 1685548800 UNION ALL SELECT fg FROM `vod_hls_sun` WHERE uid=%s AND start_time BETWEEN 1685289600 AND 1685548800'
|
|
|
+ print(sql)
|
|
|
+ try:
|
|
|
+ cursor.execute(sql, ['7TR9XE46NHXL5921111A', '7TR9XE46NHXL5921111A', '7TR9XE46NHXL5921111A',
|
|
|
+ '7TR9XE46NHXL5921111A', '7TR9XE46NHXL5921111A', '7TR9XE46NHXL5921111A',
|
|
|
+ '7TR9XE46NHXL5921111A'])
|
|
|
+ result = cursor.fetchall()
|
|
|
+ cursor.close()
|
|
|
+ ts_count = 0
|
|
|
+ for fg in result:
|
|
|
+ ts_count += int(fg[0]) & 0xf
|
|
|
+ return response.json(0, ts_count)
|
|
|
+ except Exception as e:
|
|
|
+ print(e)
|
|
|
+ return response.json(500, repr(e))
|
|
|
|
|
|
@staticmethod
|
|
|
def write_redis_list(response):
|