|
@@ -81,7 +81,7 @@ class AiView(View):
|
|
|
elif operation == 'getAiStatus': # 获取AI开关状态
|
|
|
return self.getAiStatus(userID, request_dict, response)
|
|
|
elif operation == 'commoditylist': # 获取AI套餐列表
|
|
|
- return self.do_commodity_list(userID, request_dict, response)
|
|
|
+ return self.do_commodity_list(request_dict, response)
|
|
|
elif operation == 'queryInfo': # 查询消息列表
|
|
|
return self.queryInfo(userID, request_dict, response)
|
|
|
elif operation == 'readInfo': # 消息已读
|
|
@@ -250,7 +250,9 @@ class AiView(View):
|
|
|
except Exception as e:
|
|
|
return response.json(500, repr(e))
|
|
|
|
|
|
- def do_commodity_list(self, userID, request_dict, response):
|
|
|
+ # 获取AI套餐列表
|
|
|
+ @staticmethod
|
|
|
+ def do_commodity_list(request_dict, response):
|
|
|
uid = request_dict.get('uid', None)
|
|
|
lang = request_dict.get('lang', 'en')
|
|
|
|
|
@@ -260,8 +262,15 @@ class AiView(View):
|
|
|
if device_info_qs.exists():
|
|
|
return response.json(0)
|
|
|
|
|
|
+ # 没免费体验过的设备只返回体验套餐数据,体验过的不再返回
|
|
|
+ exc_ai_qs = ExperienceAiModel.objects.filter(uid=uid, experience_type=0)
|
|
|
+ if exc_ai_qs.exists():
|
|
|
+ ai_meal_qs = AiStoreMeal.objects.filter(~Q(pay_type=10))
|
|
|
+ else:
|
|
|
+ ai_meal_qs = AiStoreMeal.objects.filter(pay_type=10)
|
|
|
+
|
|
|
# 查询套餐数据
|
|
|
- ai_meal_qs = AiStoreMeal.objects.filter(is_show=1, lang__lang=lang). \
|
|
|
+ ai_meal_qs = ai_meal_qs.filter(is_show=1, lang__lang=lang). \
|
|
|
annotate(ai_meal_id=F('id'), title=F('lang__title'), content=F('lang__content')). \
|
|
|
values("ai_meal_id", "title", "content", "price", "effective_day", "currency", "virtual_price",
|
|
|
"symbol")
|