|
@@ -6,6 +6,7 @@ import hashlib
|
|
|
import time
|
|
|
import uuid
|
|
|
import json
|
|
|
+import logging
|
|
|
|
|
|
import paypalrestsdk
|
|
|
import requests
|
|
@@ -31,6 +32,7 @@ from Object.UnicomObject import UnicomObjeect
|
|
|
from Object.utils.PayPalUtil import PayPalService
|
|
|
from Service.CommonService import CommonService
|
|
|
|
|
|
+LOGGER = logging.getLogger('info')
|
|
|
|
|
|
class serveManagement(View):
|
|
|
def get(self, request, *args, **kwargs):
|
|
@@ -1854,12 +1856,16 @@ class serveManagement(View):
|
|
|
if old_using_uid_bucket.exists():
|
|
|
if old_using_uid_bucket.first().endTime < nowTime:
|
|
|
return response.json(10013)
|
|
|
- else:
|
|
|
- if not old_unusing_uid_bucket.exists():
|
|
|
- return response.json(10017)
|
|
|
+ if not old_using_uid_bucket.exists() and not old_unusing_uid_bucket.exists():
|
|
|
+ return response.json(10017)
|
|
|
+
|
|
|
+ if old_using_uid_bucket.exists() and old_unusing_uid_bucket():
|
|
|
+ LOGGER.info(f'云存转移, orderID:{orderID}, 该订单同时出现在已使用和未使用数据库')
|
|
|
+ return response.json(10018)
|
|
|
|
|
|
# 订单套餐未使用
|
|
|
- if old_unusing_uid_bucket.exists():
|
|
|
+ elif old_unusing_uid_bucket.exists():
|
|
|
+ LOGGER.info(f'云存转移, orderID:{orderID}, 该订单套餐在原设备未使用')
|
|
|
with transaction.atomic():
|
|
|
# 旧设备不包含 ai
|
|
|
if old_unusing_uid_bucket.filter(is_ai=1).exists():
|
|
@@ -1884,6 +1890,7 @@ class serveManagement(View):
|
|
|
# 激活转移的套餐
|
|
|
unused = new_unused_uid_bucket[0]
|
|
|
endTime = CommonService.calcMonthLater(unused['expire'])
|
|
|
+ LOGGER.info(f'云存转移, orderID:{orderID}, 激活转移之后的套餐, endTime: {endTime}')
|
|
|
# 判断是否有已过期套餐
|
|
|
if UID_Bucket.objects.filter(uid=new_uid).exists():
|
|
|
UID_Bucket.objects.filter(uid=new_uid).update(status=1, orderId=orderID, updateTime=nowTime,
|
|
@@ -1929,6 +1936,7 @@ class serveManagement(View):
|
|
|
|
|
|
# 订单套餐已使用
|
|
|
else:
|
|
|
+ LOGGER.info(f'云存转移, orderID:{orderID}, 该订单套餐在原设备已使用')
|
|
|
old_using_uid_bucket = old_using_uid_bucket.values('id', 'bucket_id', 'has_unused',
|
|
|
'bucket__content').order_by('addTime')
|
|
|
old_ai_service = AiService.objects.filter(uid=old_uid, endTime__gte=nowTime, use_status=1).values('id',
|