From e970a610fcf8cc8e8737b3736af23ffdfd047777 Mon Sep 17 00:00:00 2001 From: TermiNexus Date: Tue, 11 Aug 2026 16:17:51 +0800 Subject: [PATCH] =?UTF-8?q?fix(gitea):=20=E7=94=B3=E8=AF=B7=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E8=A1=A5=E4=BC=A0=20UserGiteaAccountUUID=20=E4=B8=BB?= =?UTF-8?q?=E9=94=AE=EF=BC=8C=E4=BF=AE=E5=A4=8D=20Duplicate=20entry=20'\x0?= =?UTF-8?q?0'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 创建 UserGiteaAccount 时漏传主键 UserGiteaAccountUUID,UUIDField 无默认值导致主键存全零字节,第二次申请触发 MySQL 主键冲突;与 mail.py 模式对齐补 uuid4().bytes --- gvsds/apps/gerp/views/gitea.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gvsds/apps/gerp/views/gitea.py b/gvsds/apps/gerp/views/gitea.py index c9befad6..ed3d60b9 100644 --- a/gvsds/apps/gerp/views/gitea.py +++ b/gvsds/apps/gerp/views/gitea.py @@ -14,6 +14,7 @@ URL 路径最后一段作为 action 名称,无需前端额外传 Action 字段 """ import logging import re +import uuid from rest_framework.permissions import IsAuthenticated from rest_framework.response import Response @@ -187,6 +188,7 @@ class GiteaApplyView(ELTAuthenticatedAPIView): return Response({'code': 1, 'msg': f'加入组织失败: {e}'}, status=502) UserGiteaAccount.objects.create( + UserGiteaAccountUUID=uuid.uuid4().bytes, UserUUID=request.user, GiteaLogin=login, GiteaUserId=gitea_user_id,