102 lines
5.1 KiB
Go
102 lines
5.1 KiB
Go
package v1
|
|
|
|
import (
|
|
"github.com/gogf/gf/v2/util/gmeta"
|
|
)
|
|
|
|
// ============================== 首页/个人中心模块 ==============================
|
|
|
|
// GetUserReq 获取当前登录用户信息请求
|
|
// 返回用户基础信息及其角色与权限集合
|
|
type GetUserReq struct {
|
|
gmeta.Meta `method:"get" path:"/api/index/getUser" summary:"获取当前用户信息"`
|
|
}
|
|
|
|
// GetUserRes 当前登录用户信息结果
|
|
// 返回用户基础信息、角色与权限集合,敏感字段不返回
|
|
type GetUserRes struct {
|
|
Id int64 `json:"id"` // 用户ID
|
|
Username string `json:"username"` // 用户名
|
|
Realname string `json:"realname"` // 真实姓名
|
|
Gender int `json:"gender"` // 性别:1-男 2-女 3-保密
|
|
Avatar string `json:"avatar"` // 头像
|
|
Mobile string `json:"mobile"` // 手机号
|
|
Email string `json:"email"` // 邮箱
|
|
DeptId int `json:"deptId"` // 部门ID
|
|
LevelId int `json:"levelId"` // 职级ID
|
|
PositionId int `json:"positionId"` // 岗位ID
|
|
City []string `json:"city"` // 省市区街道编码数组
|
|
CityInfo string `json:"cityInfo"` // 省市区信息
|
|
Address string `json:"address"` // 详细地址
|
|
Intro string `json:"intro"` // 个人简介
|
|
Status int `json:"status"` // 状态
|
|
Note string `json:"note"` // 备注
|
|
TenantId int `json:"tenantId"` // 租户ID
|
|
Roles []string `json:"roles"` // 角色编码集合
|
|
Permissions []string `json:"permissions"` // 权限标识集合
|
|
}
|
|
|
|
// GetMenusReq 获取当前用户菜单请求
|
|
// 无路径参数版本,与带路径参数的菜单路由共用同一处理逻辑
|
|
type GetMenusReq struct {
|
|
gmeta.Meta `method:"get" path:"/api/index/getMenus" summary:"获取当前用户菜单"`
|
|
Id int64 `json:"id" dc:"菜单ID(路由占位,忽略)"` // 菜单ID,路由占位
|
|
}
|
|
|
|
// GetMenusByIdReq 获取当前用户菜单请求(带路径参数)
|
|
// 带路径参数版本,与无路径参数的菜单路由共用同一处理逻辑
|
|
type GetMenusByIdReq struct {
|
|
gmeta.Meta `method:"get" path:"/api/index/getMenus/:id" summary:"获取当前用户菜单"`
|
|
Id int64 `json:"id" dc:"菜单ID(路由占位,忽略)"` // 菜单ID,路由占位
|
|
}
|
|
|
|
// MenuTreeItem 菜单树节点
|
|
// 字段与菜单表及前端路由生成契约保持一致
|
|
type MenuTreeItem struct {
|
|
Id int64 `json:"id"` // 菜单ID
|
|
ParentId int `json:"parentId"` // 上级菜单ID
|
|
Name string `json:"name"` // 菜单名称
|
|
Icon string `json:"icon"` // 图标
|
|
Icon2 string `json:"icon2"` // 菜单图标2
|
|
Path string `json:"path"` // 路由路径
|
|
Component string `json:"component"` // 前端组件路径
|
|
Permission string `json:"permission"` // 权限标识
|
|
Target int `json:"target"` // 打开方式
|
|
Type int `json:"type"` // 类型:0-菜单 1-节点
|
|
Status int `json:"status"` // 状态
|
|
Hide int `json:"hide"` // 是否隐藏
|
|
Sort int `json:"sort"` // 排序
|
|
Redirect string `json:"redirect,omitempty"` // 重定向地址
|
|
Children []*MenuTreeItem `json:"children"` // 子节点集合
|
|
}
|
|
|
|
// GetMenusRes 菜单树结果
|
|
type GetMenusRes = []*MenuTreeItem
|
|
|
|
// UpdatePasswordReq 修改个人密码请求
|
|
type UpdatePasswordReq struct {
|
|
gmeta.Meta `method:"put" path:"/api/index/updatePassword" summary:"修改个人密码"`
|
|
Password string `json:"password" v:"required#请输入原密码" dc:"原密码"` // 原密码
|
|
NewPassword string `json:"newPassword" v:"required#请输入新密码|length:6,32#新密码长度需在6~32位" dc:"新密码"` // 新密码
|
|
}
|
|
|
|
// UpdatePasswordRes 修改个人密码结果
|
|
type UpdatePasswordRes struct{}
|
|
|
|
// UpdateProfileReq 更新个人信息请求
|
|
type UpdateProfileReq struct {
|
|
gmeta.Meta `method:"put" path:"/api/index/updateProfile" summary:"更新个人信息"`
|
|
Realname string `json:"realname" v:"required#请输入姓名" dc:"姓名"` // 真实姓名
|
|
Gender int `json:"gender" dc:"性别:1-男 2-女 3-保密"` // 性别
|
|
Avatar string `json:"avatar" dc:"头像"` // 头像
|
|
Mobile string `json:"mobile" v:"phone#手机号格式不正确" dc:"手机号"` // 手机号
|
|
Email string `json:"email" v:"email#邮箱格式不正确" dc:"邮箱"` // 邮箱
|
|
City []string `json:"city" dc:"省市区街道编码数组"` // 省市区街道编码数组
|
|
CityInfo string `json:"cityInfo" dc:"省市区信息"` // 省市区信息
|
|
Address string `json:"address" dc:"详细地址"` // 详细地址
|
|
Intro string `json:"intro" dc:"个人简介"` // 个人简介
|
|
}
|
|
|
|
// UpdateProfileRes 更新个人信息结果
|
|
type UpdateProfileRes struct{}
|