export async function GET(request: NextRequest) { const db = await dbConnector(); let idQoo; do { idQoo = idBuilder(); } while (await db.collection("dUser").findOne({ idQoo })); let result = await db.collection("dUser").insertOne({ id: nanoid(), idQoo, idCard: "", password: "", motto: "", name: "", nickname: "", smsCode: "", smsCodeTime: "", token: "", mobile: "", email: "", avatar: "", linkQQ: "", linkWechat: "", createTime: moment().format("YYYY-MM-DD HH:mm:ss"), updateTime: moment().format("YYYY-MM-DD HH:mm:ss"), }); db.close(); return NextResponse.json({ success: true, data: result }); }
|