diff --git a/src/pages/api/user/register.ts b/src/pages/api/user/register.ts index d3c35dd0e..135f3fb60 100644 --- a/src/pages/api/user/register.ts +++ b/src/pages/api/user/register.ts @@ -47,7 +47,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse< const response = await User.create({ username: phone, password, - inviterId + inviterId: inviterId ? inviterId : undefined }); // 根据 id 获取用户信息 diff --git a/src/service/models/user.ts b/src/service/models/user.ts index 25dde41c6..43878bcf4 100644 --- a/src/service/models/user.ts +++ b/src/service/models/user.ts @@ -3,9 +3,6 @@ import { hashPassword } from '@/service/utils/tools'; import { PRICE_SCALE } from '@/constants/common'; import { UserModelSchema } from '@/types/mongoSchema'; const UserSchema = new Schema({ - email: { - type: String - }, username: { // 可以是手机/邮箱,新的验证都只用手机 type: String, @@ -45,19 +42,6 @@ const UserSchema = new Schema({ type: String, default: '' }, - accounts: [ - { - type: { - type: String, - required: true, - enum: ['openai'] // 定义允许的type - }, - value: { - type: String, - required: true - } - } - ], createTime: { type: Date, default: () => new Date()