微信校验后登录服务器错误bug
This commit is contained in:
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user