Преглед на файлове

修复头像审核问题

locky преди 2 години
родител
ревизия
735e02523f
променени са 2 файла, в които са добавени 4 реда и са изтрити 2 реда
  1. 2 2
      Controller/UserManger.py
  2. 2 0
      Object/ResponseObject.py

+ 2 - 2
Controller/UserManger.py

@@ -174,13 +174,13 @@ class perfectUserInfoView(TemplateView):
             #  测试/国内服,验证头像是否合规
             if CONFIG_INFO == CONFIG_CN or CONFIG_INFO == CONFIG_TEST:
                 params = {'Bucket': AVATAR_BUCKET, 'Key': Key}
-                image_url = aws_s3_client.get_object(Bucket=AVATAR_BUCKET, Key=Key)
+                image_url = aws_s3_client.generate_presigned_url('get_object', Params=params)
                 service = 'profilePhotoCheck'
                 service_dict = {'imageUrl': image_url}
                 service_parameters = json.dumps(service_dict)
                 legal = ContentSecurity().image_review(service, service_parameters)
                 if not legal:
-                    return response.json(108)
+                    return response.json(106)
 
             aws_s3_client.put_object(Bucket=AVATAR_BUCKET, Key=Key, Body=userIcon)
             userIconPath = userID + '/' + userIcon.name

+ 2 - 0
Object/ResponseObject.py

@@ -33,6 +33,7 @@ class ResponseObject(object):
             103: 'Mail already existed!',
             104: 'Account doesn\'t exist!',
             105: 'Email format error!',
+            106: 'Illegal profile picture!',
             107: 'The username not conform to the rules!',
             108: 'Illegal nickname!',
             109: 'The password not conform to the rules!',
@@ -153,6 +154,7 @@ class ResponseObject(object):
             103: '邮箱已存在!',
             104: '账户不存在!',
             105: '邮箱格式错误!',
+            106: '头像违规!',
             107: '用户名格式不符合!',
             108: '用户昵称违规!',
             109: '密码格式不符合!',