Bläddra i källkod

修改设备类型接口响应

locky 1 år sedan
förälder
incheckning
bdd35867f0
1 ändrade filer med 15 tillägg och 14 borttagningar
  1. 15 14
      AdminController/UserManageController.py

+ 15 - 14
AdminController/UserManageController.py

@@ -917,6 +917,7 @@ class UserManagement(View):
                 customized_push_list.append({
                     'customized_push_id': customized_push['id'],
                     'title': customized_push['title'],
+                    'msg': customized_push['msg'],
                     'link': customized_push['link'],
                     'icon_link': customized_push['icon_link'],
                     'country': customized_push['country'],
@@ -968,18 +969,18 @@ class UserManagement(View):
                 icon_link = 'https://ansjerfilemanager.s3.amazonaws.com/customized-push/' + icon_name
                 customized_push_data['icon_link'] = icon_link
 
-            if icon_link:
-                # 上传没有上传过的图片到S3
-                customized_push_qs = CustomizedPush.objects.filter(icon_link=icon_link)
-                if not customized_push_qs.exists():
-                    bucket = 'ansjerfilemanager'
-                    file_key = 'customized-push/' + icon_name
-                    s3 = AmazonS3Util(AWS_ACCESS_KEY_ID[1], AWS_SECRET_ACCESS_KEY[1], AWS_SES_ACCESS_REGION)
-                    s3.upload_file_obj(
-                        bucket,
-                        file_key,
-                        icon,
-                        {'ContentType': icon.content_type, 'ACL': 'public-read'})
+                if icon_link:
+                    # 上传没有上传过的图片到S3
+                    customized_push_qs = CustomizedPush.objects.filter(icon_link=icon_link)
+                    if not customized_push_qs.exists():
+                        bucket = 'ansjerfilemanager'
+                        file_key = 'customized-push/' + icon_name
+                        s3 = AmazonS3Util(AWS_ACCESS_KEY_ID[1], AWS_SECRET_ACCESS_KEY[1], AWS_SES_ACCESS_REGION)
+                        s3.upload_file_obj(
+                            bucket,
+                            file_key,
+                            icon,
+                            {'ContentType': icon.content_type, 'ACL': 'public-read'})
 
             if is_edit:     # 编辑
                 customized_push_id = request_dict.get('customizedPushId', None)
@@ -1009,13 +1010,13 @@ class UserManagement(View):
     @staticmethod
     def getDeviceTypeList(response):
         try:
-            device_type_qs = DeviceTypeModel.objects.filter().values('type')
+            device_type_qs = DeviceTypeModel.objects.filter().values('name')
             if not device_type_qs.exists():
                 return response.json(173)
 
             device_type_list = []
             for device_type in device_type_qs:
-                device_type_list.append(device_type['type'])
+                device_type_list.append(device_type['name'])
             return response.json(0, {'list': device_type_list})
         except Exception as e:
             return response.json(500, 'error_line:{}, error_msg:{}'.format(e.__traceback__.tb_lineno, repr(e)))