|
@@ -77,20 +77,20 @@ class AgentCustomerView(View):
|
|
|
@return:
|
|
|
"""
|
|
|
try:
|
|
|
- # 云存储套餐名称查询,只包括is_show=1的记录
|
|
|
- store_meal_names = Store_Meal.objects.filter(is_show=1).values_list('bucket__bucket', flat=True).distinct()
|
|
|
+ # 云存储套餐查询,只包括is_show=1的记录
|
|
|
+ store_meals = Store_Meal.objects.filter(is_show=1).values('id', 'bucket__bucket').distinct()
|
|
|
+
|
|
|
+ # 联通套餐查询,只包括is_show=1且未被删除的记录
|
|
|
+ unicom_combos = UnicomCombo.objects.filter(is_show=1, is_del=False).values('id', 'combo_name').distinct()
|
|
|
|
|
|
- # 联通套餐名称查询,只包括is_show=1且未被删除的记录
|
|
|
- unicom_combo_names = UnicomCombo.objects.filter(is_show=1, is_del=False).values_list('combo_name',
|
|
|
- flat=True).distinct()
|
|
|
# 将查询结果转换为列表
|
|
|
- store_meal_name_list = list(store_meal_names)
|
|
|
- unicom_combo_name_list = list(unicom_combo_names)
|
|
|
+ store_meal_list = [{'id': meal['id'], 'name': meal['bucket__bucket']} for meal in store_meals]
|
|
|
+ unicom_combo_list = [{'id': combo['id'], 'name': combo['combo_name']} for combo in unicom_combos]
|
|
|
|
|
|
# 合并结果并返回
|
|
|
return response.json(0, {
|
|
|
- 'storeMealNames': store_meal_name_list,
|
|
|
- 'unicomComboNames': unicom_combo_name_list,
|
|
|
+ 'storeMeals': store_meal_list,
|
|
|
+ 'unicomCombos': unicom_combo_list,
|
|
|
})
|
|
|
except Exception as e:
|
|
|
print(e)
|