|
@@ -191,10 +191,7 @@ class CloudStorageView(View):
|
|
device_info_qs = Device_Info.objects.filter(Q(UID=uid), Q(Type__lte=4) | Q(Type=10001))
|
|
device_info_qs = Device_Info.objects.filter(Q(UID=uid), Q(Type__lte=4) | Q(Type=10001))
|
|
if device_info_qs.exists():
|
|
if device_info_qs.exists():
|
|
return response.json(0)
|
|
return response.json(0)
|
|
- uid_set_qs = UidSetModel.objects.filter(uid=uid).values('is_ai')
|
|
|
|
- if not uid_set_qs.exists():
|
|
|
|
- return response.json(173)
|
|
|
|
- is_ai = uid_set_qs[0]['is_ai']
|
|
|
|
|
|
+
|
|
store_qs = Store_Meal.objects.filter(Q(lang__lang=lang), Q(is_show=0), ~Q(pay_type='11')) # 过滤激活码、隐藏套餐
|
|
store_qs = Store_Meal.objects.filter(Q(lang__lang=lang), Q(is_show=0), ~Q(pay_type='11')) # 过滤激活码、隐藏套餐
|
|
experience_context_qs = ExperienceContextModel.objects.filter(uid=uid, experience_type=0)
|
|
experience_context_qs = ExperienceContextModel.objects.filter(uid=uid, experience_type=0)
|
|
|
|
|
|
@@ -206,15 +203,11 @@ class CloudStorageView(View):
|
|
store_qs = store_qs.filter(~Q(pay_type='10'))
|
|
store_qs = store_qs.filter(~Q(pay_type='10'))
|
|
else:
|
|
else:
|
|
store_qs = store_qs.filter(pay_type='10')
|
|
store_qs = store_qs.filter(pay_type='10')
|
|
- if CONFIG_INFO != CONFIG_CN and is_ai != 2: # 返回支持AI的套餐
|
|
|
|
- store_qs = store_qs.filter(is_ai=1)
|
|
|
|
- else: # 返回不支持AI的套餐
|
|
|
|
- store_qs = store_qs.filter(is_ai=0)
|
|
|
|
|
|
|
|
store_qs = store_qs.annotate(title=F('lang__title'), content=F('lang__content'),
|
|
store_qs = store_qs.annotate(title=F('lang__title'), content=F('lang__content'),
|
|
discount_content=F('lang__discount_content'))
|
|
discount_content=F('lang__discount_content'))
|
|
store_qs = store_qs.order_by('sort').values("id", "title", "content", "price", "day", "currency",
|
|
store_qs = store_qs.order_by('sort').values("id", "title", "content", "price", "day", "currency",
|
|
- "bucket__storeDay", 'is_beta', 'is_ai',
|
|
|
|
|
|
+ "bucket__storeDay",
|
|
"bucket__bucket", "bucket__area", "commodity_code",
|
|
"bucket__bucket", "bucket__area", "commodity_code",
|
|
"commodity_type", "is_discounts", "virtual_price", "expire",
|
|
"commodity_type", "is_discounts", "virtual_price", "expire",
|
|
"discount_price", "discount_content", "symbol", "cycle_config_id")
|
|
"discount_price", "discount_content", "symbol", "cycle_config_id")
|
|
@@ -929,7 +922,7 @@ class CloudStorageView(View):
|
|
rank = order_list[0]['rank']
|
|
rank = order_list[0]['rank']
|
|
|
|
|
|
store_qs = Store_Meal.objects.filter(id=rank).values("day", "bucket_id", "bucket__storeDay", "expire",
|
|
store_qs = Store_Meal.objects.filter(id=rank).values("day", "bucket_id", "bucket__storeDay", "expire",
|
|
- 'is_ai', 'icloud_store_meal_id')
|
|
|
|
|
|
+ 'icloud_store_meal_id')
|
|
if not store_qs.exists():
|
|
if not store_qs.exists():
|
|
return response.json(173)
|
|
return response.json(173)
|
|
bucket_id = store_qs[0]['bucket_id']
|
|
bucket_id = store_qs[0]['bucket_id']
|
|
@@ -950,7 +943,6 @@ class CloudStorageView(View):
|
|
if promotion.exists():
|
|
if promotion.exists():
|
|
promotion_rule_id = promotion[0]['id']
|
|
promotion_rule_id = promotion[0]['id']
|
|
expire = expire * 2
|
|
expire = expire * 2
|
|
- unuse_meal_flag = False # 是否关联未使用套餐
|
|
|
|
with transaction.atomic():
|
|
with transaction.atomic():
|
|
if uid_bucket_qs.exists():
|
|
if uid_bucket_qs.exists():
|
|
uid_bucket = uid_bucket_qs.first()
|
|
uid_bucket = uid_bucket_qs.first()
|
|
@@ -960,7 +952,6 @@ class CloudStorageView(View):
|
|
bucket_id=bucket_id, endTime=end_time,
|
|
bucket_id=bucket_id, endTime=end_time,
|
|
updateTime=now_time)
|
|
updateTime=now_time)
|
|
else: # 已过期或者不相同的套餐加入未使用的关联套餐表
|
|
else: # 已过期或者不相同的套餐加入未使用的关联套餐表
|
|
- unuse_meal_flag = True
|
|
|
|
unused_uid_qs = Unused_Uid_Meal.objects.filter(uid=uid, bucket_id=bucket_id)
|
|
unused_uid_qs = Unused_Uid_Meal.objects.filter(uid=uid, bucket_id=bucket_id)
|
|
nums = 2 if order_list[0]['isSelectDiscounts'] == 1 else 1
|
|
nums = 2 if order_list[0]['isSelectDiscounts'] == 1 else 1
|
|
if promotion.exists():
|
|
if promotion.exists():
|
|
@@ -995,22 +986,6 @@ class CloudStorageView(View):
|
|
order_qs.update(status=1, updTime=now_time, uid_bucket_id=uid_bucket_id,
|
|
order_qs.update(status=1, updTime=now_time, uid_bucket_id=uid_bucket_id,
|
|
promotion_rule_id=promotion_rule_id)
|
|
promotion_rule_id=promotion_rule_id)
|
|
date_time = time.strftime("%Y-%m-%d", time.localtime())
|
|
date_time = time.strftime("%Y-%m-%d", time.localtime())
|
|
- # 开通AI服务
|
|
|
|
- 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)
|
|
|
|
- else:
|
|
|
|
- ai_service_dict = {
|
|
|
|
- 'uid': uid,
|
|
|
|
- 'channel': channel,
|
|
|
|
- 'detect_status': 1,
|
|
|
|
- 'addTime': now_time,
|
|
|
|
- 'updTime': now_time,
|
|
|
|
- 'use_status': 1,
|
|
|
|
- 'endTime': end_time
|
|
|
|
- }
|
|
|
|
- AiService.objects.create(**ai_service_dict)
|
|
|
|
# 开通云盘服务
|
|
# 开通云盘服务
|
|
# icloud_use_qs = IcloudUseDetails.objects.filter(user_id=userid).values('id')
|
|
# icloud_use_qs = IcloudUseDetails.objects.filter(user_id=userid).values('id')
|
|
# if not icloud_use_qs.exists():
|
|
# if not icloud_use_qs.exists():
|
|
@@ -1121,7 +1096,7 @@ class CloudStorageView(View):
|
|
channel = order_list[0]['channel']
|
|
channel = order_list[0]['channel']
|
|
rank = order_list[0]['rank']
|
|
rank = order_list[0]['rank']
|
|
store_qs = Store_Meal.objects.filter(id=rank).values("day", "bucket_id", "bucket__storeDay", "expire",
|
|
store_qs = Store_Meal.objects.filter(id=rank).values("day", "bucket_id", "bucket__storeDay", "expire",
|
|
- 'is_ai', 'icloud_store_meal_id')
|
|
|
|
|
|
+ 'icloud_store_meal_id')
|
|
if not store_qs.exists():
|
|
if not store_qs.exists():
|
|
return response.json(173)
|
|
return response.json(173)
|
|
bucket_id = store_qs[0]['bucket_id']
|
|
bucket_id = store_qs[0]['bucket_id']
|
|
@@ -1142,7 +1117,6 @@ class CloudStorageView(View):
|
|
if promotion_rule_qs.exists():
|
|
if promotion_rule_qs.exists():
|
|
promotion_rule_id = promotion_rule_qs[0]['id']
|
|
promotion_rule_id = promotion_rule_qs[0]['id']
|
|
expire = expire * 2
|
|
expire = expire * 2
|
|
- unuse_meal_flag = False # 是否关联未使用套餐
|
|
|
|
with transaction.atomic():
|
|
with transaction.atomic():
|
|
if uid_bucket_qs.exists():
|
|
if uid_bucket_qs.exists():
|
|
uid_bucket = uid_bucket_qs.first()
|
|
uid_bucket = uid_bucket_qs.first()
|
|
@@ -1152,7 +1126,6 @@ class CloudStorageView(View):
|
|
endTime=end_time,
|
|
endTime=end_time,
|
|
bucket_id=bucket_id, updateTime=now_time)
|
|
bucket_id=bucket_id, updateTime=now_time)
|
|
else: # 已过期或者不相同的套餐加入未使用的关联套餐表
|
|
else: # 已过期或者不相同的套餐加入未使用的关联套餐表
|
|
- unuse_meal_flag = True
|
|
|
|
unused_uid_qs = Unused_Uid_Meal.objects.filter(uid=uid, bucket_id=bucket_id)
|
|
unused_uid_qs = Unused_Uid_Meal.objects.filter(uid=uid, bucket_id=bucket_id)
|
|
nums = 2 if order_list[0]['isSelectDiscounts'] == 1 else 1
|
|
nums = 2 if order_list[0]['isSelectDiscounts'] == 1 else 1
|
|
if promotion_rule_qs.exists():
|
|
if promotion_rule_qs.exists():
|
|
@@ -1186,22 +1159,6 @@ class CloudStorageView(View):
|
|
order_qs.update(status=1, updTime=now_time, uid_bucket_id=uid_bucket_id,
|
|
order_qs.update(status=1, updTime=now_time, uid_bucket_id=uid_bucket_id,
|
|
promotion_rule_id=promotion_rule_id)
|
|
promotion_rule_id=promotion_rule_id)
|
|
date_time = time.strftime("%Y-%m-%d", time.localtime())
|
|
date_time = time.strftime("%Y-%m-%d", time.localtime())
|
|
- # 开通AI服务
|
|
|
|
- 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)
|
|
|
|
- else:
|
|
|
|
- ai_service_dict = {
|
|
|
|
- 'uid': uid,
|
|
|
|
- 'channel': channel,
|
|
|
|
- 'detect_status': 1,
|
|
|
|
- 'addTime': now_time,
|
|
|
|
- 'updTime': now_time,
|
|
|
|
- 'use_status': 1,
|
|
|
|
- 'endTime': end_time
|
|
|
|
- }
|
|
|
|
- AiService.objects.create(**ai_service_dict)
|
|
|
|
# 开通云盘服务
|
|
# 开通云盘服务
|
|
# icloud_use_qs = IcloudUseDetails.objects.filter(user_id=userid).values('id')
|
|
# icloud_use_qs = IcloudUseDetails.objects.filter(user_id=userid).values('id')
|
|
# if not icloud_use_qs.exists():
|
|
# if not icloud_use_qs.exists():
|
|
@@ -1294,7 +1251,7 @@ class CloudStorageView(View):
|
|
channel = order_list[0]['channel']
|
|
channel = order_list[0]['channel']
|
|
rank = order_list[0]['rank']
|
|
rank = order_list[0]['rank']
|
|
store_qs = Store_Meal.objects.filter(id=rank).values("day", "bucket_id", "bucket__storeDay", "expire",
|
|
store_qs = Store_Meal.objects.filter(id=rank).values("day", "bucket_id", "bucket__storeDay", "expire",
|
|
- 'is_ai', 'icloud_store_meal_id')
|
|
|
|
|
|
+ 'icloud_store_meal_id')
|
|
if not store_qs.exists():
|
|
if not store_qs.exists():
|
|
return HttpResponse(pay.xml_to_dict({'return_code': 'FAIL', 'return_msg': '套餐不存在'}))
|
|
return HttpResponse(pay.xml_to_dict({'return_code': 'FAIL', 'return_msg': '套餐不存在'}))
|
|
bucket_id = store_qs[0]['bucket_id']
|
|
bucket_id = store_qs[0]['bucket_id']
|
|
@@ -1315,7 +1272,6 @@ class CloudStorageView(View):
|
|
if promotion_rule_qs.exists():
|
|
if promotion_rule_qs.exists():
|
|
promotion_rule_id = promotion_rule_qs[0]['id']
|
|
promotion_rule_id = promotion_rule_qs[0]['id']
|
|
expire = expire * 2
|
|
expire = expire * 2
|
|
- unuse_meal_flag = False # 是否关联未使用套餐
|
|
|
|
with transaction.atomic():
|
|
with transaction.atomic():
|
|
if uid_bucket_qs.exists():
|
|
if uid_bucket_qs.exists():
|
|
uid_bucket = uid_bucket_qs.first()
|
|
uid_bucket = uid_bucket_qs.first()
|
|
@@ -1325,7 +1281,6 @@ class CloudStorageView(View):
|
|
bucket_id=bucket_id,
|
|
bucket_id=bucket_id,
|
|
endTime=end_time, updateTime=now_time)
|
|
endTime=end_time, updateTime=now_time)
|
|
else: # 已过期或者不相同的套餐加入未使用的关联套餐表
|
|
else: # 已过期或者不相同的套餐加入未使用的关联套餐表
|
|
- unuse_meal_flag = True
|
|
|
|
unused_uid_qs = Unused_Uid_Meal.objects.filter(uid=uid, bucket_id=bucket_id)
|
|
unused_uid_qs = Unused_Uid_Meal.objects.filter(uid=uid, bucket_id=bucket_id)
|
|
nums = 2 if order_list[0]['isSelectDiscounts'] == 1 else 1
|
|
nums = 2 if order_list[0]['isSelectDiscounts'] == 1 else 1
|
|
if promotion_rule_qs.exists():
|
|
if promotion_rule_qs.exists():
|
|
@@ -1360,22 +1315,6 @@ class CloudStorageView(View):
|
|
order_qs.update(status=1, updTime=now_time, uid_bucket_id=uid_bucket_id,
|
|
order_qs.update(status=1, updTime=now_time, uid_bucket_id=uid_bucket_id,
|
|
promotion_rule_id=promotion_rule_id)
|
|
promotion_rule_id=promotion_rule_id)
|
|
date_time = time.strftime("%Y-%m-%d", time.localtime())
|
|
date_time = time.strftime("%Y-%m-%d", time.localtime())
|
|
- # 开通AI服务
|
|
|
|
- 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)
|
|
|
|
- else:
|
|
|
|
- ai_service_dict = {
|
|
|
|
- 'uid': uid,
|
|
|
|
- 'channel': channel,
|
|
|
|
- 'detect_status': 1,
|
|
|
|
- 'addTime': now_time,
|
|
|
|
- 'updTime': now_time,
|
|
|
|
- 'use_status': 1,
|
|
|
|
- 'endTime': end_time
|
|
|
|
- }
|
|
|
|
- AiService.objects.create(**ai_service_dict)
|
|
|
|
# 开通云盘服务
|
|
# 开通云盘服务
|
|
# icloud_use_qs = IcloudUseDetails.objects.filter(user_id=userid).values('id')
|
|
# icloud_use_qs = IcloudUseDetails.objects.filter(user_id=userid).values('id')
|
|
# if not icloud_use_qs.exists():
|
|
# if not icloud_use_qs.exists():
|
|
@@ -1462,7 +1401,7 @@ class CloudStorageView(View):
|
|
now_time = int(time.time())
|
|
now_time = int(time.time())
|
|
store_qs = Store_Meal.objects.filter(id=rank, pay_type=pay_type, lang__lang=lang, is_show=0). \
|
|
store_qs = Store_Meal.objects.filter(id=rank, pay_type=pay_type, lang__lang=lang, is_show=0). \
|
|
values('currency', 'price', 'lang__content', 'day', 'commodity_type', 'lang__title', 'expire',
|
|
values('currency', 'price', 'lang__content', 'day', 'commodity_type', 'lang__title', 'expire',
|
|
- 'commodity_code', 'discount_price', 'bucket__mold', 'cycle_config_id', 'is_ai')
|
|
|
|
|
|
+ 'commodity_code', 'discount_price', 'bucket__mold', 'cycle_config_id')
|
|
if not store_qs.exists():
|
|
if not store_qs.exists():
|
|
return response.json(173)
|
|
return response.json(173)
|
|
store_meal_qs = Store_Meal.objects.filter(id=rank, lang__lang='cn', is_show=0).values('lang__title',
|
|
store_meal_qs = Store_Meal.objects.filter(id=rank, lang__lang='cn', is_show=0).values('lang__title',
|
|
@@ -1515,17 +1454,15 @@ class CloudStorageView(View):
|
|
sub_info = Paypal.subscriptions(store_info=store_qs[0], lang=lang, orderID=order_id, price=price)
|
|
sub_info = Paypal.subscriptions(store_info=store_qs[0], lang=lang, orderID=order_id, price=price)
|
|
if not sub_info:
|
|
if not sub_info:
|
|
return response.json(10048)
|
|
return response.json(10048)
|
|
- order_qs = Order_Model.objects.create(orderID=order_id, UID=uid, channel=channel, userID_id=user_id,
|
|
|
|
- desc=content, payType=pay_type, payTime=now_time,
|
|
|
|
- price=price, currency=currency, addTime=now_time,
|
|
|
|
- updTime=now_time,
|
|
|
|
- pay_url=sub_info['url'], isSelectDiscounts=is_select_discount,
|
|
|
|
- commodity_code=commodity_code, commodity_type=commodity_type,
|
|
|
|
- rank_id=rank, plan_id=sub_info['plan_id'], coupon_id=coupon_id,
|
|
|
|
- ai_rank_id=1,
|
|
|
|
- store_meal_name=store_meal_name)
|
|
|
|
- if store_qs[0]['is_ai'] == 1:
|
|
|
|
- order_qs.order_type = 1
|
|
|
|
|
|
+ Order_Model.objects.create(orderID=order_id, UID=uid, channel=channel, userID_id=user_id,
|
|
|
|
+ desc=content, payType=pay_type, payTime=now_time,
|
|
|
|
+ price=price, currency=currency, addTime=now_time,
|
|
|
|
+ updTime=now_time,
|
|
|
|
+ pay_url=sub_info['url'], isSelectDiscounts=is_select_discount,
|
|
|
|
+ commodity_code=commodity_code, commodity_type=commodity_type,
|
|
|
|
+ rank_id=rank, plan_id=sub_info['plan_id'], coupon_id=coupon_id,
|
|
|
|
+ ai_rank_id=1,
|
|
|
|
+ store_meal_name=store_meal_name)
|
|
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 = "{}web/paid2/fail.html".format(SERVER_DOMAIN_SSL)
|
|
call_clc_url = "{}web/paid2/fail.html".format(SERVER_DOMAIN_SSL)
|
|
@@ -1552,17 +1489,15 @@ class CloudStorageView(View):
|
|
for link in payment.links:
|
|
for link in payment.links:
|
|
if link.rel == "approval_url":
|
|
if link.rel == "approval_url":
|
|
approval_url = str(link.href)
|
|
approval_url = str(link.href)
|
|
- order_qs = Order_Model.objects.create(orderID=order_id, UID=uid, channel=channel, userID_id=user_id,
|
|
|
|
- desc=content, payType=pay_type, payTime=now_time,
|
|
|
|
- price=price, currency=currency, addTime=now_time,
|
|
|
|
- updTime=now_time,
|
|
|
|
- pay_url=approval_url, isSelectDiscounts=is_select_discount,
|
|
|
|
- commodity_code=commodity_code, commodity_type=commodity_type,
|
|
|
|
- rank_id=rank, paymentID=payment_id, coupon_id=coupon_id,
|
|
|
|
- ai_rank_id=1,
|
|
|
|
- store_meal_name=store_meal_name)
|
|
|
|
- if store_qs[0]['is_ai'] == 1:
|
|
|
|
- order_qs.order_type = 1
|
|
|
|
|
|
+ Order_Model.objects.create(orderID=order_id, UID=uid, channel=channel, userID_id=user_id,
|
|
|
|
+ desc=content, payType=pay_type, payTime=now_time,
|
|
|
|
+ price=price, currency=currency, addTime=now_time,
|
|
|
|
+ updTime=now_time,
|
|
|
|
+ pay_url=approval_url, isSelectDiscounts=is_select_discount,
|
|
|
|
+ commodity_code=commodity_code, commodity_type=commodity_type,
|
|
|
|
+ rank_id=rank, paymentID=payment_id, coupon_id=coupon_id,
|
|
|
|
+ ai_rank_id=1,
|
|
|
|
+ store_meal_name=store_meal_name)
|
|
return response.json(0, {"redirectUrl": approval_url, "orderID": order_id})
|
|
return response.json(0, {"redirectUrl": approval_url, "orderID": order_id})
|
|
return response.json(10, 'generate_order_false')
|
|
return response.json(10, 'generate_order_false')
|
|
elif pay_type == 2:
|
|
elif pay_type == 2:
|
|
@@ -1586,16 +1521,15 @@ class CloudStorageView(View):
|
|
else:
|
|
else:
|
|
if order_string:
|
|
if order_string:
|
|
redirect_url = ali_pay_obj.alipay_prefix + order_string
|
|
redirect_url = ali_pay_obj.alipay_prefix + order_string
|
|
- order_qs = Order_Model.objects.create(orderID=order_id, UID=uid, channel=channel, userID_id=user_id,
|
|
|
|
- desc=content, payType=pay_type, payTime=now_time,
|
|
|
|
- price=price, currency=currency, addTime=now_time,
|
|
|
|
- updTime=now_time,
|
|
|
|
- pay_url=redirect_url, isSelectDiscounts=is_select_discount,
|
|
|
|
- commodity_code=commodity_code, commodity_type=commodity_type,
|
|
|
|
- rank_id=rank, coupon_id=coupon_id, ai_rank_id=1,
|
|
|
|
- store_meal_name=store_meal_name)
|
|
|
|
- if store_qs[0]['is_ai'] == 1:
|
|
|
|
- order_qs.order_type = 1
|
|
|
|
|
|
+ Order_Model.objects.create(orderID=order_id, UID=uid, channel=channel, userID_id=user_id,
|
|
|
|
+ desc=content, payType=pay_type, payTime=now_time,
|
|
|
|
+ price=price, currency=currency, addTime=now_time,
|
|
|
|
+ updTime=now_time,
|
|
|
|
+ pay_url=redirect_url, isSelectDiscounts=is_select_discount,
|
|
|
|
+ commodity_code=commodity_code, commodity_type=commodity_type,
|
|
|
|
+ rank_id=rank, coupon_id=coupon_id, ai_rank_id=1,
|
|
|
|
+ store_meal_name=store_meal_name)
|
|
|
|
+
|
|
return JsonResponse(status=200, data={'result_code': 0, 'reason': 'success',
|
|
return JsonResponse(status=200, data={'result_code': 0, 'reason': 'success',
|
|
'result': {"redirectUrl": redirect_url, "orderID": order_id},
|
|
'result': {"redirectUrl": redirect_url, "orderID": order_id},
|
|
'error_code': 0})
|
|
'error_code': 0})
|
|
@@ -1616,15 +1550,13 @@ class CloudStorageView(View):
|
|
if not response:
|
|
if not response:
|
|
return response.json(10, '生成订单错误.')
|
|
return response.json(10, '生成订单错误.')
|
|
# 回调函数
|
|
# 回调函数
|
|
- order_qs = Order_Model.objects.create(orderID=order_id, UID=uid, channel=channel, userID_id=user_id,
|
|
|
|
- desc=content, payType=pay_type, payTime=now_time,
|
|
|
|
- price=price, currency=currency, addTime=now_time, updTime=now_time,
|
|
|
|
- pay_url=notify_url, isSelectDiscounts=is_select_discount,
|
|
|
|
- commodity_code=commodity_code, commodity_type=commodity_type,
|
|
|
|
- rank_id=rank,
|
|
|
|
- ai_rank_id=1, store_meal_name=store_meal_name)
|
|
|
|
- if store_qs[0]['is_ai'] == 1:
|
|
|
|
- order_qs.order_type = 1
|
|
|
|
|
|
+ Order_Model.objects.create(orderID=order_id, UID=uid, channel=channel, userID_id=user_id,
|
|
|
|
+ desc=content, payType=pay_type, payTime=now_time,
|
|
|
|
+ price=price, currency=currency, addTime=now_time, updTime=now_time,
|
|
|
|
+ pay_url=notify_url, isSelectDiscounts=is_select_discount,
|
|
|
|
+ commodity_code=commodity_code, commodity_type=commodity_type,
|
|
|
|
+ rank_id=rank,
|
|
|
|
+ ai_rank_id=1, store_meal_name=store_meal_name)
|
|
return JsonResponse(status=200, data={'result_code': 0, 'reason': 'success',
|
|
return JsonResponse(status=200, data={'result_code': 0, 'reason': 'success',
|
|
'result': response,
|
|
'result': response,
|
|
'orderId': order_id,
|
|
'orderId': order_id,
|
|
@@ -1697,8 +1629,7 @@ class CloudStorageView(View):
|
|
return response.json(10064)
|
|
return response.json(10064)
|
|
order_id = CommonService.createOrderID()
|
|
order_id = CommonService.createOrderID()
|
|
now_time = int(time.time())
|
|
now_time = int(time.time())
|
|
- order_type = 0
|
|
|
|
- store_qs = Store_Meal.objects.filter(id=rank, lang__lang=lang, is_show=0).values("day", "bucket_id", 'is_ai',
|
|
|
|
|
|
+ store_qs = Store_Meal.objects.filter(id=rank, lang__lang=lang, is_show=0).values("day", "bucket_id",
|
|
"bucket__storeDay", "expire",
|
|
"bucket__storeDay", "expire",
|
|
'lang__content', 'price',
|
|
'lang__content', 'price',
|
|
'currency', 'commodity_type',
|
|
'currency', 'commodity_type',
|
|
@@ -1709,7 +1640,6 @@ class CloudStorageView(View):
|
|
uid_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")
|
|
"bucket__region", "endTime", "use_status")
|
|
expire = store_qs[0]['expire']
|
|
expire = store_qs[0]['expire']
|
|
- unuse_meal_flag = False # 是否关联未使用套餐
|
|
|
|
# icloud_store_meal_id = store_qs[0]['icloud_store_meal_id']
|
|
# icloud_store_meal_id = store_qs[0]['icloud_store_meal_id']
|
|
# icloud_meal_qs = ICloudStoreMeal.objects.filter(id=icloud_store_meal_id).values('size')
|
|
# icloud_meal_qs = ICloudStoreMeal.objects.filter(id=icloud_store_meal_id).values('size')
|
|
# if not icloud_meal_qs.exists():
|
|
# if not icloud_meal_qs.exists():
|
|
@@ -1725,7 +1655,6 @@ class CloudStorageView(View):
|
|
bucket_id=bucket_id,
|
|
bucket_id=bucket_id,
|
|
endTime=end_time, updateTime=now_time)
|
|
endTime=end_time, updateTime=now_time)
|
|
else: # 已过期或者不相同的套餐加入未使用的关联套餐表
|
|
else: # 已过期或者不相同的套餐加入未使用的关联套餐表
|
|
- unuse_meal_flag = True
|
|
|
|
unused_uid_qs = Unused_Uid_Meal.objects.filter(uid=uid, bucket_id=bucket_id)
|
|
unused_uid_qs = Unused_Uid_Meal.objects.filter(uid=uid, bucket_id=bucket_id)
|
|
nums = 1
|
|
nums = 1
|
|
if unused_uid_qs.exists():
|
|
if unused_uid_qs.exists():
|
|
@@ -1741,15 +1670,6 @@ class CloudStorageView(View):
|
|
endTime=end_time, addTime=now_time, updateTime=now_time,
|
|
endTime=end_time, addTime=now_time, updateTime=now_time,
|
|
use_status=1)
|
|
use_status=1)
|
|
uid_bucket_id = uid_bucket.id
|
|
uid_bucket_id = uid_bucket.id
|
|
- # 开通AI体验
|
|
|
|
- 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():
|
|
|
|
- ai_service_qs.update(endTime=end_time, use_status=1, updTime=now_time)
|
|
|
|
- else:
|
|
|
|
- AiService.objects.create(uid=uid, channel=channel, detect_status=1, endTime=end_time,
|
|
|
|
- addTime=now_time, updTime=now_time, use_status=1)
|
|
|
|
# 开通云盘体验
|
|
# 开通云盘体验
|
|
# icloud_use_qs = IcloudUseDetails.objects.filter(user_id=user_id).values('id')
|
|
# icloud_use_qs = IcloudUseDetails.objects.filter(user_id=user_id).values('id')
|
|
# if not icloud_use_qs.exists():
|
|
# if not icloud_use_qs.exists():
|
|
@@ -1774,7 +1694,7 @@ class CloudStorageView(View):
|
|
Order_Model.objects.create(orderID=order_id, UID=uid, channel=channel, userID_id=user_id,
|
|
Order_Model.objects.create(orderID=order_id, UID=uid, channel=channel, userID_id=user_id,
|
|
desc=store_qs[0]['lang__content'], payType=pay_type, payTime=now_time,
|
|
desc=store_qs[0]['lang__content'], payType=pay_type, payTime=now_time,
|
|
price=store_qs[0]['price'], currency=store_qs[0]['currency'],
|
|
price=store_qs[0]['price'], currency=store_qs[0]['currency'],
|
|
- addTime=now_time, order_type=order_type,
|
|
|
|
|
|
+ addTime=now_time,
|
|
updTime=now_time,
|
|
updTime=now_time,
|
|
pay_url="体验版", store_meal_name=store_meal_name,
|
|
pay_url="体验版", store_meal_name=store_meal_name,
|
|
commodity_code=commodity_code, commodity_type=store_qs[0]['commodity_type'],
|
|
commodity_code=commodity_code, commodity_type=store_qs[0]['commodity_type'],
|
|
@@ -1857,7 +1777,6 @@ class CloudStorageView(View):
|
|
experience_context_qs.delete()
|
|
experience_context_qs.delete()
|
|
Order_Model.objects.filter(uid_bucket_id=bucket_id).delete()
|
|
Order_Model.objects.filter(uid_bucket_id=bucket_id).delete()
|
|
uid_bucket_qs.delete()
|
|
uid_bucket_qs.delete()
|
|
- AiService.objects.filter(uid=uid_bucket_qs[0].uid).delete()
|
|
|
|
else:
|
|
else:
|
|
return response.json(10007)
|
|
return response.json(10007)
|
|
else:
|
|
else:
|
|
@@ -2018,9 +1937,6 @@ class CloudStorageView(View):
|
|
Unused_Uid_Meal.objects.filter(id=unused_id).delete()
|
|
Unused_Uid_Meal.objects.filter(id=unused_id).delete()
|
|
StsCrdModel.objects.filter(uid=uid).delete() # 删除sts记录
|
|
StsCrdModel.objects.filter(uid=uid).delete() # 删除sts记录
|
|
# VodHlsModel.objects.filter(uid=uid).delete() # 删除播放列表,后期数据量多时应该考虑延后删除
|
|
# VodHlsModel.objects.filter(uid=uid).delete() # 删除播放列表,后期数据量多时应该考虑延后删除
|
|
- AiService.objects.filter(uid=uid, channel=unused_uid_bucket['channel']).update(endTime=end_time,
|
|
|
|
- updTime=now_time,
|
|
|
|
- use_status=1)
|
|
|
|
return response.json(0)
|
|
return response.json(0)
|
|
except Exception:
|
|
except Exception:
|
|
return response.json(474)
|
|
return response.json(474)
|