- 将 admin 相关服务移动到 internal/service/admin 目录下 - 更新控制器中的服务导入路径引用 - 移除已合并的服务文件 - 添加统一工作约定文档 - 更新 API 接口定义的包路径
54 lines
1.9 KiB
Go
54 lines
1.9 KiB
Go
// Package auth 定义管理端认证接口(登录/资料/权限码/刷新/登出),路由前缀 /admin/v1/system/auth。
|
|
package auth
|
|
|
|
import "github.com/gogf/gf/v2/frame/g"
|
|
|
|
type LoginReq struct {
|
|
g.Meta `path:"/system/auth/login" method:"post" tags:"Admin/System/Auth" summary:"Administrator login"`
|
|
Username string `json:"username" v:"required"`
|
|
Password string `json:"password" v:"required"`
|
|
}
|
|
type LoginRes struct {
|
|
AccessToken string `json:"accessToken"`
|
|
RefreshToken string `json:"refreshToken"`
|
|
ExpiresIn int64 `json:"expiresIn"`
|
|
AdminID uint64 `json:"adminId"`
|
|
}
|
|
|
|
// InfoReq returns the current administrator profile (vben getUserInfo).
|
|
type InfoReq struct {
|
|
g.Meta `path:"/system/auth/info" method:"get" tags:"Admin/System/Auth" summary:"Current admin info"`
|
|
}
|
|
|
|
// InfoRes is the response of InfoReq. Roles carries role codes for vben authority.
|
|
type InfoRes struct {
|
|
AdminID uint64 `json:"adminId"`
|
|
Username string `json:"username"`
|
|
Nickname string `json:"nickname"`
|
|
Roles []string `json:"roles"`
|
|
}
|
|
|
|
// CodesReq returns the button-level permission codes of the current admin
|
|
// (vben getAccessCodes, backend access mode).
|
|
type CodesReq struct {
|
|
g.Meta `path:"/system/auth/codes" method:"get" tags:"Admin/System/Auth" summary:"Current admin access codes"`
|
|
}
|
|
|
|
// CodesRes is the response of CodesReq.
|
|
type CodesRes struct {
|
|
Codes []string `json:"codes"`
|
|
}
|
|
|
|
// RefreshReq rotates the administrator token pair using a refresh token.
|
|
type RefreshReq struct {
|
|
g.Meta `path:"/system/auth/refresh" method:"post" tags:"Admin/System/Auth" summary:"Rotate admin token"`
|
|
RefreshToken string `json:"refreshToken" v:"required"`
|
|
}
|
|
type RefreshRes LoginRes
|
|
|
|
// LogoutReq ends the administrator session.
|
|
type LogoutReq struct {
|
|
g.Meta `path:"/system/auth/logout" method:"post" tags:"Admin/System/Auth" summary:"Admin logout"`
|
|
}
|
|
type LogoutRes struct{}
|