From a1deb5e6e33353690be37cb638f50f9ec8cf3fe1 Mon Sep 17 00:00:00 2001 From: Sunwuyuan Date: Sat, 15 Nov 2025 20:40:00 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=8E=A5=E5=8F=A3=EF=BC=8C=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=20namespace=20=E5=AD=97=E6=AE=B5=EF=BC=9B=E4=BF=AE=E6=94=B9=20?= =?UTF-8?q?token=20=E8=AE=BE=E7=BD=AE=E5=90=8D=E7=A7=B0=E7=9A=84=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6=EF=BC=8C=E6=94=AF=E6=8C=81=E5=AE=B6=E9=95=BF=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routes/accounts.js | 1 + routes/apps.js | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/routes/accounts.js b/routes/accounts.js index dedc4ac..505546a 100644 --- a/routes/accounts.js +++ b/routes/accounts.js @@ -584,6 +584,7 @@ router.get("/devices", jwtAuth, async (req, res, next) => { id: true, uuid: true, name: true, + namespace: true, createdAt: true, updatedAt: true, }, diff --git a/routes/apps.js b/routes/apps.js index 62f892b..f6a6465 100644 --- a/routes/apps.js +++ b/routes/apps.js @@ -287,8 +287,8 @@ router.post( } // 验证 token 类型是否为 student - if (appInstall.deviceType !== 'student') { - return next(errors.createError(403, "只有学生类型的 token 可以设置名称")); + if (!['student','parent'].includes(appInstall.deviceType)) { + return next(errors.createError(403, "只有学生和家长类型的 token 可以设置名称")); } // 读取设备的 classworks-list-main 键值 @@ -326,7 +326,7 @@ router.post( // 更新 AppInstall 的 note 字段 const updatedInstall = await prisma.appInstall.update({ where: { id: appInstall.id }, - data: { note: name }, + data: { note: appInstall.deviceType === 'parent' ? `${name} 家长` : name }, }); return res.json({