From c7dc6a227438f9d1282ec8485ffd1b1c2cb2f136 Mon Sep 17 00:00:00 2001 From: jacy-dukang Date: Fri, 3 Jul 2026 13:22:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E6=A0=A1=E9=AA=8C=E5=90=8E?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E6=9C=8D=E5=8A=A1=E5=99=A8=E9=94=99=E8=AF=AF?= =?UTF-8?q?bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/dukang-api/.env.example | 2 +- server/dukang-api/.env.production.example | 4 ++-- server/dukang-api/src/modules/iam/auth.service.ts | 13 ++++++------- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/server/dukang-api/.env.example b/server/dukang-api/.env.example index 4884396..acbc058 100644 --- a/server/dukang-api/.env.example +++ b/server/dukang-api/.env.example @@ -28,7 +28,7 @@ WX_MCH_PRIVATE_KEY= WX_API_V3_KEY= # 微信平台公钥证书 PEM(生产环境必填,用于回调验签;开发可暂留空) WX_PLATFORM_CERT= -WX_PAY_NOTIFY_URL=https://your-domain.com/api/v1/callbacks/wechat/pay +WX_PAY_NOTIFY_URL=https://dkapi.runxian.top/api/v1/callbacks/wechat/pay # 阿里云 OSS(ali-oss@6.x;OSS_ENABLED=true 且下方密钥齐全时生效;否则 Mock 占位 URL) # RAM 用户需具备 PutObject 权限;可在控制台 Bucket 授权策略中为该 RAM UID 授予读写 diff --git a/server/dukang-api/.env.production.example b/server/dukang-api/.env.production.example index ecba97a..1bfcc93 100644 --- a/server/dukang-api/.env.production.example +++ b/server/dukang-api/.env.production.example @@ -27,14 +27,14 @@ WX_MCH_SERIAL_NO= WX_MCH_PRIVATE_KEY= WX_API_V3_KEY= WX_PLATFORM_CERT= -WX_PAY_NOTIFY_URL=https://api.lingshivip.cn/api/v1/callbacks/wechat/pay +WX_PAY_NOTIFY_URL=https://dkapi.runxian.top/api/v1/callbacks/wechat/pay OSS_ENABLED=true OSS_ACCESS_KEY_ID= OSS_ACCESS_KEY_SECRET= OSS_BUCKET=dukang-prod OSS_REGION=oss-cn-beijing -OSS_CDN_BASE=https://lingshivip.cn +OSS_CDN_BASE=https://dukang-prod.oss-cn-beijing.aliyuncs.com OSS_UPLOAD_PREFIX=uploads OSS_UPLOAD_EXPIRE_SECONDS=900 OSS_MAX_UPLOAD_BYTES=10485760 diff --git a/server/dukang-api/src/modules/iam/auth.service.ts b/server/dukang-api/src/modules/iam/auth.service.ts index c906dc7..be076eb 100644 --- a/server/dukang-api/src/modules/iam/auth.service.ts +++ b/server/dukang-api/src/modules/iam/auth.service.ts @@ -17,7 +17,6 @@ import { SMS_PROVIDER, WECHAT_PROVIDER } from '../../integrations/integrations.c import { ISmsProvider } from '../../integrations/sms/sms.interface'; import type { IWechatProvider } from '../../integrations/wechat/wechat.interface'; import { serializeBigInt } from '../../common/decorators/current-user.decorator'; -import type { Prisma } from '@prisma/client'; import type { User } from '@prisma/client'; @@ -584,12 +583,12 @@ export class AuthService { } } - const primaryUpdate: Prisma.UserUpdateInput = {}; - if (guest.deviceKey && !primary.deviceKey) { - primaryUpdate.deviceKey = guest.deviceKey; - } - if (Object.keys(primaryUpdate).length > 0) { - await tx.user.update({ where: { id: primaryId }, data: primaryUpdate }); + const deviceKeyToTransfer = + guest.deviceKey && !primary.deviceKey ? guest.deviceKey : null; + if (deviceKeyToTransfer) { + // 先清空访客 deviceKey,避免 uk_user_user_device_key 冲突 + await tx.user.update({ where: { id: guestId }, data: { deviceKey: null } }); + await tx.user.update({ where: { id: primaryId }, data: { deviceKey: deviceKeyToTransfer } }); } await tx.user.update({