|
@@ -21,6 +21,7 @@ import paypalrestsdk
|
|
|
import threading
|
|
|
import calendar
|
|
|
import datetime
|
|
|
+import logging
|
|
|
from aliyunsdkcore import client
|
|
|
from aliyunsdksts.request.v20150401 import AssumeRoleRequest
|
|
|
from boto3.session import Session
|
|
@@ -102,7 +103,8 @@ class CloudStorageView(View):
|
|
|
return response.json(tko.code)
|
|
|
userID = tko.userID
|
|
|
if operation == 'createpayorder':
|
|
|
- return self.do_create_pay_order(request_dict, userID, response)
|
|
|
+ ip = CommonService.get_ip_address(request)
|
|
|
+ return self.do_create_pay_order(request_dict, userID, ip, response)
|
|
|
elif operation == 'changevodstatus':
|
|
|
return self.do_change_vod_status(request_dict, userID, response)
|
|
|
elif operation == 'queryvodlist':
|
|
@@ -476,7 +478,7 @@ class CloudStorageView(View):
|
|
|
now_time = int(time.time())
|
|
|
bv_qs = UID_Bucket.objects.filter(uid=uid,channel=channel, endTime__gte=now_time).order_by('endTime')
|
|
|
if not bv_qs.exists():
|
|
|
- return response.json(10008)
|
|
|
+ return response.json(103,'未购买')
|
|
|
vh_qs = VodHlsModel.objects.filter \
|
|
|
( uid=uid, channel=channel, time__range=(startTime, endTime), endTime__gte=now_time). \
|
|
|
values("id", "time", "sec", "bucket__bucket", "fg", "bucket__endpoint", "bucket__region", "bucket__mold")
|
|
@@ -530,7 +532,7 @@ class CloudStorageView(View):
|
|
|
vod_url = '{server_domain}/cloudstorage/signplaym3u8?' \
|
|
|
'uid={uid}&channel={channel}&time={time}&sign=tktktktk'. \
|
|
|
format(server_domain=SERVER_DOMAIN,uid=uid, channel=channel, time=vod['time'])
|
|
|
- ts_num = vod['fg'] & 0xf
|
|
|
+ ts_num = int(vod['fg']) & 0xf
|
|
|
vod_play_list.append({
|
|
|
'name': vod['time'],
|
|
|
'sign_url': vod_url,
|
|
@@ -657,7 +659,7 @@ class CloudStorageView(View):
|
|
|
return response.json(10, '未购买')
|
|
|
now_time = int(time.time())
|
|
|
if now_time > ubqs[0].endTime:
|
|
|
- return response.json(10008)
|
|
|
+ return response.json(102,'已过期')
|
|
|
ubqs.update(status=status)
|
|
|
if status == 0:
|
|
|
return response.json(0)
|
|
@@ -982,7 +984,7 @@ class CloudStorageView(View):
|
|
|
return HttpResponse(WechatPayObject.xml_to_dict({'return_code':'SUCCESS', 'return_msg':'OK'}))
|
|
|
return HttpResponse(WechatPayObject.xml_to_dict({'return_code':'FAIL', 'return_msg':'参数格式校验错误'}))
|
|
|
|
|
|
- def do_create_pay_order(self, request_dict, userID, 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))
|
|
@@ -1083,14 +1085,12 @@ class CloudStorageView(View):
|
|
|
return response.json(10, '生成订单错误.')
|
|
|
|
|
|
elif pay_type == 3:
|
|
|
- # spbill_create_ip = '127.0.0.1'
|
|
|
- spbill_create_ip = '120.237.157.184'
|
|
|
pay = WechatPayObject()
|
|
|
notify_url="{SERVER_DOMAIN_SSL}cloudstorage/dowechatnotify".format(
|
|
|
SERVER_DOMAIN_SSL=SERVER_DOMAIN_SSL)
|
|
|
# 获取参数
|
|
|
price = float(price)*100
|
|
|
- parameter_dict = pay.get_parameter(orderID, content, price, spbill_create_ip, notify_url)
|
|
|
+ parameter_dict = pay.get_parameter(orderID, content, price, ip, notify_url)
|
|
|
print('parameter_dict', parameter_dict)
|
|
|
# parameter_dict 参数中获取MWEB_URL 调转页面在路径后面添加redirect_url
|
|
|
# 统一调用接口
|