|
@@ -9,9 +9,10 @@
|
|
import logging
|
|
import logging
|
|
import time
|
|
import time
|
|
|
|
|
|
|
|
+from django.db.models import F
|
|
from django.views.generic.base import View
|
|
from django.views.generic.base import View
|
|
|
|
|
|
-from Model.models import DeviceAlgorithmExplain, DeviceAlgorithmBanner, DeviceUidAlgorithmType
|
|
|
|
|
|
+from Model.models import DeviceAlgorithmExplain, DeviceAlgorithmBanner, DeviceUidAlgorithmType, DeviceTypeAlgorithmInfo
|
|
from Object.ResponseObject import ResponseObject
|
|
from Object.ResponseObject import ResponseObject
|
|
from Object.TokenObject import TokenObject
|
|
from Object.TokenObject import TokenObject
|
|
|
|
|
|
@@ -135,6 +136,13 @@ class AlgorithmShopView(View):
|
|
'riskWarning': item['risk_warning'],
|
|
'riskWarning': item['risk_warning'],
|
|
'basicFunction': item['algorithm_type__basic_function'],
|
|
'basicFunction': item['algorithm_type__basic_function'],
|
|
}
|
|
}
|
|
|
|
+ dt_info_qs = DeviceTypeAlgorithmInfo.objects.filter(algorithm_type=algorithm_dict['type']) \
|
|
|
|
+ .annotate(deviceName=F('device_name'), deviceType=F('device_type'),
|
|
|
|
+ algorithmType=F('algorithm_type'),
|
|
|
|
+ typeIcon=F('type_icon'),
|
|
|
|
+ deviceLink=F('device_link'), ) \
|
|
|
|
+ .values('deviceName', 'deviceType', 'typeIcon', 'deviceLink')
|
|
|
|
+ algorithm_dict['recommendDevices'] = list(dt_info_qs)
|
|
if uid:
|
|
if uid:
|
|
setting = cls.get_uid_algorithm_info(item['algorithm_type__id'], uid)
|
|
setting = cls.get_uid_algorithm_info(item['algorithm_type__id'], uid)
|
|
algorithm_dict['setting'] = setting if setting else {'status': 0, 'function': {}}
|
|
algorithm_dict['setting'] = setting if setting else {'status': 0, 'function': {}}
|