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 已说明。
235 lines
13 KiB
Go
235 lines
13 KiB
Go
// package model
|
|
// @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 model
|
|
|
|
import (
|
|
"github.com/gogf/gf/v2/frame/g"
|
|
"github.com/gogf/gf/v2/os/gtime"
|
|
)
|
|
|
|
type SysUserMiniModel struct {
|
|
g.Meta `orm:"table:sys_user" description:"用户"`
|
|
UserId int64 `json:"userId" orm:"user_id" description:"用户ID"`
|
|
UserName string `json:"userName" orm:"user_name" description:"用户账号"`
|
|
NickName string `json:"nickName" orm:"nick_name" description:"用户昵称"`
|
|
Avatar string `json:"avatar" orm:"avatar" description:"头像地址"`
|
|
TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"`
|
|
DeptId int64 `json:"deptId" orm:"dept_id" description:"部门ID"`
|
|
}
|
|
|
|
type LoginUserOut struct {
|
|
ID int64 `json:"id"`
|
|
Username string `json:"username"`
|
|
NickName string `json:"nickName"`
|
|
Avatar string `json:"avatar"`
|
|
TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"`
|
|
DeptId int64 `json:"deptId" orm:"dept_id" description:"部门ID"`
|
|
UUID string `json:"uuid"`
|
|
RoleIds []int64 `json:"roleIds"`
|
|
}
|
|
|
|
type UserListParam struct {
|
|
TenantId string `json:"tenantId" description:"租户编号"`
|
|
UserId int64 `json:"userId" description:"用户ID"`
|
|
DeptId int64 `json:"deptId" description:"部门ID"`
|
|
DeptIdList []int64 `json:"deptIdList" description:"部门ID列表"`
|
|
UserName string `json:"userName" description:"用户账号"`
|
|
NickName string `json:"nickName" description:"用户昵称"`
|
|
Email string `json:"email" description:"用户邮箱"`
|
|
Phonenumber string `json:"phonenumber" description:"手机号码"`
|
|
Status string `json:"status" description:"帐号状态(0正常 1停用)"`
|
|
CreatedAt []string `json:"createdAt" description:"创建时间"`
|
|
}
|
|
|
|
type SysUserListModel struct {
|
|
UserId int64 `json:"userId" orm:"user_id" description:"用户ID"`
|
|
TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"`
|
|
DeptId int64 `json:"deptId" orm:"dept_id" description:"部门ID"`
|
|
UserName string `json:"userName" orm:"user_name" description:"用户账号"`
|
|
NickName string `json:"nickName" orm:"nick_name" description:"用户昵称"`
|
|
UserType string `json:"userType" orm:"user_type" description:"用户类型(sys_user系统用户)"`
|
|
Email string `json:"email" orm:"email" description:"用户邮箱"`
|
|
Phonenumber string `json:"phonenumber" orm:"phonenumber" description:"手机号码"`
|
|
Sex string `json:"sex" orm:"sex" description:"用户性别(0男 1女 2未知)"`
|
|
Avatar string `json:"avatar" orm:"avatar" description:"头像地址"`
|
|
Status string `json:"status" orm:"status" description:"帐号状态(0正常 1停用)"`
|
|
LoginIp string `json:"loginIp" orm:"login_ip" description:"最后登录IP"`
|
|
LoginDate *gtime.Time `json:"loginDate" orm:"login_date" description:"最后登录时间"`
|
|
CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"`
|
|
CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"`
|
|
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"`
|
|
Remark string `json:"remark" orm:"remark" description:"备注"`
|
|
DeptInfo *SysDeptMiniModel `json:"deptInfo" orm:"with:dept_id=dept_id" description:"部门信息"`
|
|
Roles []*SysRoleMiniModel `json:"roles" description:"角色信息"`
|
|
IsDefaultUser bool `json:"isDefaultUser" description:"是否默认用户"`
|
|
}
|
|
|
|
type SysUserViewModel struct {
|
|
UserId int64 `json:"userId" orm:"user_id" description:"用户ID"`
|
|
TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"`
|
|
DeptId int64 `json:"deptId" orm:"dept_id" description:"部门ID"`
|
|
UserName string `json:"userName" orm:"user_name" description:"用户账号"`
|
|
NickName string `json:"nickName" orm:"nick_name" description:"用户昵称"`
|
|
UserType string `json:"userType" orm:"user_type" description:"用户类型(sys_user系统用户)"`
|
|
Email string `json:"email" orm:"email" description:"用户邮箱"`
|
|
Phonenumber string `json:"phonenumber" orm:"phonenumber" description:"手机号码"`
|
|
Sex string `json:"sex" orm:"sex" description:"用户性别(0男 1女 2未知)"`
|
|
Avatar string `json:"avatar" orm:"avatar" description:"头像地址"`
|
|
Status string `json:"status" orm:"status" description:"帐号状态(0正常 1停用)"`
|
|
LoginIp string `json:"loginIp" orm:"login_ip" description:"最后登录IP"`
|
|
LoginDate *gtime.Time `json:"loginDate" orm:"login_date" description:"最后登录时间"`
|
|
MfaEnabled int64 `json:"mfaEnabled" orm:"mfa_enabled" description:"是否开启mfa验证"`
|
|
IsInitPassword int64 `json:"isInitPassword" orm:"is_init_password" description:"当前密码是否未由用户本人设置(1=初始或管理员临时密码)"`
|
|
|
|
CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"`
|
|
CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"`
|
|
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"`
|
|
Remark string `json:"remark" orm:"remark" description:"备注"`
|
|
DeptInfo *SysDeptMiniModel `json:"deptInfo" orm:"with:dept_id=dept_id" description:"部门信息"`
|
|
Roles []*SysRoleMiniModel `json:"roles" description:"角色信息"`
|
|
Posts []*SysPostMiniModel `json:"posts" description:"岗位信息"`
|
|
}
|
|
|
|
type UserProfileModel struct {
|
|
SysUserViewModel
|
|
CompanyInfo *SysDeptMiniModel `json:"companyInfo" orm:"with:dept_id=dept_id" description:"公司信息"`
|
|
}
|
|
|
|
type UpdateCurrentUserModel struct {
|
|
NickName string `json:"nickName"`
|
|
Email string `json:"email"`
|
|
Phonenumber string `json:"phonenumber"`
|
|
Avatar string `json:"avatar"`
|
|
Sex string `json:"sex"`
|
|
}
|
|
|
|
type UpdateCurrentUserPasswordModel struct {
|
|
OldPassword string `json:"oldPassword"`
|
|
NewPassword string `json:"newPassword"`
|
|
}
|
|
|
|
type UpdateCurrentUserContactCodeModel struct {
|
|
Contact string `json:"contact" v:"required#手机号或邮箱不能为空" dc:"手机号或邮箱"`
|
|
CaptchaID string `json:"captchaID" v:"required#图片验证码不能为空" dc:"图片验证码ID"`
|
|
CaptchaValue string `json:"captchaValue" v:"required#图片验证码不能为空" dc:"图片验证码值"`
|
|
}
|
|
|
|
type UpdateCurrentUserContactModel struct {
|
|
Contact string `json:"contact" v:"required#手机号或邮箱不能为空" dc:"手机号或邮箱"`
|
|
Code string `json:"code" v:"required#验证码不能为空" dc:"短信/邮箱验证码"`
|
|
}
|
|
|
|
type SendCurrentUserEmailCodeModel struct {
|
|
Email string `json:"email" dc:"新邮箱"`
|
|
CaptchaID string `json:"captchaId" dc:"身份验证码ID"`
|
|
CaptchaValue string `json:"captchaValue" dc:"身份验证码"`
|
|
}
|
|
|
|
type UpdateCurrentUserEmailModel struct {
|
|
Email string `json:"email" dc:"新邮箱"`
|
|
Code string `json:"code" dc:"验证码"`
|
|
}
|
|
|
|
type SendCurrentUserPhoneCodeModel struct {
|
|
Phonenumber string `json:"phonenumber" dc:"新电话"`
|
|
CaptchaID string `json:"captchaId" dc:"身份验证码ID"`
|
|
CaptchaValue string `json:"captchaValue" dc:"身份验证码"`
|
|
}
|
|
|
|
type UpdateCurrentUserPhoneModel struct {
|
|
Phonenumber string `json:"phonenumber" dc:"新电话"`
|
|
Code string `json:"code" dc:"验证码"`
|
|
}
|
|
|
|
type UserCodeHttpSenderConfig struct {
|
|
Timeout string `json:"timeout"`
|
|
Url string `json:"url"`
|
|
Method string `json:"method"`
|
|
Headers map[string]string `json:"headers"`
|
|
BodyTemplate string `json:"bodyTemplate"`
|
|
SuccessStatus int `json:"successStatus"`
|
|
}
|
|
|
|
type UserCodeEmailSenderConfig struct {
|
|
UserCodeHttpSenderConfig
|
|
Host string `json:"host"`
|
|
Port int `json:"port"`
|
|
Username string `json:"username"`
|
|
Password string `json:"password"`
|
|
From string `json:"from"`
|
|
FromName string `json:"fromName"`
|
|
Subject string `json:"subject"`
|
|
BodyTemplate string `json:"bodyTemplate"`
|
|
SSL bool `json:"ssl"`
|
|
}
|
|
|
|
type SysUserAddModel struct {
|
|
TenantId string `json:"tenantId" orm:"tenant_id" description:"租户编号"`
|
|
DeptId int64 `json:"deptId" orm:"dept_id" description:"部门ID"`
|
|
UserName string `json:"userName" orm:"user_name" description:"用户账号"`
|
|
NickName string `json:"nickName" orm:"nick_name" description:"用户昵称"`
|
|
UserType string `json:"userType" orm:"user_type" description:"用户类型(sys_user系统用户)"`
|
|
Email string `json:"email" orm:"email" description:"用户邮箱"`
|
|
Phonenumber string `json:"phonenumber" orm:"phonenumber" description:"手机号码"`
|
|
Sex string `json:"sex" orm:"sex" description:"用户性别(0男 1女 2未知)"`
|
|
Avatar string `json:"avatar" orm:"avatar" description:"头像地址"`
|
|
Salt string `json:"salt" orm:"salt" description:"加密盐"`
|
|
Password string `json:"password" orm:"password" description:"密码"`
|
|
Status string `json:"status" orm:"status" description:"帐号状态(0正常 1停用)"`
|
|
LoginIp string `json:"loginIp" orm:"login_ip" description:"最后登录IP"`
|
|
LoginDate *gtime.Time `json:"loginDate" orm:"login_date" description:"最后登录时间"`
|
|
CreatedDept int64 `json:"createdDept" orm:"created_dept" description:"创建部门"`
|
|
CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建者"`
|
|
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"`
|
|
UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新者"`
|
|
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"`
|
|
Remark string `json:"remark" orm:"remark" description:"备注"`
|
|
PostIds []int64 `json:"postIds" orm:"post_ids" description:"岗位ID列表"`
|
|
RoleIds []int64 `json:"roleIds" orm:"role_ids" description:"角色ID列表"`
|
|
}
|
|
|
|
type SysUserUpdateModel struct {
|
|
UserId int64 `json:"userId" orm:"user_id" description:"用户ID"`
|
|
DeptId *int64 `json:"deptId" orm:"dept_id" description:"部门ID"`
|
|
UserName *string `json:"userName" orm:"user_name" description:"用户账号"`
|
|
NickName *string `json:"nickName" orm:"nick_name" description:"用户昵称"`
|
|
UserType *string `json:"userType" orm:"user_type" description:"用户类型(sys_user系统用户)"`
|
|
Email *string `json:"email" orm:"email" description:"用户邮箱"`
|
|
Phonenumber *string `json:"phonenumber" orm:"phonenumber" description:"手机号码"`
|
|
Sex *string `json:"sex" orm:"sex" description:"用户性别(0男 1女 2未知)"`
|
|
Avatar *string `json:"avatar" orm:"avatar" description:"头像地址"`
|
|
Status *string `json:"status" orm:"status" description:"帐号状态(0正常 1停用)"`
|
|
UpdatedBy *int64 `json:"updatedBy" orm:"updated_by" description:"更新者"`
|
|
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"`
|
|
Remark *string `json:"remark" orm:"remark" description:"备注"`
|
|
PostIds []int64 `json:"postIds" orm:"post_ids" description:"岗位ID列表"`
|
|
RoleIds []int64 `json:"roleIds" orm:"role_ids" description:"角色ID列表"`
|
|
}
|
|
|
|
type SysUserRegisterModel struct {
|
|
UserName string `json:"userName" v:"required#用户账号不能为空" dc:"用户账号"`
|
|
Password string `json:"password" v:"required#密码不能为空" dc:"密码"`
|
|
TenantId string `json:"tenantId" v:"required#租户编号不能为空" dc:"租户编号"`
|
|
CaptchaID string `json:"captchaId" v:"required#验证码不能为空" dc:"验证码ID"`
|
|
CaptchaValue string `json:"captchaValue" v:"required#验证码不能为空" dc:"验证码值"`
|
|
}
|
|
|
|
type SysUserStatusParam struct {
|
|
UserId int64 `json:"userId" v:"required#用户ID不能为空" dc:"用户ID"`
|
|
Status string `json:"status" v:"required#状态不能为空" dc:"状态"`
|
|
}
|
|
|
|
type SysUserMfaEnabledModel struct {
|
|
UserId int64 `json:"userId" dc:"用户ID"`
|
|
MfaEnabled int64 `json:"mfaEnabled" dc:"是否开启mfa验证 0否 1是"`
|
|
}
|
|
|
|
type SysUserIsMfaEnabledModel struct {
|
|
Uuid string `json:"uuid" dc:"mfa验证码uuid"`
|
|
Code string `json:"code" dc:"mfa验证码"`
|
|
MfaEnabled int64 `json:"mfaEnabled" dc:"是否开启mfa验证 0否 1是"`
|
|
}
|