|
|
@@ -316,8 +316,8 @@ export function createUserRoutes(withAuth: WithAuth) {
|
|
|
try {
|
|
|
const user = c.get('user')!
|
|
|
|
|
|
- // 检查是否为管理员
|
|
|
- if (user.role !== 'admin') {
|
|
|
+ // 检查是否为管理员或老师
|
|
|
+ if (user.role !== 'admin' && user.role !== 'teacher') {
|
|
|
return c.json({ error: '无权执行此操作' }, 403)
|
|
|
}
|
|
|
|
|
|
@@ -344,7 +344,7 @@ export function createUserRoutes(withAuth: WithAuth) {
|
|
|
return c.json({ error: '用户不存在' }, 404)
|
|
|
}
|
|
|
|
|
|
- if (existingUser.role !== 'follower') {
|
|
|
+ if (existingUser.role !== 'fan') {
|
|
|
return c.json({ error: '只能将粉丝转为学员' }, 400)
|
|
|
}
|
|
|
|