|
@@ -87,24 +87,24 @@ class CloudStorageView(View):
|
|
|
response = ResponseObject()
|
|
|
if operation is None:
|
|
|
return response.json(444, 'error path')
|
|
|
- elif operation == 'dopaypalcallback':
|
|
|
+ elif operation == 'dopaypalcallback': # paypal支付回调
|
|
|
return self.do_pay_by_paypal_callback(request_dict, response)
|
|
|
- elif operation == 'doalicallback':
|
|
|
+ elif operation == 'doalicallback': # 阿里支付回调
|
|
|
return self.do_pay_by_ali_callback(request)
|
|
|
- elif operation == 'dowechatnotify':
|
|
|
+ elif operation == 'dowechatnotify': # 微信支付回调
|
|
|
return self.do_pay_by_wechat_callback(request, response)
|
|
|
- elif operation == 'getsignsts':
|
|
|
+ elif operation == 'getsignsts': # 设备调用,获取sts令牌
|
|
|
ip = CommonService.get_ip_address(request)
|
|
|
return self.do_get_sign_sts(request_dict, ip, response)
|
|
|
- elif operation == 'storeplaylist':
|
|
|
+ elif operation == 'storeplaylist': # 设备调用,设备把视频上传到s3,同时把视频数据信息传给服务器,服务器存储播放内容
|
|
|
return self.do_store_playlist(request_dict, response)
|
|
|
- elif operation == 'signplaym3u8':
|
|
|
+ elif operation == 'signplaym3u8': # 根据sts播放m3u8 视频流
|
|
|
return self.do_sign_play_m3u8(request_dict, response)
|
|
|
- elif operation == 'payOK':
|
|
|
+ elif operation == 'payOK': # 支付成功
|
|
|
return self.do_pay_ok(request_dict)
|
|
|
- elif operation == 'vodMsgEnd':
|
|
|
+ elif operation == 'vodMsgEnd': # 云存到期续费提醒 提前1天
|
|
|
return self.do_vod_msg_end(request_dict)
|
|
|
- elif operation == 'vodMsgNotice':
|
|
|
+ elif operation == 'vodMsgNotice': # 云存操作系统消息
|
|
|
return self.do_vod_msg_Notice(request_dict)
|
|
|
|
|
|
else:
|
|
@@ -115,31 +115,31 @@ class CloudStorageView(View):
|
|
|
if tko.code != 0:
|
|
|
return response.json(tko.code)
|
|
|
userID = tko.userID
|
|
|
- if operation == 'createpayorder':
|
|
|
+ if operation == 'createpayorder': # 创建支付订单
|
|
|
ip = CommonService.get_ip_address(request)
|
|
|
return self.do_create_pay_order(request_dict, userID, ip, response)
|
|
|
- elif operation == 'changevodstatus':
|
|
|
+ elif operation == 'changevodstatus': # 修改云存状态,传送两个url,即getsignsts接口和storeplaylist接口
|
|
|
return self.do_change_vod_status(request_dict, userID, response)
|
|
|
- elif operation == 'queryvodlist':
|
|
|
+ elif operation == 'queryvodlist': # 获取视频播放列表
|
|
|
return self.do_query_vod_list(request_dict, userID, response)
|
|
|
- elif operation == 'commoditylist':
|
|
|
+ elif operation == 'commoditylist': # 查询套餐列表
|
|
|
return self.do_commodity_list(request_dict, userID, response)
|
|
|
- elif operation == 'queryorder':
|
|
|
+ elif operation == 'queryorder': # 查询订单列表
|
|
|
return self.do_query_order(request_dict, userID, response)
|
|
|
- elif operation == 'experienceorder':
|
|
|
+ elif operation == 'experienceorder': # 生成体验订单
|
|
|
return self.do_experience_order(request_dict, userID, response)
|
|
|
- elif operation == 'experiencereset':
|
|
|
+ elif operation == 'experiencereset': # 重置设备云存体验
|
|
|
return self.do_experience_reset(request_dict, userID, response)
|
|
|
- elif operation == 'deletevodlist':
|
|
|
+ elif operation == 'deletevodlist': # 删除播放列表
|
|
|
return self.deleteVodList(request_dict, userID, response)
|
|
|
- elif operation == 'devicecommodity':
|
|
|
+ elif operation == 'devicecommodity': # 设备关联套餐列表
|
|
|
return self.device_commodity(request_dict, userID, response)
|
|
|
- elif operation == 'switchdevicecommodity':
|
|
|
+ elif operation == 'switchdevicecommodity': # 提前使用设备关联套餐
|
|
|
return self.switch_device_commodity(request_dict, userID, response)
|
|
|
else:
|
|
|
return response.json(414)
|
|
|
|
|
|
- def do_query_order(self, request_dict, userID, response):
|
|
|
+ def do_query_order(self, request_dict, userID, response): # 查询订单列表
|
|
|
status = request_dict.get('status', None)
|
|
|
page = int(request_dict.get('page', None))
|
|
|
line = int(request_dict.get('line', None))
|
|
@@ -178,7 +178,7 @@ class CloudStorageView(View):
|
|
|
data.append(d)
|
|
|
return response.json(0, {'data': data, 'count': count})
|
|
|
|
|
|
- def do_commodity_list(self, request_dict, userID, response):
|
|
|
+ def do_commodity_list(self, request_dict, userID, response): # 查询套餐列表
|
|
|
mold = request_dict.get('mold', None)
|
|
|
uid = request_dict.get('uid', None)
|
|
|
lang = request_dict.get('lang', 'en')
|
|
@@ -230,7 +230,7 @@ class CloudStorageView(View):
|
|
|
else:
|
|
|
return response.json(0)
|
|
|
|
|
|
- def do_sign_play_m3u8(self, request_dict, response):
|
|
|
+ def do_sign_play_m3u8(self, request_dict, response): # 根据sts播放m3u8 视频流
|
|
|
uid = request_dict.get('uid', None)
|
|
|
uid = jwt.decode(uid, OAUTH_ACCESS_TOKEN_SECRET, algorithms='HS256').get('uid', '')
|
|
|
channel = request_dict.get('channel', None)
|
|
@@ -292,7 +292,7 @@ class CloudStorageView(View):
|
|
|
# response = HttpResponse(playlist, content_type="application/octet-stream")
|
|
|
# return response
|
|
|
|
|
|
- def do_get_sign_sts(self, request_dict, ip, response):
|
|
|
+ def do_get_sign_sts(self, request_dict, ip, response): # 获取sts令牌
|
|
|
uidToken = request_dict.get('uidToken', None)
|
|
|
utko = UidTokenObject(uidToken)
|
|
|
if utko.flag is False:
|
|
@@ -382,7 +382,7 @@ class CloudStorageView(View):
|
|
|
res = {'code': 405, 'msg': 'Not purchased or expired!'}
|
|
|
return HttpResponse(json.dumps(res, ensure_ascii=False), content_type="application/json,charset=utf-8")
|
|
|
|
|
|
- def do_query_vod_list(self, request_dict, userID, response):
|
|
|
+ def do_query_vod_list(self, request_dict, userID, response): # 获取视频播放列表
|
|
|
startTime = int(request_dict.get('startTime', None))
|
|
|
endTime = int(request_dict.get('endTime', None))
|
|
|
uid = request_dict.get('uid', None)
|
|
@@ -442,7 +442,7 @@ class CloudStorageView(View):
|
|
|
}),
|
|
|
return response.json(0, vod_play_list)
|
|
|
|
|
|
- def do_store_playlist(self, request_dict, response):
|
|
|
+ def do_store_playlist(self, request_dict, response): # 设备调用,上传视频到s3,同时把视频数据信息传给服务器,服务器存储播放内容
|
|
|
uidToken = request_dict.get('uidToken', None)
|
|
|
storeTime = request_dict.get('time', None)
|
|
|
sec = request_dict.get('sec', None)
|
|
@@ -495,7 +495,7 @@ class CloudStorageView(View):
|
|
|
res = {'code': 404, 'msg': '设备未购买'}
|
|
|
return HttpResponse(json.dumps(res, ensure_ascii=False), content_type="application/json,charset=utf-8")
|
|
|
|
|
|
- def do_change_vod_status(self, request_dict, userID, response):
|
|
|
+ def do_change_vod_status(self, request_dict, userID, response): # 修改云存状态
|
|
|
uid = request_dict.get('uid', None)
|
|
|
status = request_dict.get('status', None)
|
|
|
channel = request_dict.get('channel', None)
|
|
@@ -601,7 +601,7 @@ class CloudStorageView(View):
|
|
|
'''
|
|
|
return response
|
|
|
|
|
|
- def do_pay_ok(self, request_dict):
|
|
|
+ def do_pay_ok(self, request_dict): # 支付成功
|
|
|
response = HttpResponse()
|
|
|
paytype = request_dict.get('paytype', None)
|
|
|
lang = request_dict.get('lang', 'en')
|
|
@@ -704,7 +704,7 @@ class CloudStorageView(View):
|
|
|
'''
|
|
|
return response
|
|
|
|
|
|
- def do_pay_by_ali_callback(self, request):
|
|
|
+ def do_pay_by_ali_callback(self, request): # 阿里支付回调
|
|
|
response = ResponseObject()
|
|
|
data = request.POST.dict()
|
|
|
# logger = logging.getLogger('log')
|
|
@@ -801,7 +801,7 @@ class CloudStorageView(View):
|
|
|
red_url = "{SERVER_DOMAIN_SSL}web/paid2/en_fail.html".format(SERVER_DOMAIN_SSL=SERVER_DOMAIN_SSL)
|
|
|
return HttpResponseRedirect(red_url)
|
|
|
|
|
|
- def do_pay_by_paypal_callback(self, request_dict, response):
|
|
|
+ def do_pay_by_paypal_callback(self, request_dict, response): # paypal支付回调
|
|
|
paymentId = request_dict.get('paymentId', None)
|
|
|
PayerID = request_dict.get('PayerID', None)
|
|
|
orderID = request_dict.get('orderID', None)
|
|
@@ -909,7 +909,7 @@ class CloudStorageView(View):
|
|
|
red_url = "{SERVER_DOMAIN_SSL}web/paid2/en_fail.html".format(SERVER_DOMAIN_SSL=SERVER_DOMAIN_SSL)
|
|
|
return HttpResponseRedirect(red_url)
|
|
|
|
|
|
- def do_pay_by_wechat_callback(self, request, response):
|
|
|
+ def do_pay_by_wechat_callback(self, request, response): # 微信支付回调
|
|
|
|
|
|
logger = logging.getLogger('log')
|
|
|
try:
|
|
@@ -1002,7 +1002,7 @@ class CloudStorageView(View):
|
|
|
order_qs.update(status=10)
|
|
|
return HttpResponse(pay.xml_to_dict({'return_code': 'FAIL', 'return_msg': repr(e)}))
|
|
|
|
|
|
- def do_create_pay_order(self, request_dict, userID, ip, response):
|
|
|
+ def do_create_pay_order(self, request_dict, userID, ip, response): # 创建支付订单
|
|
|
uid = request_dict.get('uid', None)
|
|
|
channel = request_dict.get('channel', None)
|
|
|
pay_type = int(request_dict.get('pay_type', None))
|
|
@@ -1319,7 +1319,7 @@ class CloudStorageView(View):
|
|
|
|
|
|
return response.json(0, '重置云存体验成功')
|
|
|
|
|
|
- def deleteVodList(self, request_dict, userID, response):
|
|
|
+ def deleteVodList(self, request_dict, userID, response): # 删除播放列表
|
|
|
uid = request_dict.get('uid', None)
|
|
|
dv_qs = Device_Info.objects.filter(userID_id=userID, UID=uid, isShare=False, isExist=1) \
|
|
|
.values('vodPrimaryUserID')
|