diff --git a/TempLate/GERP/index.html b/TempLate/GERP/index.html index 3276305f..b631795d 100644 --- a/TempLate/GERP/index.html +++ b/TempLate/GERP/index.html @@ -5,7 +5,7 @@ GERP 管理系统 - + @@ -14,7 +14,7 @@ - +
diff --git a/gvsds/apps/gerp/views/mail.py b/gvsds/apps/gerp/views/mail.py index c0a8ece6..e8450b30 100644 --- a/gvsds/apps/gerp/views/mail.py +++ b/gvsds/apps/gerp/views/mail.py @@ -531,3 +531,22 @@ class MailContactsView(ELTAuthenticatedAPIView): obj.ContactName = name obj.save(update_fields=['ContactName']) return Response({'code': 0, 'data': {'Created': created}}) + + def delete(self, request): + from gvsdsdk.model_utils import UUIDObj + from ..models import MailContact + qs = MailContact.objects.filter(UserUUID=request.user) + uuid_str = request.data.get('MailContactUUID') or '' + email = (request.data.get('ContactEmail') or '').strip().lower() + obj = None + if uuid_str: + try: + obj = qs.filter(MailContactUUID=UUIDObj(uuid_str).bytes).first() + except (ValueError, AttributeError): + obj = None + elif email: + obj = qs.filter(ContactEmail=email).first() + if obj is None: + return Response({'code': 1, 'msg': '联系人不存在'}, status=404) + obj.delete() + return Response({'code': 0, 'msg': '已删除联系人'})