|
@@ -775,7 +775,7 @@ class CloudStorageView(View):
|
|
|
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)
|
|
|
- if uid_set_qs[0].is_ai != 2:
|
|
|
+ if uid_set_qs[0].is_ai != 2 and CONFIG_INFO != CONFIG_CN:
|
|
|
if not all([appBundleId, app_type, token_val, uid, m_code, ai_status]):
|
|
|
return response.json(444, 'appBundleId, app_type, token_val, uid,m_code, ai_status')
|
|
|
|
|
@@ -932,7 +932,7 @@ class CloudStorageView(View):
|
|
|
if not store_qs.exists():
|
|
|
return response.json(173)
|
|
|
bucket_id = store_qs[0]['bucket_id']
|
|
|
- uiu_bucket_qs = UID_Bucket.objects.filter(uid=uid).values("id", "bucket_id", "bucket__storeDay",
|
|
|
+ uid_bucket_qs = UID_Bucket.objects.filter(uid=uid).values("id", "bucket_id", "bucket__storeDay",
|
|
|
"bucket__region", "endTime", "use_status")
|
|
|
expire = store_qs[0]['expire']
|
|
|
# icloud_store_meal_id = store_qs[0]['icloud_store_meal_id']
|
|
@@ -949,15 +949,17 @@ class CloudStorageView(View):
|
|
|
if promotion.exists():
|
|
|
promotion_rule_id = promotion[0]['id']
|
|
|
expire = expire * 2
|
|
|
+ unuse_meal_flag = False # 是否关联未使用套餐
|
|
|
with transaction.atomic():
|
|
|
- if uiu_bucket_qs.exists():
|
|
|
- uid_bucket = uiu_bucket_qs.first()
|
|
|
+ if uid_bucket_qs.exists():
|
|
|
+ uid_bucket = uid_bucket_qs.first()
|
|
|
if uid_bucket['use_status'] == 1 and uid_bucket['bucket_id'] == bucket_id: # 套餐使用中并且相同套餐叠加过期时间
|
|
|
end_time = CommonService.calcMonthLater(expire, uid_bucket['endTime'])
|
|
|
UID_Bucket.objects.filter(id=uid_bucket['id']).update(uid=uid, channel=channel,
|
|
|
bucket_id=bucket_id, endTime=end_time,
|
|
|
updateTime=now_time)
|
|
|
else: # 已过期或者不相同的套餐加入未使用的关联套餐表
|
|
|
+ unuse_meal_flag = True
|
|
|
unused_uid_qs = Unused_Uid_Meal.objects.filter(uid=uid, bucket_id=bucket_id)
|
|
|
nums = 2 if order_list[0]['isSelectDiscounts'] == 1 else 1
|
|
|
if promotion.exists():
|
|
@@ -993,7 +995,7 @@ class CloudStorageView(View):
|
|
|
promotion_rule_id=promotion_rule_id)
|
|
|
date_time = time.strftime("%Y-%m-%d", time.localtime())
|
|
|
# 开通AI服务
|
|
|
- if store_qs[0]['is_ai'] and CONFIG_INFO != CONFIG_CN:
|
|
|
+ if store_qs[0]['is_ai'] and CONFIG_INFO != CONFIG_CN and not unuse_meal_flag:
|
|
|
ai_service_qs = AiService.objects.filter(uid=uid, channel=channel)
|
|
|
if ai_service_qs.exists(): # 有正在使用的套餐,套餐结束时间保存为套餐有效期
|
|
|
ai_service_qs.update(endTime=end_time, use_status=1, updTime=now_time)
|
|
@@ -1139,6 +1141,7 @@ class CloudStorageView(View):
|
|
|
if promotion_rule_qs.exists():
|
|
|
promotion_rule_id = promotion_rule_qs[0]['id']
|
|
|
expire = expire * 2
|
|
|
+ unuse_meal_flag = False # 是否关联未使用套餐
|
|
|
with transaction.atomic():
|
|
|
if uid_bucket_qs.exists():
|
|
|
uid_bucket = uid_bucket_qs.first()
|
|
@@ -1148,6 +1151,7 @@ class CloudStorageView(View):
|
|
|
endTime=end_time,
|
|
|
bucket_id=bucket_id, updateTime=now_time)
|
|
|
else: # 已过期或者不相同的套餐加入未使用的关联套餐表
|
|
|
+ unuse_meal_flag = True
|
|
|
unused_uid_qs = Unused_Uid_Meal.objects.filter(uid=uid, bucket_id=bucket_id)
|
|
|
nums = 2 if order_list[0]['isSelectDiscounts'] == 1 else 1
|
|
|
if promotion_rule_qs.exists():
|
|
@@ -1182,7 +1186,7 @@ class CloudStorageView(View):
|
|
|
promotion_rule_id=promotion_rule_id)
|
|
|
date_time = time.strftime("%Y-%m-%d", time.localtime())
|
|
|
# 开通AI服务
|
|
|
- if store_qs[0]['is_ai'] and CONFIG_INFO != CONFIG_CN:
|
|
|
+ if store_qs[0]['is_ai'] and CONFIG_INFO != CONFIG_CN and not unuse_meal_flag:
|
|
|
ai_service_qs = AiService.objects.filter(uid=uid, channel=channel)
|
|
|
if ai_service_qs.exists(): # 有正在使用的套餐,套餐结束时间保存为套餐有效期
|
|
|
ai_service_qs.update(endTime=end_time, use_status=1, updTime=now_time)
|
|
@@ -1310,6 +1314,7 @@ class CloudStorageView(View):
|
|
|
if promotion_rule_qs.exists():
|
|
|
promotion_rule_id = promotion_rule_qs[0]['id']
|
|
|
expire = expire * 2
|
|
|
+ unuse_meal_flag = False # 是否关联未使用套餐
|
|
|
with transaction.atomic():
|
|
|
if uid_bucket_qs.exists():
|
|
|
uid_bucket = uid_bucket_qs.first()
|
|
@@ -1319,6 +1324,7 @@ class CloudStorageView(View):
|
|
|
bucket_id=bucket_id,
|
|
|
endTime=end_time, updateTime=now_time)
|
|
|
else: # 已过期或者不相同的套餐加入未使用的关联套餐表
|
|
|
+ unuse_meal_flag = True
|
|
|
unused_uid_qs = Unused_Uid_Meal.objects.filter(uid=uid, bucket_id=bucket_id)
|
|
|
nums = 2 if order_list[0]['isSelectDiscounts'] == 1 else 1
|
|
|
if promotion_rule_qs.exists():
|
|
@@ -1354,7 +1360,7 @@ class CloudStorageView(View):
|
|
|
promotion_rule_id=promotion_rule_id)
|
|
|
date_time = time.strftime("%Y-%m-%d", time.localtime())
|
|
|
# 开通AI服务
|
|
|
- if store_qs[0]['is_ai'] and CONFIG_INFO != CONFIG_CN:
|
|
|
+ if store_qs[0]['is_ai'] and CONFIG_INFO != CONFIG_CN and not unuse_meal_flag:
|
|
|
ai_service_qs = AiService.objects.filter(uid=uid, channel=channel)
|
|
|
if ai_service_qs.exists(): # 有正在使用的套餐,套餐结束时间保存为套餐有效期
|
|
|
ai_service_qs.update(endTime=end_time, use_status=1, updTime=now_time)
|
|
@@ -1700,6 +1706,7 @@ class CloudStorageView(View):
|
|
|
uid_bucket_qs = UID_Bucket.objects.filter(uid=uid).values("id", "bucket_id", "bucket__storeDay",
|
|
|
"bucket__region", "endTime", "use_status")
|
|
|
expire = store_qs[0]['expire']
|
|
|
+ unuse_meal_flag = False # 是否关联未使用套餐
|
|
|
# icloud_store_meal_id = store_qs[0]['icloud_store_meal_id']
|
|
|
# icloud_meal_qs = ICloudStoreMeal.objects.filter(id=icloud_store_meal_id).values('size')
|
|
|
# if not icloud_meal_qs.exists():
|
|
@@ -1715,6 +1722,7 @@ class CloudStorageView(View):
|
|
|
bucket_id=bucket_id,
|
|
|
endTime=end_time, updateTime=now_time)
|
|
|
else: # 已过期或者不相同的套餐加入未使用的关联套餐表
|
|
|
+ unuse_meal_flag = True
|
|
|
unused_uid_qs = Unused_Uid_Meal.objects.filter(uid=uid, bucket_id=bucket_id)
|
|
|
nums = 1
|
|
|
if unused_uid_qs.exists():
|
|
@@ -1731,7 +1739,7 @@ class CloudStorageView(View):
|
|
|
use_status=1)
|
|
|
uid_bucket_id = uid_bucket.id
|
|
|
# 开通AI体验
|
|
|
- if store_qs[0]['is_ai'] and CONFIG_INFO != CONFIG_CN:
|
|
|
+ if store_qs[0]['is_ai'] and CONFIG_INFO != CONFIG_CN and not unuse_meal_flag:
|
|
|
order_type = 1
|
|
|
ai_service_qs = AiService.objects.filter(uid=uid, channel=channel)
|
|
|
if ai_service_qs.exists():
|