|
@@ -34,7 +34,6 @@ from django.db import transaction
|
|
|
from django.views.generic.base import View
|
|
|
import jwt
|
|
|
from pyfcm import FCMNotification
|
|
|
-
|
|
|
from Ansjer.config import OSS_STS_ACCESS_KEY, OSS_STS_ACCESS_SECRET, OSS_ROLE_ARN, SERVER_DOMAIN, PAYPAL_CRD, \
|
|
|
SERVER_DOMAIN_SSL, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_ARN, APNS_MODE, APNS_CONFIG, BASE_DIR, \
|
|
|
JPUSH_CONFIG, FCM_CONFIG, OAUTH_ACCESS_TOKEN_SECRET
|
|
@@ -51,7 +50,7 @@ from Object.UidTokenObject import UidTokenObject
|
|
|
from Service.CommonService import CommonService
|
|
|
from Object.m3u8generate import PlaylistGenerator
|
|
|
from Object.WechatPayObject import WechatPayObject
|
|
|
-from django.db.models import Q, F
|
|
|
+from django.db.models import Q, F, Count
|
|
|
|
|
|
from Service.ModelService import ModelService
|
|
|
|
|
@@ -139,6 +138,8 @@ class CloudStorageView(View):
|
|
|
return self.device_commodity(request_dict, userID, response)
|
|
|
elif operation == 'switchdevicecommodity': # 提前使用设备关联套餐
|
|
|
return self.switch_device_commodity(request_dict, userID, response)
|
|
|
+ elif operation == 'hasvod': #APP的回放界面,日历表显示当天有无录像
|
|
|
+ return self.has_vod(request_dict, userID, response)
|
|
|
else:
|
|
|
return response.json(414)
|
|
|
|
|
@@ -1433,6 +1434,33 @@ class CloudStorageView(View):
|
|
|
return response.json(0)
|
|
|
return response.json(444)
|
|
|
|
|
|
+ def has_vod(self, request_dict, userID, response):
|
|
|
+ uid = request_dict.get('uid', None)
|
|
|
+ channel = request_dict.get('channel', 1)
|
|
|
+ # dv_qs = Device_Info.objects.filter(userID_id=userID, UID=uid, isShare=False).values('vodPrimaryUserID',
|
|
|
+ # 'vodPrimaryMaster')
|
|
|
+ # if not dv_qs.exists():
|
|
|
+ # return response.json(12)
|
|
|
+ # if dv_qs[0]['vodPrimaryUserID'] != userID:
|
|
|
+ # return response.json(10034)
|
|
|
+ now_time = int(time.time())
|
|
|
+ bv_qs = UID_Bucket.objects.filter(uid=uid, endTime__gte=now_time ,channel=channel).values('bucket_id').order_by('addTime')
|
|
|
+ if not bv_qs.exists():
|
|
|
+ return response.json(10030)
|
|
|
+
|
|
|
+ had_vod_query = VodHlsModel.objects.extra(select={'date': "FROM_UNIXTIME(time,'%%Y-%%m-%%d')"}).values(
|
|
|
+ 'date').filter(uid=uid,endTime__gte=now_time,channel=channel).annotate(count=Count('time')).order_by('-date')[:31]
|
|
|
+
|
|
|
+ had_vod_list = []
|
|
|
+ for vod in had_vod_query:
|
|
|
+ had_vod_list.append({
|
|
|
+ 'timestamp': CommonService.str_to_timestamp(vod['date'], '%Y-%m-%d'),
|
|
|
+ 'vod_count': vod['count'],
|
|
|
+ 'date_format': vod['date'],
|
|
|
+ })
|
|
|
+
|
|
|
+ return response.json(0, had_vod_list)
|
|
|
+
|
|
|
# 云存操作系统消息
|
|
|
def do_vod_msg_Notice(self, uid, channel, userID, lang, sys_msg_text_list):
|
|
|
try:
|