Explorar o código

优化获取默认壁纸接口

zhangdongming hai 1 ano
pai
achega
63e5d2aae9
Modificáronse 1 ficheiros con 4 adicións e 5 borrados
  1. 4 5
      Controller/UserDevice/UserDeviceShareController.py

+ 4 - 5
Controller/UserDevice/UserDeviceShareController.py

@@ -45,9 +45,7 @@ class UserDeviceShareView(View):
         token = TokenObject(request.META.get('HTTP_AUTHORIZATION'))
         lang = request_dict.get('lang', token.lang)
         response = ResponseObject(lang)
-        LOGGER.info(f"test:{token.token}")
         if token.code != 0:
-            LOGGER.info(f"token.code:{token.code}")
             return response.json(token.code)
         if operation == 'user-permissions':
             return self.get_user_share_permission(request_dict, response)
@@ -225,7 +223,7 @@ class UserDeviceShareView(View):
             device_type = int(request_dict.get('deviceType', None))
             uid = request_dict.get('uid', None)
             channel = int(request_dict.get('channel', 1))
-            LOGGER.info('request_dict:{}'.format(request_dict))
+            LOGGER.info('获取设备壁纸列表参数:{}'.format(request_dict))
             if not all([device_type, uid]):
                 return response.json(444)
 
@@ -234,12 +232,13 @@ class UserDeviceShareView(View):
                                                                device_type=device_type, parent_id=0, status=1)
 
             # 查询系统默认壁纸
-            def_wallpaper_qs = DeviceWallpaper.objects.filter(classification=1, device_type=device_type, status=1)
+            def_wallpaper_qs = DeviceWallpaper.objects.filter(classification=1, device_type=device_type, uid='',
+                                                              status=1)
 
             # 查询用户选中的壁纸
             user_checked_qs = DeviceWallpaper.objects.filter(channel=channel, uid=uid,
                                                              device_type=device_type, parent_id__gt=0, status=1)
-            checked_id = user_checked_qs[0].parent_id if user_checked_qs.exists() else def_wallpaper_qs.first().id
+            checked_id = user_checked_qs[0].parent_id if user_checked_qs.exists() else 0
 
             wallpaper_list = []
             if def_wallpaper_qs.exists() or user_wallpaper_qs.exists():