From 04fe7a2965856aa39eb740f77f9f193a533ec3b9 Mon Sep 17 00:00:00 2001 From: youngS Date: Fri, 28 May 2021 18:18:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=AE=A1=E7=90=86=E5=91=98?= =?UTF-8?q?=E8=BF=81=E7=A7=BB=E5=A4=B1=E8=B4=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fir_ser/api/utils/storage/storage.py | 2 +- fir_ser/api/utils/utils.py | 6 +++-- fir_ser/api/views/login.py | 33 ---------------------------- fir_ser/api/views/receiveudids.py | 2 +- 4 files changed, 6 insertions(+), 37 deletions(-) diff --git a/fir_ser/api/utils/storage/storage.py b/fir_ser/api/utils/storage/storage.py index 7e3d774..a7bf602 100644 --- a/fir_ser/api/utils/storage/storage.py +++ b/fir_ser/api/utils/storage/storage.py @@ -113,7 +113,7 @@ class Storage(object): def get_default_storage(self, user, storage_obj, use_default_storage): admin_obj = UserInfo.objects.filter(is_superuser=True).order_by('pk').first() - if admin_obj and admin_obj.storage: + if admin_obj and admin_obj.storage and admin_obj.pk != user.pk: logger.info("user %s has not storage obj, from admin " "get default storage" % user) return self.get_storage(admin_obj, storage_obj, use_default_storage) diff --git a/fir_ser/api/utils/utils.py b/fir_ser/api/utils/utils.py index f392707..a495f0f 100644 --- a/fir_ser/api/utils/utils.py +++ b/fir_ser/api/utils/utils.py @@ -172,8 +172,10 @@ def delete_app_screenshots_files(storage_obj, app_obj): screenshot_obj.delete() -def change_storage_and_change_head_img(user_obj, new_storage_obj): - migrating_storage_file_data(user_obj, user_obj.head_img, new_storage_obj) +def change_storage_and_change_head_img(user_obj, new_storage_obj, clean_old_data=True): + if user_obj.head_img == 'head_img.jpeg': + clean_old_data = False + migrating_storage_file_data(user_obj, user_obj.head_img, new_storage_obj, clean_old_data) def download_files_form_oss(storage_obj, org_file): diff --git a/fir_ser/api/views/login.py b/fir_ser/api/views/login.py index a77a905..50deba3 100644 --- a/fir_ser/api/views/login.py +++ b/fir_ser/api/views/login.py @@ -430,39 +430,6 @@ class UserInfoView(APIView): res.code = 1004 res.msg = "老密码校验失败" else: - # # 修改个人资料 - # domain_name = data.get("domain_name", None) - # if domain_name: - # domain_name_list = domain_name.strip(' ').replace("http://", "").replace("https://", "").split("/") - # if len(domain_name_list) > 0: - # domain_name = domain_name_list[0] - # if len(domain_name) > 3 and is_valid_domain(domain_name): - # if domain_name == SERVER_DOMAIN.get("REDIRECT_UDID_DOMAIN").split("//")[1]: - # user_admin_obj = UserInfo.objects.filter(is_superuser=True, uid=request.user.uid).order_by( - # 'pk').first() - # if user_admin_obj: - # request.user.domain_name = domain_name - # set_default_app_wx_easy(request.user, True) - # else: - # serializer = UserInfoSerializer(request.user) - # res.data = serializer.data - # res.code = 1004 - # res.msg = "域名设置失败,请更换其他域名" - # return Response(res.dict) - # else: - # request.user.domain_name = domain_name - # set_default_app_wx_easy(request.user, True) - # else: - # serializer = UserInfoSerializer(request.user) - # res.data = serializer.data - # res.code = 1004 - # res.msg = "域名校验失败" - # return Response(res.dict) - # - # if domain_name == '': - # request.user.domain_name = None - # set_default_app_wx_easy(request.user) - username = data.get("username", None) if username and username != request.user.username: if check_username_exists(username): diff --git a/fir_ser/api/views/receiveudids.py b/fir_ser/api/views/receiveudids.py index 133e968..0f48f49 100644 --- a/fir_ser/api/views/receiveudids.py +++ b/fir_ser/api/views/receiveudids.py @@ -4,7 +4,7 @@ # author: liuyu # date: 2020/3/6 -from api.utils.app.supersignutils import udid_bytes_to_dict, get_redirect_server_domain, IosUtils +from api.utils.app.supersignutils import udid_bytes_to_dict, get_redirect_server_domain from api.models import Apps from django.views import View from django.http import HttpResponsePermanentRedirect