59eb34976a
iotlcm-admin-svr:管理后台服务。 - Go module:iotlcm → git.5iot.com/iotlcm-public/iotlcm-admin-svr(729 文件) - 凭据与地址脱敏:JWT signingKey(含代码里的 MustGet 默认值)、 MySQL DSN、Redis 口令、告警邮件发件人邮箱全部改为占位; 私网 IP → 文档地址段;库名 xiujie_admin → iotlcm - 真实手机号/邮箱 → 合法 11 位编造号 / example.com - 移除内部资产:CI 触发器、过时 DDL(sql/db_iotlcm.sql)、 私有依赖 go get 行、明文 registry 登录口令 - 启动 banner 统一 IOTLCM 方块字 + 社区惯例署名 - Dockerfile 改用公共基础镜像 - 拼错的 RADEME.md → README.md,README 重写 - 需要真实数据库的用例改为可用 IOTLCM_TEST_WITH_DB=1 显式启用 - 补 Apache-2.0 LICENSE,LF 行尾 + .gitattributes 数据库 schema 不随本仓发布(生产 DDL 已过时),README 已说明。
203 lines
6.6 KiB
Go
203 lines
6.6 KiB
Go
// Package v1
|
|
// @Link https://github.com/xiujiecn/xiu-admin
|
|
// @Copyright Copyright (c) 2025 LiXiujie
|
|
// @Author Lxj <li@xiujie.cn>
|
|
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
|
package v1
|
|
|
|
import (
|
|
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
|
|
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/request"
|
|
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response"
|
|
|
|
"github.com/gogf/gf/v2/frame/g"
|
|
)
|
|
|
|
type UserInfo struct {
|
|
Id int64 `json:"id" dc:"用户ID"`
|
|
Username string `json:"userName" dc:"用户名"`
|
|
Nickname string `json:"realName" dc:"昵称"`
|
|
Avatar string `json:"avatar" dc:"头像"`
|
|
Email string `json:"email" dc:"邮箱"`
|
|
HomePath string `json:"homePath" dc:"首页路径"`
|
|
// Phonenumber 当前用户手机号,为空时前端提示绑定手机号。
|
|
Phonenumber string `json:"phonenumber" dc:"手机号"`
|
|
// IsInitPassword 当前密码是否未由用户本人设置(初始或管理员临时密码),为 true 时前端引导首次登录修改密码。
|
|
IsInitPassword bool `json:"isInitPassword" dc:"密码是否未由用户本人设置"`
|
|
}
|
|
|
|
type UserInfoReq struct {
|
|
g.Meta `path:"/user/info" method:"get" tags:"系统-用户管理" summary:"获取当前用户信息" x-check-permission:"cpc:current:user"`
|
|
}
|
|
|
|
type UserInfoRes struct {
|
|
UserInfo
|
|
}
|
|
|
|
type UserListReq struct {
|
|
g.Meta `path:"/user/list" method:"get" tags:"系统-用户管理" summary:"获取用户列表" x-check-permission:"cpm:system:user:list"`
|
|
request.PageInfo
|
|
model.UserListParam
|
|
}
|
|
|
|
type UserListRes struct {
|
|
response.PageResult
|
|
Data []*model.SysUserListModel `json:"items" dc:"用户列表"`
|
|
}
|
|
|
|
type AddUserReq struct {
|
|
g.Meta `path:"/user/add" method:"post" tags:"系统-用户管理" summary:"新增用户" x-check-permission:"cpm:system:user:add"`
|
|
model.SysUserAddModel
|
|
}
|
|
|
|
type AddUserRes struct {
|
|
Data *model.SysUserViewModel `json:"data" dc:"用户信息"`
|
|
}
|
|
|
|
type UserProfileReq struct {
|
|
g.Meta `path:"/user/profile" method:"get" tags:"系统-用户管理" summary:"获取当前用户信息" x-check-permission:"cpc:current:user"`
|
|
}
|
|
|
|
type UserProfileRes struct {
|
|
User *model.UserProfileModel `json:"user" dc:"用户信息"`
|
|
}
|
|
|
|
type UpdateCurrentUserReq struct {
|
|
g.Meta `path:"/user/profile/update" method:"post" tags:"系统-用户管理" summary:"更新当前用户信息" x-check-permission:"cpc:current:user"`
|
|
model.UpdateCurrentUserModel
|
|
}
|
|
|
|
type UpdateCurrentUserRes struct {
|
|
UserInfo
|
|
}
|
|
|
|
type UpdateCurrentUserPasswordReq struct {
|
|
g.Meta `path:"/user/profile/password" method:"post" tags:"系统-用户管理" summary:"更新当前用户密码" x-check-permission:"cpc:current:user"`
|
|
model.UpdateCurrentUserPasswordModel
|
|
}
|
|
|
|
type UpdateCurrentUserPasswordRes struct {
|
|
}
|
|
|
|
type SendCurrentUserEmailCodeReq struct {
|
|
g.Meta `path:"/user/profile/email/code" method:"post" tags:"系统-用户管理" summary:"发送修改邮箱验证码" x-check-permission:"cpc:current:user"`
|
|
model.SendCurrentUserEmailCodeModel
|
|
}
|
|
|
|
type SendCurrentUserEmailCodeRes struct{}
|
|
|
|
type UpdateCurrentUserEmailReq struct {
|
|
g.Meta `path:"/user/profile/email" method:"post" tags:"系统-用户管理" summary:"修改当前用户邮箱" x-check-permission:"cpc:current:user"`
|
|
model.UpdateCurrentUserEmailModel
|
|
}
|
|
|
|
type UpdateCurrentUserEmailRes struct{}
|
|
|
|
type SendCurrentUserPhoneCodeReq struct {
|
|
g.Meta `path:"/user/profile/phone/code" method:"post" tags:"系统-用户管理" summary:"发送修改电话验证码" x-check-permission:"cpc:current:user"`
|
|
model.SendCurrentUserPhoneCodeModel
|
|
}
|
|
|
|
type SendCurrentUserPhoneCodeRes struct{}
|
|
|
|
type UpdateCurrentUserPhoneReq struct {
|
|
g.Meta `path:"/user/profile/phone" method:"post" tags:"系统-用户管理" summary:"修改当前用户电话" x-check-permission:"cpc:current:user"`
|
|
model.UpdateCurrentUserPhoneModel
|
|
}
|
|
|
|
type UpdateCurrentUserPhoneRes struct{}
|
|
|
|
type UpdateUserReq struct {
|
|
g.Meta `path:"/user/update" method:"post" tags:"系统-用户管理" summary:"更新用户信息" x-check-permission:"cpm:system:user:edit"`
|
|
model.SysUserUpdateModel
|
|
}
|
|
|
|
type UpdateUserRes struct {
|
|
model.SysUserViewModel
|
|
}
|
|
|
|
type DeleteUserReq struct {
|
|
g.Meta `path:"/user/delete" method:"post" tags:"系统-用户管理" summary:"删除用户" x-check-permission:"cpm:system:user:remove"`
|
|
UserId int64 `json:"userId" dc:"用户ID"`
|
|
UserIds []int64 `json:"userIds" dc:"用户ID列表"`
|
|
}
|
|
|
|
type DeleteUserRes struct {
|
|
}
|
|
|
|
type GetUserReq struct {
|
|
g.Meta `path:"/user/view" method:"get" tags:"系统-用户管理" summary:"获取用户信息" x-check-permission:"cpm:system:user:query"`
|
|
UserId int64 `json:"userId" dc:"用户ID"`
|
|
}
|
|
|
|
type GetUserRes struct {
|
|
model.SysUserViewModel
|
|
}
|
|
|
|
type ResetPasswordReq struct {
|
|
g.Meta `path:"/user/resetPassword" method:"post" tags:"系统-用户管理" summary:"重置用户密码" x-check-permission:"cpm:system:user:resetPwd"`
|
|
UserId int64 `json:"userId" dc:"用户ID"`
|
|
Password string `json:"password" dc:"新密码"`
|
|
}
|
|
|
|
type ResetPasswordRes struct {
|
|
}
|
|
|
|
type GetUserListByDeptIdReq struct {
|
|
g.Meta `path:"/user/listByDeptId" method:"get" tags:"系统-用户管理" summary:"获取部门用户列表" x-check-permission:"cpm:system:user:list"`
|
|
DeptId int64 `json:"deptId" dc:"部门ID"`
|
|
request.PageInfo
|
|
}
|
|
|
|
type GetUserListByDeptIdRes struct {
|
|
response.PageResult
|
|
Items []*model.SysUserMiniModel `json:"items" dc:"用户列表"`
|
|
}
|
|
|
|
// 用户注册
|
|
type UserRegisterReq struct {
|
|
g.Meta `path:"/user/register" method:"post" tags:"系统-用户管理" summary:"用户注册" x-check-permission:"cpm:system:user:register"`
|
|
model.SysUserRegisterModel
|
|
}
|
|
|
|
type UserRegisterRes struct {
|
|
}
|
|
|
|
// StatusReq 更新用户状态
|
|
type UserStatusReq struct {
|
|
g.Meta `path:"/user/status" method:"post" tags:"系统-用户管理" summary:"更新用户状态" x-check-permission:"cpm:system:user:edit"`
|
|
model.SysUserStatusParam
|
|
}
|
|
|
|
type UserStatusRes struct {
|
|
}
|
|
|
|
// IsMfaEnabledReq 登录时查看是否开启mfa验证
|
|
type IsMfaEnabledReq struct {
|
|
g.Meta `path:"/user/isMfaEnabled" method:"get" tags:"系统-用户管理" summary:"登录时查看是否开启mfa验证"`
|
|
UserId int64 `json:"userId" v:"required#用户ID不能为空" dc:"用户ID"`
|
|
}
|
|
|
|
type IsMfaEnabledRes struct {
|
|
model.SysUserMfaEnabledModel
|
|
}
|
|
|
|
// SetMfaEnabledReq 是否开启mfa验证
|
|
type SetMfaEnabledReq struct {
|
|
g.Meta `path:"/user/setMfaEnabled" method:"post" tags:"系统-用户管理" summary:"是否开启mfa验证"`
|
|
model.SysUserIsMfaEnabledModel
|
|
}
|
|
|
|
type SetMfaEnabledRes struct {
|
|
Uuid string `json:"uuid" dc:"mfa验证码uuid"`
|
|
}
|
|
|
|
// MfaVerifyReq mfa验证
|
|
type MfaVerifyReq struct {
|
|
g.Meta `path:"/user/mfaVerify" method:"post" tags:"系统-用户管理" summary:"mfa验证" `
|
|
model.SysUserIsMfaEnabledModel
|
|
}
|
|
|
|
type MfaVerifyRes struct {
|
|
}
|