|
@@ -312,13 +312,17 @@ class serveManagement(View):
|
|
|
isSelect = request_dict.get('isSelect', None)
|
|
|
if isSelect:
|
|
|
# 获取套餐ID作为选项
|
|
|
- store_meal_qs = Store_Meal.objects.all().values('id', 'bucket__bucket')
|
|
|
+ store_meal_qs = Store_Meal.objects.all().values('id', 'bucket__bucket').order_by('-add_time')
|
|
|
return response.json(
|
|
|
0, {'list': CommonService.qs_to_list(store_meal_qs)})
|
|
|
|
|
|
bucket = request_dict.get('bucket', None)
|
|
|
pageNo = request_dict.get('pageNo', None)
|
|
|
pageSize = request_dict.get('pageSize', None)
|
|
|
+ subscription_group = request_dict.get('subscription_group', None)
|
|
|
+ subscription_group_id = request_dict.get('subscription_group_id', None)
|
|
|
+ package_type = request_dict.get('package_type', None)
|
|
|
+ is_show = request_dict.get('is_show', None)
|
|
|
|
|
|
if not all([pageNo, pageSize]):
|
|
|
return response.json(444)
|
|
@@ -326,14 +330,41 @@ class serveManagement(View):
|
|
|
page = int(pageNo)
|
|
|
line = int(pageSize)
|
|
|
try:
|
|
|
- if bucket: # 条件查询
|
|
|
- bucket_id = VodBucketModel.objects.filter(
|
|
|
- bucket=bucket).values('id')[0]['id']
|
|
|
- store_meal_qs = Store_Meal.objects.filter(
|
|
|
- bucket_id=bucket_id)
|
|
|
- else: # 查询全部
|
|
|
- store_meal_qs = Store_Meal.objects.filter()
|
|
|
- store_meal_val = store_meal_qs.values(
|
|
|
+ store_meal_qs = Store_Meal.objects.select_related(
|
|
|
+ 'bucket'
|
|
|
+ ).prefetch_related(
|
|
|
+ 'inapppurchasepackage',
|
|
|
+ 'pay_type'
|
|
|
+ ).order_by('-add_time')
|
|
|
+
|
|
|
+ if bucket:
|
|
|
+ bucket_qs = VodBucketModel.objects.filter(bucket__contains=bucket).first()
|
|
|
+ if not bucket_qs:
|
|
|
+ return response.json(0, {'list': [], 'total': 0})
|
|
|
+ bucket_id = bucket_qs.id
|
|
|
+ store_meal_qs = Store_Meal.objects.filter(bucket_id=bucket_id).order_by('-add_time')
|
|
|
+
|
|
|
+ if is_show is not None and is_show != '':
|
|
|
+ store_meal_qs = store_meal_qs.filter(is_show=int(is_show))
|
|
|
+
|
|
|
+ if package_type is not None and package_type != '':
|
|
|
+ store_meal_qs = store_meal_qs.filter(
|
|
|
+ inapppurchasepackage__package_type=int(package_type)
|
|
|
+ ).distinct()
|
|
|
+
|
|
|
+ if subscription_group and subscription_group.strip():
|
|
|
+ store_meal_qs = store_meal_qs.filter(
|
|
|
+ inapppurchasepackage__subscription_group__contains=subscription_group.strip()
|
|
|
+ ).distinct()
|
|
|
+
|
|
|
+ if subscription_group_id and subscription_group_id.strip():
|
|
|
+ store_meal_qs = store_meal_qs.filter(
|
|
|
+ inapppurchasepackage__subscription_group_id__contains=subscription_group_id.strip()
|
|
|
+ ).distinct()
|
|
|
+
|
|
|
+ total = store_meal_qs.count()
|
|
|
+ paginated_qs = store_meal_qs[(page - 1) * line:page * line]
|
|
|
+ store_meal_val = paginated_qs.values(
|
|
|
'id',
|
|
|
'bucket__bucket',
|
|
|
'day',
|
|
@@ -350,11 +381,10 @@ class serveManagement(View):
|
|
|
'is_ai',
|
|
|
'pixel_level',
|
|
|
'add_time',
|
|
|
- 'update_time')
|
|
|
- total = len(store_meal_val)
|
|
|
- store_meals = store_meal_val[(page - 1) * line:page * line]
|
|
|
+ 'update_time',
|
|
|
+ 'is_4g')
|
|
|
store_meal_list = []
|
|
|
- for store_meal in store_meals:
|
|
|
+ for store_meal in store_meal_val:
|
|
|
store_meal_id = store_meal['id']
|
|
|
# 获取支付方式列表
|
|
|
pay_type_list = [
|
|
@@ -396,6 +426,7 @@ class serveManagement(View):
|
|
|
'subscription_group': subscription_group,
|
|
|
'subscription_group_id': subscription_group_id,
|
|
|
'package_type': package_type,
|
|
|
+ 'is_4g':store_meal['is_4g'],
|
|
|
'addTime': store_meal['add_time'].strftime("%Y-%m-%d %H:%M:%S"),
|
|
|
'updTime': store_meal['update_time'].strftime("%Y-%m-%d %H:%M:%S"),
|
|
|
})
|
|
@@ -432,6 +463,7 @@ class serveManagement(View):
|
|
|
subscription_group_id = request_dict.get('subscription_group_id', '')
|
|
|
package_type = int(request_dict.get('package_type', 0))
|
|
|
isEdit = request_dict.get('isEdit', None)
|
|
|
+ is_4g = int(request_dict.get('is_4g', 0))
|
|
|
|
|
|
if not all([bucket, pay_type, price, currency, symbol]):
|
|
|
return response.json(444)
|
|
@@ -454,7 +486,8 @@ class serveManagement(View):
|
|
|
'symbol': symbol,
|
|
|
'is_show': is_show,
|
|
|
'is_ai': is_ai,
|
|
|
- 'pixel_level': pixel_level
|
|
|
+ 'pixel_level': pixel_level,
|
|
|
+ 'is_4g': is_4g
|
|
|
}
|
|
|
if isEdit:
|
|
|
if not storeMealID:
|