|
@@ -4,7 +4,6 @@ import base64
|
|
import datetime
|
|
import datetime
|
|
import json
|
|
import json
|
|
import logging
|
|
import logging
|
|
-import ssl
|
|
|
|
import sys
|
|
import sys
|
|
import time
|
|
import time
|
|
from decimal import Decimal
|
|
from decimal import Decimal
|
|
@@ -27,7 +26,7 @@ from Controller.CloudPhoto.CloudServiceController import CloudServiceController
|
|
from Controller.PaymentCycle import Paypal
|
|
from Controller.PaymentCycle import Paypal
|
|
from Model.models import Device_Info, Order_Model, Store_Meal, VodHlsModel, UID_Bucket, StsCrdModel, \
|
|
from Model.models import Device_Info, Order_Model, Store_Meal, VodHlsModel, UID_Bucket, StsCrdModel, \
|
|
ExperienceContextModel, Pay_Type, CDKcontextModel, Device_User, SysMsgModel, Unused_Uid_Meal, PromotionRuleModel, \
|
|
ExperienceContextModel, Pay_Type, CDKcontextModel, Device_User, SysMsgModel, Unused_Uid_Meal, PromotionRuleModel, \
|
|
- VideoPlaybackTimeModel, CouponModel, VodBucketModel, VodHlsSummary, VodHlsTag
|
|
|
|
|
|
+ VideoPlaybackTimeModel, CouponModel, VodBucketModel, VodHlsSummary
|
|
from Object.AWS.AmazonS3Util import AmazonS3Util
|
|
from Object.AWS.AmazonS3Util import AmazonS3Util
|
|
from Object.AWS.S3Email import S3Email
|
|
from Object.AWS.S3Email import S3Email
|
|
from Object.AliPayObject import AliPayObject
|
|
from Object.AliPayObject import AliPayObject
|
|
@@ -42,9 +41,6 @@ from Service.CommonService import CommonService
|
|
from Service.PayService import PaymentService
|
|
from Service.PayService import PaymentService
|
|
from Service.VodHlsService import SplitVodHlsObject
|
|
from Service.VodHlsService import SplitVodHlsObject
|
|
|
|
|
|
-ssl._create_default_https_context = ssl._create_unverified_context
|
|
|
|
-LOGGER = logging.getLogger('info')
|
|
|
|
-
|
|
|
|
|
|
|
|
# 设备信息添加
|
|
# 设备信息添加
|
|
class CloudStorageView(View):
|
|
class CloudStorageView(View):
|
|
@@ -657,6 +653,7 @@ class CloudStorageView(View):
|
|
uid = request_dict.get('uid', None)
|
|
uid = request_dict.get('uid', None)
|
|
status = request_dict.get('status', None)
|
|
status = request_dict.get('status', None)
|
|
channel = request_dict.get('channel', None)
|
|
channel = request_dict.get('channel', None)
|
|
|
|
+ domain_name = request_dict.get('domain_name', None)
|
|
if not all([uid, status, channel]):
|
|
if not all([uid, status, channel]):
|
|
return response.json(444, 'uid,status,channel')
|
|
return response.json(444, 'uid,status,channel')
|
|
device_info_qs = Device_Info.objects.filter(userID_id=user_id, UID=uid, isShare=False, isExist=1).values(
|
|
device_info_qs = Device_Info.objects.filter(userID_id=user_id, UID=uid, isShare=False, isExist=1).values(
|
|
@@ -674,10 +671,13 @@ class CloudStorageView(View):
|
|
return response.json(0)
|
|
return response.json(0)
|
|
uid_obj = UidTokenObject()
|
|
uid_obj = UidTokenObject()
|
|
uid_obj.generate(data={'uid': uid, 'channel': channel})
|
|
uid_obj.generate(data={'uid': uid, 'channel': channel})
|
|
- uid_tk_url = "{SERVER_DOMAIN_SSL}cloudstorage/getsignsts?uidToken={uidToken}". \
|
|
|
|
- format(uidToken=uid_obj.token, SERVER_DOMAIN_SSL=SERVER_DOMAIN_SSL)
|
|
|
|
- store_hls_url = "{SERVER_DOMAIN_SSL}cloudstorage/storeplaylist?uidToken={uidToken}". \
|
|
|
|
- format(uidToken=uid_obj.token, SERVER_DOMAIN_SSL=SERVER_DOMAIN_SSL)
|
|
|
|
|
|
+
|
|
|
|
+ # 欧洲域名固定返回欧洲域名
|
|
|
|
+ urls = SERVER_DOMAIN_SSL
|
|
|
|
+ if domain_name in ['api.zositeche.com', 'api.loocam3.com', 'common.neutral3.com']:
|
|
|
|
+ urls = 'https://api.zositeche.com/'
|
|
|
|
+ uid_tk_url = '{}cloudstorage/getsignsts?uidToken={}'.format(urls, uid_obj.token)
|
|
|
|
+ store_hls_url = '{}cloudstorage/storeplaylist?uidToken={}'.format(urls, uid_obj.token)
|
|
return response.json(0, {'uidTkUrl': uid_tk_url, 'storeHlsUrl': store_hls_url})
|
|
return response.json(0, {'uidTkUrl': uid_tk_url, 'storeHlsUrl': store_hls_url})
|
|
|
|
|
|
@staticmethod
|
|
@staticmethod
|
|
@@ -813,11 +813,12 @@ class CloudStorageView(View):
|
|
device_name = CommonService.get_full_serial_number(uid, serial_number, device_type)
|
|
device_name = CommonService.get_full_serial_number(uid, serial_number, device_type)
|
|
else:
|
|
else:
|
|
device_name = uid
|
|
device_name = uid
|
|
- sys_msg_text_list = ['温馨提示:尊敬的客户,您的' + device_name + '设备在' + date_time + '已成功购买云存套餐',
|
|
|
|
- 'Dear customer,you already subscribed the cloud storage package successfully for device ' + device_name + ' on ' + time.strftime(
|
|
|
|
- "%b %dth,%Y", time.localtime())]
|
|
|
|
|
|
+ sys_msg_text_list = [
|
|
|
|
+ '温馨提示:尊敬的客户,您的' + device_name + '设备在' + date_time + '已成功购买云存套餐',
|
|
|
|
+ 'Dear customer,you already subscribed the cloud storage package successfully for device ' + device_name + ' on ' + time.strftime(
|
|
|
|
+ "%b %dth,%Y", time.localtime())]
|
|
self.do_vod_msg_notice(uid, channel, userid, lang, sys_msg_text_list, 'SMS_219738485')
|
|
self.do_vod_msg_notice(uid, channel, userid, lang, sys_msg_text_list, 'SMS_219738485')
|
|
- red_url = "{SERVER_DOMAIN_SSL}web/paid2/success.html".format(SERVER_DOMAIN_SSL=SERVER_DOMAIN_SSL)
|
|
|
|
|
|
+ red_url = "{}web/paid2/success.html".format(SERVER_DOMAIN_SSL)
|
|
if lang != 'cn':
|
|
if lang != 'cn':
|
|
red_url = red_url.replace('success.html', 'en_success.html')
|
|
red_url = red_url.replace('success.html', 'en_success.html')
|
|
redis_obj.del_data(key=order_id + 'do_notify')
|
|
redis_obj.del_data(key=order_id + 'do_notify')
|
|
@@ -834,7 +835,7 @@ class CloudStorageView(View):
|
|
if order_qs:
|
|
if order_qs:
|
|
order_qs.update(status=10, promotion_rule_id=promotion_rule_id)
|
|
order_qs.update(status=10, promotion_rule_id=promotion_rule_id)
|
|
redis_obj.del_data(key=order_id + 'do_notify')
|
|
redis_obj.del_data(key=order_id + 'do_notify')
|
|
- red_url = "{SERVER_DOMAIN_SSL}web/paid2/fail.html".format(SERVER_DOMAIN_SSL=SERVER_DOMAIN_SSL)
|
|
|
|
|
|
+ red_url = "{}web/paid2/fail.html".format(SERVER_DOMAIN_SSL)
|
|
if lang != 'cn':
|
|
if lang != 'cn':
|
|
red_url = red_url.replace('fail.html', 'en_fail.html')
|
|
red_url = red_url.replace('fail.html', 'en_fail.html')
|
|
return HttpResponseRedirect(red_url)
|
|
return HttpResponseRedirect(red_url)
|
|
@@ -872,7 +873,7 @@ class CloudStorageView(View):
|
|
promotion_rule_id = ''
|
|
promotion_rule_id = ''
|
|
try:
|
|
try:
|
|
if not order_id:
|
|
if not order_id:
|
|
- red_url = "{SERVER_DOMAIN_SSL}web/paid2/fail.html".format(SERVER_DOMAIN_SSL=SERVER_DOMAIN_SSL)
|
|
|
|
|
|
+ red_url = "{}web/paid2/fail.html".format(SERVER_DOMAIN_SSL)
|
|
if lang != 'cn':
|
|
if lang != 'cn':
|
|
red_url = red_url.replace('fail.html', 'en_fail.html')
|
|
red_url = red_url.replace('fail.html', 'en_fail.html')
|
|
return HttpResponseRedirect(red_url)
|
|
return HttpResponseRedirect(red_url)
|
|
@@ -886,7 +887,7 @@ class CloudStorageView(View):
|
|
payers = payment.execute({"payer_id": payer_id})
|
|
payers = payment.execute({"payer_id": payer_id})
|
|
logger.info(payers)
|
|
logger.info(payers)
|
|
if not payers:
|
|
if not payers:
|
|
- red_url = "{SERVER_DOMAIN_SSL}web/paid2/fail.html".format(SERVER_DOMAIN_SSL=SERVER_DOMAIN_SSL)
|
|
|
|
|
|
+ red_url = "{}web/paid2/fail.html".format(SERVER_DOMAIN_SSL)
|
|
if lang != 'cn':
|
|
if lang != 'cn':
|
|
red_url = red_url.replace('fail.html', 'en_fail.html')
|
|
red_url = red_url.replace('fail.html', 'en_fail.html')
|
|
redis_obj.del_data(key=order_id + 'do_notify')
|
|
redis_obj.del_data(key=order_id + 'do_notify')
|
|
@@ -966,13 +967,14 @@ class CloudStorageView(View):
|
|
device_name = CommonService.get_full_serial_number(uid, serial_number, device_type)
|
|
device_name = CommonService.get_full_serial_number(uid, serial_number, device_type)
|
|
else:
|
|
else:
|
|
device_name = uid
|
|
device_name = uid
|
|
- sys_msg_text_list = ['温馨提示:尊敬的客户,您的' + device_name + '设备在' + date_time + '已成功购买云存套餐',
|
|
|
|
- 'Dear customer,you already subscribed the cloud storage package successfully for device ' + device_name + ' on ' + time.strftime(
|
|
|
|
- "%b %dth,%Y", time.localtime())]
|
|
|
|
|
|
+ sys_msg_text_list = [
|
|
|
|
+ '温馨提示:尊敬的客户,您的' + device_name + '设备在' + date_time + '已成功购买云存套餐',
|
|
|
|
+ 'Dear customer,you already subscribed the cloud storage package successfully for device ' + device_name + ' on ' + time.strftime(
|
|
|
|
+ "%b %dth,%Y", time.localtime())]
|
|
|
|
|
|
self.do_vod_msg_notice(uid, channel, userid, lang, sys_msg_text_list, 'SMS_219738485')
|
|
self.do_vod_msg_notice(uid, channel, userid, lang, sys_msg_text_list, 'SMS_219738485')
|
|
|
|
|
|
- red_url = "{SERVER_DOMAIN_SSL}web/paid2/success.html".format(SERVER_DOMAIN_SSL=SERVER_DOMAIN_SSL)
|
|
|
|
|
|
+ red_url = "{}web/paid2/success.html".format(SERVER_DOMAIN_SSL)
|
|
if lang != 'cn':
|
|
if lang != 'cn':
|
|
red_url = red_url.replace('success.html', 'en_success.html')
|
|
red_url = red_url.replace('success.html', 'en_success.html')
|
|
redis_obj.del_data(key=order_id + 'do_notify')
|
|
redis_obj.del_data(key=order_id + 'do_notify')
|
|
@@ -983,7 +985,7 @@ class CloudStorageView(View):
|
|
logger.info(repr(e))
|
|
logger.info(repr(e))
|
|
if order_qs:
|
|
if order_qs:
|
|
order_qs.update(status=10, promotion_rule_id=promotion_rule_id)
|
|
order_qs.update(status=10, promotion_rule_id=promotion_rule_id)
|
|
- red_url = "{SERVER_DOMAIN_SSL}web/paid2/fail.html".format(SERVER_DOMAIN_SSL=SERVER_DOMAIN_SSL)
|
|
|
|
|
|
+ red_url = "{}web/paid2/fail.html".format(SERVER_DOMAIN_SSL)
|
|
if lang != 'cn':
|
|
if lang != 'cn':
|
|
red_url = red_url.replace('fail.html', 'en_fail.html')
|
|
red_url = red_url.replace('fail.html', 'en_fail.html')
|
|
redis_obj.del_data(key=order_id + 'do_notify')
|
|
redis_obj.del_data(key=order_id + 'do_notify')
|
|
@@ -1101,9 +1103,10 @@ class CloudStorageView(View):
|
|
device_name = CommonService.get_full_serial_number(uid, serial_number, device_type)
|
|
device_name = CommonService.get_full_serial_number(uid, serial_number, device_type)
|
|
else:
|
|
else:
|
|
device_name = uid
|
|
device_name = uid
|
|
- sys_msg_text_list = ['温馨提示:尊敬的客户,您的' + device_name + '设备在' + date_time + '已成功购买云存套餐',
|
|
|
|
- 'Dear customer,you already subscribed the cloud storage package successfully for device ' + device_name + ' on ' + time.strftime(
|
|
|
|
- "%b %dth,%Y", time.localtime())]
|
|
|
|
|
|
+ sys_msg_text_list = [
|
|
|
|
+ '温馨提示:尊敬的客户,您的' + device_name + '设备在' + date_time + '已成功购买云存套餐',
|
|
|
|
+ 'Dear customer,you already subscribed the cloud storage package successfully for device ' + device_name + ' on ' + time.strftime(
|
|
|
|
+ "%b %dth,%Y", time.localtime())]
|
|
self.do_vod_msg_notice(uid, channel, userid, lang, sys_msg_text_list, 'SMS_219738485')
|
|
self.do_vod_msg_notice(uid, channel, userid, lang, sys_msg_text_list, 'SMS_219738485')
|
|
redis_obj.del_data(key=order_id + 'do_notify')
|
|
redis_obj.del_data(key=order_id + 'do_notify')
|
|
return HttpResponse("<xml>\
|
|
return HttpResponse("<xml>\
|
|
@@ -1227,11 +1230,11 @@ class CloudStorageView(View):
|
|
|
|
|
|
return response.json(0, {"redirectUrl": sub_info['url'], "orderID": order_id})
|
|
return response.json(0, {"redirectUrl": sub_info['url'], "orderID": order_id})
|
|
# 正常扣款
|
|
# 正常扣款
|
|
- call_clc_url = "{SERVER_DOMAIN_SSL}web/paid2/fail.html".format(SERVER_DOMAIN_SSL=SERVER_DOMAIN_SSL)
|
|
|
|
|
|
+ call_clc_url = "{}web/paid2/fail.html".format(SERVER_DOMAIN_SSL)
|
|
if lang != 'cn':
|
|
if lang != 'cn':
|
|
call_clc_url = call_clc_url.replace('fail.html', 'en_fail.html')
|
|
call_clc_url = call_clc_url.replace('fail.html', 'en_fail.html')
|
|
- call_sub_url = "{SERVER_DOMAIN_SSL}cloudstorage/dopaypalcallback?orderID={orderID}&lang={lang}". \
|
|
|
|
- format(SERVER_DOMAIN_SSL=SERVER_DOMAIN_SSL, orderID=order_id, lang=lang)
|
|
|
|
|
|
+ call_sub_url = "{}cloudstorage/dopaypalcallback?orderID={}&lang={}".format(SERVER_DOMAIN_SSL, order_id,
|
|
|
|
+ lang)
|
|
|
|
|
|
paypalrestsdk.configure(PAYPAL_CRD)
|
|
paypalrestsdk.configure(PAYPAL_CRD)
|
|
payment = paypalrestsdk.Payment({
|
|
payment = paypalrestsdk.Payment({
|
|
@@ -1269,10 +1272,9 @@ class CloudStorageView(View):
|
|
out_trade_no=order_id,
|
|
out_trade_no=order_id,
|
|
total_amount=price,
|
|
total_amount=price,
|
|
subject=subject,
|
|
subject=subject,
|
|
- return_url="{SERVER_DOMAIN_SSL}web/paid2/success.html".format(SERVER_DOMAIN_SSL=SERVER_DOMAIN_SSL),
|
|
|
|
- notify_url="{SERVER_DOMAIN_SSL}cloudstorage/doalicallback".format(
|
|
|
|
- SERVER_DOMAIN_SSL=SERVER_DOMAIN_SSL),
|
|
|
|
- quit_url="{SERVER_DOMAIN_SSL}web/paid2/fail.html".format(SERVER_DOMAIN_SSL=SERVER_DOMAIN_SSL),
|
|
|
|
|
|
+ return_url="{}web/paid2/success.html".format(SERVER_DOMAIN_SSL),
|
|
|
|
+ notify_url="{}cloudstorage/doalicallback".format(SERVER_DOMAIN_SSL),
|
|
|
|
+ quit_url="{}web/paid2/fail.html".format(SERVER_DOMAIN_SSL),
|
|
passback_params=quote("lang=" + lang)
|
|
passback_params=quote("lang=" + lang)
|
|
)
|
|
)
|
|
|
|
|
|
@@ -1298,7 +1300,7 @@ class CloudStorageView(View):
|
|
|
|
|
|
elif pay_type == 3:
|
|
elif pay_type == 3:
|
|
pay = WechatPayObject()
|
|
pay = WechatPayObject()
|
|
- notify_url = "{SERVER_DOMAIN_SSL}cloudstorage/dowechatnotify".format(SERVER_DOMAIN_SSL=SERVER_DOMAIN_SSL)
|
|
|
|
|
|
+ notify_url = "{}cloudstorage/dowechatnotify".format(SERVER_DOMAIN_SSL)
|
|
content = CommonService.Package_Type(0, content) # 云存套餐
|
|
content = CommonService.Package_Type(0, content) # 云存套餐
|
|
# 获取参数
|
|
# 获取参数
|
|
parameter_dict = pay.get_parameter(order_id, content, float(price) * 100, ip, notify_url,
|
|
parameter_dict = pay.get_parameter(order_id, content, float(price) * 100, ip, notify_url,
|
|
@@ -1456,35 +1458,35 @@ class CloudStorageView(View):
|
|
device_name = CommonService.get_full_serial_number(uid, serial_number, device_type)
|
|
device_name = CommonService.get_full_serial_number(uid, serial_number, device_type)
|
|
else:
|
|
else:
|
|
device_name = uid
|
|
device_name = uid
|
|
- sys_msg_text_list = ['温馨提示:尊敬的客户,您的' + device_name + '设备在' + date_time + '已成功购买云存套餐',
|
|
|
|
- 'Dear customer,you already subscribed the cloud storage package successfully for device ' + device_name + ' on ' + time.strftime(
|
|
|
|
- "%b %dth,%Y", time.localtime())]
|
|
|
|
|
|
+ sys_msg_text_list = [
|
|
|
|
+ '温馨提示:尊敬的客户,您的' + device_name + '设备在' + date_time + '已成功购买云存套餐',
|
|
|
|
+ 'Dear customer,you already subscribed the cloud storage package successfully for device ' + device_name + ' on ' + time.strftime(
|
|
|
|
+ "%b %dth,%Y", time.localtime())]
|
|
|
|
|
|
- return_url = "{SERVER_DOMAIN_SSL}cloudstorage/payOK?lang={lang}".format(
|
|
|
|
- SERVER_DOMAIN_SSL=SERVER_DOMAIN_SSL, lang=lang)
|
|
|
|
|
|
+ return_url = "{}cloudstorage/payOK?lang={}".format(SERVER_DOMAIN_SSL, lang)
|
|
if pay_type == 10:
|
|
if pay_type == 10:
|
|
ExperienceContextModel.objects.create(
|
|
ExperienceContextModel.objects.create(
|
|
experience_type=0,
|
|
experience_type=0,
|
|
uid=uid,
|
|
uid=uid,
|
|
do_time=now_time
|
|
do_time=now_time
|
|
)
|
|
)
|
|
- return_url = "{SERVER_DOMAIN_SSL}cloudstorage/payOK?paytype=10&lang={lang}".format(
|
|
|
|
- SERVER_DOMAIN_SSL=SERVER_DOMAIN_SSL, lang=lang)
|
|
|
|
|
|
+ return_url = "{}cloudstorage/payOK?paytype=10&lang={}".format(SERVER_DOMAIN_SSL, lang)
|
|
date_time = time.strftime("%Y-%m-%d", time.localtime())
|
|
date_time = time.strftime("%Y-%m-%d", time.localtime())
|
|
- sys_msg_text_list = ['温馨提示:尊敬的客户,您的' + device_name + '设备在' + date_time + '已成功开通云存体验套餐',
|
|
|
|
- 'Dear customer,you already subscribed the free trial cloud storage service successfully for device ' + device_name + ' on ' + time.strftime(
|
|
|
|
- "%b %dth,%Y", time.localtime())]
|
|
|
|
|
|
+ sys_msg_text_list = [
|
|
|
|
+ '温馨提示:尊敬的客户,您的' + device_name + '设备在' + date_time + '已成功开通云存体验套餐',
|
|
|
|
+ 'Dear customer,you already subscribed the free trial cloud storage service successfully for device ' + device_name + ' on ' + time.strftime(
|
|
|
|
+ "%b %dth,%Y", time.localtime())]
|
|
sms = 'SMS_222870823'
|
|
sms = 'SMS_222870823'
|
|
if pay_type == 11:
|
|
if pay_type == 11:
|
|
update_dict = {'is_activate': 1, 'order': order_id}
|
|
update_dict = {'is_activate': 1, 'order': order_id}
|
|
CDKcontextModel.objects.filter(cdk=cdk).update(**update_dict)
|
|
CDKcontextModel.objects.filter(cdk=cdk).update(**update_dict)
|
|
- return_url = "{SERVER_DOMAIN_SSL}cloudstorage/payOK?paytype=11&lang={lang}".format(
|
|
|
|
- SERVER_DOMAIN_SSL=SERVER_DOMAIN_SSL, lang=lang)
|
|
|
|
|
|
+ return_url = "{}cloudstorage/payOK?paytype=11&lang={}".format(SERVER_DOMAIN_SSL, lang)
|
|
|
|
|
|
date_time = time.strftime("%Y-%m-%d", time.localtime())
|
|
date_time = time.strftime("%Y-%m-%d", time.localtime())
|
|
- sys_msg_text_list = ['温馨提示:尊敬的客户,您的' + device_name + '设备在' + date_time + '已成功兑换云存套餐',
|
|
|
|
- 'Dear customer, you already redeemed for the cloud storage package successfully for device ' + device_name + ' on ' + time.strftime(
|
|
|
|
- "%b %dth,%Y", time.localtime())]
|
|
|
|
|
|
+ sys_msg_text_list = [
|
|
|
|
+ '温馨提示:尊敬的客户,您的' + device_name + '设备在' + date_time + '已成功兑换云存套餐',
|
|
|
|
+ 'Dear customer, you already redeemed for the cloud storage package successfully for device ' + device_name + ' on ' + time.strftime(
|
|
|
|
+ "%b %dth,%Y", time.localtime())]
|
|
sms = 'SMS_219748439'
|
|
sms = 'SMS_219748439'
|
|
|
|
|
|
self.do_vod_msg_notice(uid, channel, user_id, lang, sys_msg_text_list, sms)
|
|
self.do_vod_msg_notice(uid, channel, user_id, lang, sys_msg_text_list, sms)
|
|
@@ -1988,6 +1990,6 @@ class CloudStorageView(View):
|
|
order_qs.update(**update_dict)
|
|
order_qs.update(**update_dict)
|
|
return response.json(0)
|
|
return response.json(0)
|
|
except Exception as e:
|
|
except Exception as e:
|
|
- LOGGER.info('异常详情,errLine:{}, errMsg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
|
|
|
|
- print(e)
|
|
|
|
|
|
+ logger = logging.getLogger('info')
|
|
|
|
+ logger.info('异常详情,errLine:{}, errMsg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
|
|
return response.json(500, repr(e))
|
|
return response.json(500, repr(e))
|