|
@@ -28,7 +28,7 @@ import urllib
|
|
|
|
|
|
from Ansjer.config import OSS_BUCKET_ENDPOINT, OSS_BUCKET_VOD_LIST, OSS_STS_ACCESS_KEY, OSS_STS_ACCESS_SECRET, \
|
|
|
OSS_REGION_ID, OSS_ROLE_ARN, SERVER_DOMAIN
|
|
|
-from Model.models import Device_Meal, Device_Info, Order_Model, Store_Meal, VodHlsModel
|
|
|
+from Model.models import Device_Meal, Device_Info, Order_Model, Store_Meal, VodHlsModel, OssCrdModel
|
|
|
from Object.ResponseObject import ResponseObject
|
|
|
from Object.TokenObject import TokenObject
|
|
|
from Object.UidTokenObject import UidTokenObject
|
|
@@ -196,11 +196,20 @@ class CloudVodView(View):
|
|
|
print(channel)
|
|
|
print(UID)
|
|
|
qs = Device_Meal.objects.filter(uid=UID, channel=channel, status=1).values("rank", "channel", "end_time")
|
|
|
+ if not qs.exists():
|
|
|
+ return response.json(10, '设备未购买')
|
|
|
now_time = timezone.localtime(timezone.now())
|
|
|
if now_time > qs[0]['end_time']:
|
|
|
return response.json(10, '已过期')
|
|
|
- if not qs.exists():
|
|
|
- return response.json(10, '设备未购买')
|
|
|
+ now_time_stamp = int(time.time())
|
|
|
+ oc_qs = OssCrdModel.objects.filter(uid=UID, channel=channel).values("addTime", "data")
|
|
|
+ if oc_qs.exists():
|
|
|
+ endTime = int(oc_qs[0]["addTime"])+3500
|
|
|
+ if endTime > now_time_stamp:
|
|
|
+ print(endTime)
|
|
|
+ print(now_time_stamp)
|
|
|
+ res = json.loads(oc_qs[0]["data"])
|
|
|
+ return JsonResponse(status=200, data=res)
|
|
|
# 套餐id
|
|
|
rank = qs[0]['rank']
|
|
|
storage = '{uid}/vod{channel}/'.format(uid=UID, channel=channel)
|
|
@@ -265,6 +274,10 @@ class CloudVodView(View):
|
|
|
'storage': storage,
|
|
|
'ip': ip
|
|
|
}
|
|
|
+ if oc_qs.exists():
|
|
|
+ oc_qs.update(data=json.dumps(res),addTime=now_time_stamp)
|
|
|
+ else:
|
|
|
+ OssCrdModel.objects.create(uid=UID,channel=channel,data=json.dumps(res),addTime=now_time_stamp)
|
|
|
return JsonResponse(status=200, data=res)
|
|
|
|
|
|
# 获取设备回放列表
|
|
@@ -381,7 +394,7 @@ class CloudVodView(View):
|
|
|
uidTkUrl = "{SERVER_DOMAIN}cloudVod/getSts?uidToken={uidToken}".format(uidToken=utko.token,
|
|
|
SERVER_DOMAIN=SERVER_DOMAIN)
|
|
|
return response.json(0, {
|
|
|
- 'uidTkUrl':uidTkUrl
|
|
|
+ 'uidTkUrl': uidTkUrl
|
|
|
})
|
|
|
|
|
|
def do_store_palylist(self, request_dict, response):
|