Przeglądaj źródła

获取算法小店列表接口增加版本号

zhangdongming 2 lat temu
rodzic
commit
8aa9e48c14

+ 6 - 1
Controller/AlgorithmShop/AlgorithmShopController.py

@@ -234,7 +234,12 @@ class AlgorithmShopView(View):
         try:
             lang = request_dict.get('lang', 'en')
             uid = request_dict.get('uid', None)
-            algorithm_qs = DeviceAlgorithmExplain.objects.filter(lang=lang).order_by('algorithm_type__sort') \
+            version = request_dict.get('version', 'v1')
+            algorithm_qs = DeviceAlgorithmExplain.objects.filter(lang=lang)
+            types = [0, 1, 3, 4, 5]
+            if version == 'v1':
+                algorithm_qs = algorithm_qs.filter(algorithm_type__type__in=types)
+            algorithm_qs = algorithm_qs.order_by('algorithm_type__sort') \
                 .values('algorithm_type__id', 'algorithm_type__type',
                         'algorithm_type__icon_url',
                         'title', 'subtitle', 'algorithm_type__image_url',