|
@@ -10,7 +10,8 @@ from django.utils.decorators import method_decorator
|
|
|
from django.views.decorators.csrf import csrf_exempt
|
|
|
from django.views.generic import TemplateView, View
|
|
|
|
|
|
-from Ansjer.config import BASE_DIR, ACCESS_KEY_ID, SECRET_ACCESS_KEY, REGION_NAME, AVATAR_BUCKET
|
|
|
+from Ansjer.config import BASE_DIR, ACCESS_KEY_ID, SECRET_ACCESS_KEY, REGION_NAME, AVATAR_BUCKET, CONFIG_INFO, \
|
|
|
+ CONFIG_CN, CONFIG_TEST
|
|
|
from Ansjer.config import SERVER_DOMAIN
|
|
|
from Model.models import Role, Device_User, UserOauth2Model, UserExModel, CountryLanguageModel, LanguageModel, App_Info, \
|
|
|
IcloudUseDetails
|
|
@@ -170,15 +171,16 @@ class perfectUserInfoView(TemplateView):
|
|
|
)
|
|
|
Key = userID + '/' + userIcon.name
|
|
|
|
|
|
- # 验证头像是否合规
|
|
|
- params = {'Bucket': AVATAR_BUCKET, 'Key': Key}
|
|
|
- image_url = aws_s3_client.get_object(Bucket=AVATAR_BUCKET, Key=Key)
|
|
|
- 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)
|
|
|
+ # 测试/国内服,验证头像是否合规
|
|
|
+ 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)
|
|
|
+ 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)
|
|
|
|
|
|
aws_s3_client.put_object(Bucket=AVATAR_BUCKET, Key=Key, Body=userIcon)
|
|
|
userIconPath = userID + '/' + userIcon.name
|
|
@@ -219,15 +221,16 @@ class perfectUserInfoView(TemplateView):
|
|
|
except Exception as e:
|
|
|
return response.json(444, repr(e))
|
|
|
|
|
|
- # 验证昵称是否合规
|
|
|
- nickname = UserData.get('NickName')
|
|
|
- if nickname:
|
|
|
- service = 'nickname_detection'
|
|
|
- service_dict = {'content': nickname}
|
|
|
- service_parameters = json.dumps(service_dict)
|
|
|
- legal = ContentSecurity().text_review(service, service_parameters)
|
|
|
- if not legal:
|
|
|
- return response.json(108)
|
|
|
+ # 测试/国内服,验证昵称是否合规
|
|
|
+ if CONFIG_INFO == CONFIG_CN or CONFIG_INFO == CONFIG_TEST:
|
|
|
+ nickname = UserData.get('NickName')
|
|
|
+ if nickname:
|
|
|
+ service = 'nickname_detection'
|
|
|
+ service_dict = {'content': nickname}
|
|
|
+ service_parameters = json.dumps(service_dict)
|
|
|
+ legal = ContentSecurity().text_review(service, service_parameters)
|
|
|
+ if not legal:
|
|
|
+ return response.json(108)
|
|
|
|
|
|
try:
|
|
|
if userIconPath and userContent:
|