|
@@ -315,6 +315,9 @@ class AlgorithmShopView(View):
|
|
|
uid = request_dict.get('uid', None)
|
|
|
version = request_dict.get('version', 'v1')
|
|
|
algorithm_qs = DeviceAlgorithmExplain.objects.filter(lang=lang)
|
|
|
+ device_ver = request_dict.get('deviceVer', None)
|
|
|
+ device_code = request_dict.get('deviceCode', None)
|
|
|
+ LOGGER.info(f'AlgorithmShopView.algorithm_list ver:{device_ver},code:{device_code}')
|
|
|
types = [0, 1, 3, 4, 5]
|
|
|
if version == 'v1':
|
|
|
algorithm_qs = algorithm_qs.filter(algorithm_type__type__in=types)
|
|
@@ -322,8 +325,11 @@ class AlgorithmShopView(View):
|
|
|
.values('algorithm_type__id', 'algorithm_type__type',
|
|
|
'algorithm_type__icon_url',
|
|
|
'title', 'subtitle', 'algorithm_type__image_url',
|
|
|
- 'algorithm_type__basic_function', 'concerning')
|
|
|
+ 'algorithm_type__basic_function', 'concerning',
|
|
|
+ 'algorithm_type__resource')
|
|
|
algorithm_list = []
|
|
|
+ device_code = device_code[0:4] if device_code else device_code
|
|
|
+
|
|
|
if not algorithm_qs.exists():
|
|
|
return response.json(0, algorithm_list)
|
|
|
for item in algorithm_qs:
|
|
@@ -331,6 +337,8 @@ class AlgorithmShopView(View):
|
|
|
if uid:
|
|
|
setting = cls.get_uid_algorithm_info(item['algorithm_type__id'], uid)
|
|
|
setting = setting if setting else {'status': 0, 'function': {}}
|
|
|
+ resource = item['algorithm_type__resource']
|
|
|
+ resource = resource.get(device_code, '') if resource else ''
|
|
|
algorithm_list.append({
|
|
|
'typeId': item['algorithm_type__id'],
|
|
|
'type': item['algorithm_type__type'],
|
|
@@ -340,7 +348,8 @@ class AlgorithmShopView(View):
|
|
|
'subtitle': item['subtitle'],
|
|
|
'setting': setting,
|
|
|
'basicFunction': item['algorithm_type__basic_function'],
|
|
|
- 'concerning': item['concerning']
|
|
|
+ 'concerning': item['concerning'],
|
|
|
+ 'resource': resource
|
|
|
})
|
|
|
return response.json(0, algorithm_list)
|
|
|
except Exception as e:
|