fix: 管理端所有认证接口统一使用 /api/v1/admin/auth/* 路由

后端:
- 新增管理端认证路由组 /api/v1/admin/auth/(JWT + admin 角色双重检查)
- 管理端登出:POST /api/v1/admin/auth/logout
- 管理端获取个人信息:GET /api/v1/admin/auth/profile
- 管理端更新个人信息:PUT /api/v1/admin/auth/profile
- 管理端修改密码:PUT /api/v1/admin/auth/password

前端:
- admin/src/api/auth.js 所有接口全部改为 /api/v1/admin/auth/*
- 登出和获取个人信息不再使用前台的 /api/v1/auth/ 路由

Made-with: Cursor
This commit is contained in:
bujinyuan
2026-03-02 14:33:18 +08:00
parent c3e8600b24
commit 13c6b44352
3 changed files with 27 additions and 10 deletions

View File

@@ -1,8 +1,8 @@
/**
* 管理后台认证 API
*
* 登录接口/api/v1/admin/auth/login管理端专用后端检查管理员角色
* 其他接口:/api/v1/auth/*(与前台共用,通过 JWT 中的 client_type 区分)
* 所有接口均使用管理端专属路由/api/v1/admin/auth/*
* 后端对管理端路由做 JWT + admin 角色双重检查
*
* Token 在 Redis 中按 client_type 隔离存储:
* - 管理端echo:auth:token:admin:{user_id}
@@ -23,16 +23,16 @@ export const login = (data) => {
/**
* 管理员登出
* POST /api/v1/auth/logout
* POST /api/v1/admin/auth/logout
*/
export const logout = () => {
return request.post('/api/v1/auth/logout')
return request.post('/api/v1/admin/auth/logout')
}
/**
* 获取管理员个人信息
* GET /api/v1/auth/profile
* GET /api/v1/admin/auth/profile
*/
export const getProfile = () => {
return request.get('/api/v1/auth/profile')
return request.get('/api/v1/admin/auth/profile')
}

View File

@@ -10,7 +10,7 @@
- Loading 状态防重复提交
- 登录成功跳转仪表盘
对应 APIPOST /api/v1/auth/login
对应 APIPOST /api/v1/admin/auth/login
-->
<template>
<div class="login-page">