refactor(admin): 合并管理后台并移除 apps/agent
- 平台与代理共用 apps/admin,统一登录 manage/auth/login - 按 userType 展示菜单,修复 token 循环跳转 - 删除独立 apps/agent 前端工程 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -22,6 +22,19 @@ export class AuthService {
|
||||
private config: ConfigService,
|
||||
) {}
|
||||
|
||||
/** 平台管理员 / 代理统一登录(按 userType 签发对应 JWT) */
|
||||
async staffLogin(username: string, password: string) {
|
||||
const user = await this.prisma.user.findUnique({
|
||||
where: { username },
|
||||
select: { userType: true },
|
||||
});
|
||||
if (!user || (user.userType !== 'ADMIN' && user.userType !== 'AGENT')) {
|
||||
throw new UnauthorizedException('Invalid credentials');
|
||||
}
|
||||
const portal = user.userType === 'ADMIN' ? 'admin' : 'agent';
|
||||
return this.login(username, password, portal);
|
||||
}
|
||||
|
||||
async login(username: string, password: string, portal: 'player' | 'admin' | 'agent') {
|
||||
const user = await this.prisma.user.findUnique({
|
||||
where: { username },
|
||||
|
||||
Reference in New Issue
Block a user