Documentation ¶
Index ¶
- Variables
- func APIToPB(in *API) *apipb.APIInfo
- func APIsToPB(in []API) []*apipb.APIInfo
- func AddMenu(menu *Menu) error
- func Authenticate(t, method, url string, checkAuth bool) (*apipb.CurrentUser, int, error)
- func AutoMigrate()
- func BindPhone(userID string, phoneNuber string) error
- func CheckRegisterWithWechat(unionID, openID string, resp *CheckRegisterWithWechatResp)
- func ClearCasbin(v int, p ...string) (bool, error)
- func CopyTenant(id string) error
- func CreateAPI(api *API) error
- func CreateAPP(md *APP) error
- func CreateRole(newRole *Role) error
- func CreateTenant(m *Tenant) error
- func CreateTitle(title *Title) error
- func CreateUser(user *User, isCreateFromWechat bool) error
- func DeleteAPP(id string) (err error)
- func DeleteApi(id string) (err error)
- func DeleteMenu(id string) (err error)
- func DeleteRole(roleID string) (err error)
- func DeleteTenant(id string) (err error)
- func DeleteTitle(id string) (err error)
- func DeleteUser(id string) (err error)
- func EnableAPI(id string, enable bool) error
- func EnableTenant(id string, enable bool) error
- func EnableUser(id string, enable bool) error
- func EncryptedPassword(password string) (string, error)
- func GetUserProfile(id string) (*apipb.UserProfile, error)
- func Init(connStr string, debug bool)
- func InitCasbin()
- func Login(req *apipb.LoginRequest, resp *apipb.LoginResponse)
- func LoginByWechat(register bool, req *User, resp *apipb.LoginResponse)
- func Logout(t string) error
- func MenuFuncApisToPB(params []MenuFuncApi) []*apipb.MenuFuncApi
- func MenuFuncsToPB(params []*MenuFunc) []*apipb.MenuFunc
- func MenuParametersToPB(params []*MenuParameter) []*apipb.MenuParameter
- func MenuToPB(in *Menu) *apipb.MenuInfo
- func MenusToPB(in []*Menu) []*apipb.MenuInfo
- func NewEnforcer() *casbin.Enforcer
- func ParamsMatch(fullNameKey1 string, key2 string) bool
- func ParamsMatchFunc(args ...interface{}) (interface{}, error)
- func QueryAPI(req *apipb.QueryAPIRequest, resp *apipb.QueryAPIResponse)
- func QueryAPP(req *QueryAPPRequest, resp *QueryAPPResponse)
- func QueryMenu(req *apipb.QueryMenuRequest, resp *apipb.QueryMenuResponse)
- func QueryRole(req *apipb.QueryRoleRequest, resp *apipb.QueryRoleResponse)
- func QueryTenant(req *apipb.QueryTenantRequest, resp *apipb.QueryTenantResponse)
- func QueryTitle(req *QueryTitleRequest, resp *QueryTitleResponse)
- func QueryUser(req *apipb.QueryUserRequest, resp *apipb.QueryUserResponse)
- func ResetPwd(id string, pwd string) error
- func RoleMenusToPB(roleMenus []*RoleMenu) []*apipb.RoleMenu
- func RoleToPB(in *Role) *apipb.RoleInfo
- func RolesToPB(in []*Role) []*apipb.RoleInfo
- func SetDefaultPwd(defaultPwd string)
- func StatisticRoleCount(tenantID string) (int64, error)
- func StatisticTenantCount() (int64, error)
- func StatisticUserCount(t int, tenantID, group string) (int64, error)
- func TenantToPB(in *Tenant) *apipb.TenantInfo
- func TenantsToPB(in []*Tenant) []*apipb.TenantInfo
- func UpdateAPI(api *API) error
- func UpdateAPP(md *APP) error
- func UpdateCasbin(roleID string, casbinInfos []*CasbinRule) error
- func UpdateCasbinApi(oldPath string, newPath string, oldMethod string, newMethod string) error
- func UpdateMenu(menu *Menu) (err error)
- func UpdateProfile(m *User, updateUserName bool) error
- func UpdateProfileAndUserName(m *User) error
- func UpdatePwd(id string, oldPwd, newPwd string) error
- func UpdateRole(newRole *Role) error
- func UpdateTenant(m *Tenant) error
- func UpdateTitle(title *Title) error
- func UpdateUser(user *User) error
- func UserRolesToPB(userRoles []*UserRole) []*apipb.UserRole
- func UserToPB(in *User) *apipb.UserInfo
- func UsersToPB(in []*User) []*apipb.UserInfo
- func ValidPasswdStrength(str string) bool
- type API
- type APP
- type APPProp
- type CasbinRule
- type CheckRegisterWithWechatResp
- type Menu
- type MenuFunc
- type MenuFuncApi
- type MenuParameter
- type QueryAPIRequest
- type QueryAPIResponse
- type QueryAPPRequest
- type QueryAPPResponse
- type QueryMenuRequest
- type QueryMenuResponse
- type QueryTenantRequest
- type QueryTenantResponse
- type QueryTitleRequest
- type QueryTitleResponse
- type QueryUserRequest
- type QueryUserResponse
- type Role
- type RoleCopyResponse
- type RoleMenu
- type RoleResponse
- type Tenant
- type Title
- type User
- type UserProfile
- type UserRole
Constants ¶
This section is empty.
Variables ¶
var DefaultPwd = "ABC123def"
var Logger *zap.Logger
Functions ¶
func AddMenu ¶
@author: [guoxf](https://github.com/guoxf) @function: AddMenu @description: 添加菜单 @param: menu Menu @return: err error
func Authenticate ¶
func CheckRegisterWithWechat ¶
func CheckRegisterWithWechat(unionID, openID string, resp *CheckRegisterWithWechatResp)
func ClearCasbin ¶
@author: [guoxf](https://github.com/guoxf) @function: ClearCasbin @description: 清除匹配的权限 @param: v int, p ...string @return: bool
func CopyTenant ¶
func CreateAPI ¶
@author: [guoxf](https://github.com/guoxf) @function: CreateAPI @description: 新增API @param: api API @return: err error
func CreateRole ¶
@author: [guoxf](https://github.com/guoxf) @function: CreateRole @description: 创建一个角色 @param: newRole Role @return: err error, role Role
func CreateTenant ¶
func CreateTitle ¶
func CreateUser ¶
@author: [guoxf](https://github.com/guoxf) @function: CreateUser @description: 新增User @param: user User @return: err error
func DeleteApi ¶
@author: [guoxf](https://github.com/guoxf) @function: DeleteApi @description: 删除API @param: api API @return: err error
func DeleteMenu ¶
@author: [guoxf](https://github.com/guoxf) @function: DeleteMenu @description: 删除菜单 @param: id uint @return: err error
func DeleteRole ¶
@author: [guoxf](https://github.com/guoxf) @function: DeleteRole @description: 删除角色 @param: auth *Role @return: err error
func DeleteTenant ¶
func DeleteTitle ¶
func DeleteUser ¶
@author: [guoxf](https://github.com/guoxf) @function: DeleteUser @description: 删除User @param: user User @return: err error
func EnableTenant ¶
func EnableUser ¶
func EncryptedPassword ¶
EncryptedPassword 对密码进行加密
func GetUserProfile ¶
func GetUserProfile(id string) (*apipb.UserProfile, error)
func InitCasbin ¶
func InitCasbin()
func Login ¶
func Login(req *apipb.LoginRequest, resp *apipb.LoginResponse)
func LoginByWechat ¶
func LoginByWechat(register bool, req *User, resp *apipb.LoginResponse)
func MenuFuncApisToPB ¶
func MenuFuncApisToPB(params []MenuFuncApi) []*apipb.MenuFuncApi
func MenuFuncsToPB ¶
func MenuParametersToPB ¶
func MenuParametersToPB(params []*MenuParameter) []*apipb.MenuParameter
func NewEnforcer ¶
func NewEnforcer() *casbin.Enforcer
@author: [guoxf](https://github.com/guoxf) @function: NewEnforcer @description: 持久化到数据库 引入自定义规则 @return: *casbin.Enforcer
func ParamsMatch ¶
@author: [guoxf](https://github.com/guoxf) @function: ParamsMatch @description: 自定义规则函数 @param: fullNameKey1 string, key2 string @return: bool
func ParamsMatchFunc ¶
func ParamsMatchFunc(args ...interface{}) (interface{}, error)
@author: [guoxf](https://github.com/guoxf) @function: ParamsMatchFunc @description: 自定义规则函数 @param: args ...interface{} @return: interface{}, error
func QueryAPI ¶
func QueryAPI(req *apipb.QueryAPIRequest, resp *apipb.QueryAPIResponse)
@author: [guoxf](https://github.com/guoxf) @function: GetAPIInfoList @description: 分页查询API @param: api API, info PageInfo, order string, desc bool @return: list []*API, total int64 , err error
func QueryAPP ¶
func QueryAPP(req *QueryAPPRequest, resp *QueryAPPResponse)
func QueryMenu ¶
func QueryMenu(req *apipb.QueryMenuRequest, resp *apipb.QueryMenuResponse)
@author: [guoxf](https://github.com/guoxf) @function: GetMenuInfoList @description: 分页查询Menu @param: api Menu, info PageInfo, order string, desc bool @return: list []*Menu, total int64 , err error
func QueryRole ¶
func QueryRole(req *apipb.QueryRoleRequest, resp *apipb.QueryRoleResponse)
func QueryTenant ¶
func QueryTenant(req *apipb.QueryTenantRequest, resp *apipb.QueryTenantResponse)
func QueryTitle ¶
func QueryTitle(req *QueryTitleRequest, resp *QueryTitleResponse)
func QueryUser ¶
func QueryUser(req *apipb.QueryUserRequest, resp *apipb.QueryUserResponse)
@author: [guoxf](https://github.com/guoxf) @function: GetUserInfoList @description: 分页查询User @param: user User, info PageInfo, order string, desc bool @return: list []*User, total int64 , err error
func RoleMenusToPB ¶
func SetDefaultPwd ¶
func SetDefaultPwd(defaultPwd string)
func StatisticRoleCount ¶ added in v1.1.0
func StatisticTenantCount ¶ added in v1.1.0
func StatisticUserCount ¶ added in v1.1.0
func TenantToPB ¶
func TenantToPB(in *Tenant) *apipb.TenantInfo
func TenantsToPB ¶
func TenantsToPB(in []*Tenant) []*apipb.TenantInfo
func UpdateAPI ¶
@author: [guoxf](https://github.com/guoxf) @function: UpdateAPI @description: 根据id更新api @param: api API @return: err error
func UpdateCasbin ¶
func UpdateCasbin(roleID string, casbinInfos []*CasbinRule) error
@author: [guoxf](https://github.com/guoxf) @function: UpdateCasbin @description: 更新casbin权限 @param: roleID string, casbinInfos []CasbinRule @return: error
func UpdateCasbinApi ¶
@author: [guoxf](https://github.com/guoxf) @function: UpdateCasbinApi @description: API更新随动 @param: oldPath string, newPath string, oldMethod string, newMethod string @return: error
func UpdateMenu ¶
@author: [guoxf](https://github.com/guoxf) @function: UpdateMenu @description: 更新菜单 @param: menu Menu @return:err error
func UpdateProfileAndUserName ¶ added in v1.1.7
func UpdateRole ¶
@author: [guoxf](https://github.com/guoxf) @function: UpdateRole @description: 更改一个角色 @param: newRole Role @return:err error, role Role
func UpdateTenant ¶
func UpdateTitle ¶
func UpdateUser ¶
@author: [guoxf](https://github.com/guoxf) @function: UpdateUser @description: 根据id更新user @param: user User @return: err error
func UserRolesToPB ¶
func ValidPasswdStrength ¶
Types ¶
type API ¶
type API struct { model.Model Path string `json:"path" gorm:"size:200;index;comment:路径"` Group string `json:"group" gorm:"size:50;index;comment:分组"` Method string `json:"method" gorm:"size:50;index;default:POST;comment:方法"` Description string `json:"description" gorm:"size:200;index;comment:中文描述"` Enable bool `json:"enable" gorm:"index;comment:是否启用API"` //如果不开启权限校验,那么在每个角色都加上casbin rule //1. 不需要登录就可以直接访问 //2. 需要登录但不需要校验权限,也就是所有人都可以访问 //3. 需要登录并且校验权限 CheckAuth bool `json:"checkAuth" gorm:"index;comment:是否校验权限"` CheckLogin bool `json:"checkLogin" gorm:"index;comment:是否校验登录"` }
func GetAPIById ¶
@author: [guoxf](https://github.com/guoxf) @function: GetAPIById @description: 根据id获取api @param: id string @return: api API , err error
func GetAllAPIs ¶
@author: [guoxf](https://github.com/guoxf) @function: GetAllAPIs @description: 获取所有API @return: apis []API , err error
type APP ¶
type APP struct { model.Model Name string `json:"name" gorm:"size:200;index"` Entry string `json:"entry" gorm:"size:200;"` DevEntry string `json:"devEntry" gorm:"size:200;"` TestEntry string `json:"testEntry" gorm:"size:200;"` PreEntry string `json:"preEntry" gorm:"size:200;"` DisplayName string `json:"displayName" gorm:"size:100;comment:显示名字"` Credentials bool `json:"credentials"` Description string `json:"description" gorm:"size:200;"` Props []APPProp `json:"props"` Container string `json:"container" gorm:"size:100"` ActiveRule string `json:"activeRule" gorm:"size:200"` Enable bool `json:"enable"` }
func GetAPPById ¶
func GetAllAPPs ¶
type CasbinRule ¶
type CasbinRule struct { ID uint `gorm:"primaryKey;autoIncrement"` Ptype string `json:"ptype" gorm:"column:ptype;size:8;uniqueIndex:unique_index"` RoleID string `json:"roleID" gorm:"column:v0;size:36;uniqueIndex:unique_index"` Path string `json:"path" gorm:"column:v1;size:200;uniqueIndex:unique_index"` Method string `json:"method" gorm:"column:v2;size:10;uniqueIndex:unique_index"` CheckAuth string `gorm:"column:v3;size:10;uniqueIndex:unique_index"` V4 string `gorm:"size:128;uniqueIndex:unique_index"` V5 string `gorm:"size:128;uniqueIndex:unique_index"` }
func GetPolicyPathByRoleID ¶
func GetPolicyPathByRoleID(roleID string) (pathMaps []*CasbinRule)
@author: [guoxf](https://github.com/guoxf) @function: GetPolicyPathByRoleID @description: 获取权限列表 @param: roleID string @return: pathMaps []CasbinRule
func (CasbinRule) TableName ¶
func (CasbinRule) TableName() string
type CheckRegisterWithWechatResp ¶
type CheckRegisterWithWechatResp struct { model.CommonResponse Data bool `json:"data"` }
type Menu ¶
type Menu struct { model.Model Level uint32 `json:"level"` ParentID string `json:"parentID" gorm:"comment:父菜单ID"` Path string `json:"path" gorm:"size:200;comment:路由path"` Name string `json:"name" gorm:"size:100;comment:路由name"` Hidden bool `json:"hidden" gorm:"comment:是否在列表隐藏"` Component string `json:"component" gorm:"size:200;comment:对应前端文件路径"` Sort int32 `json:"sort" gorm:"comment:排序标记"` Cache bool `json:"cache" gorm:"comment:是否缓存"` DefaultMenu bool `json:"defaultMenu" gorm:"comment:是否是基础路由(开发中)"` Title string `json:"title" gorm:"size:100;comment:菜单名"` Icon string `json:"icon" gorm:"size:100;comment:菜单图标"` CloseTab bool `json:"closeTab" gorm:"comment:自动关闭tab"` Children []*Menu `json:"children" gorm:"-"` Parameters []*MenuParameter `json:"parameters"` MenuFuncs []*MenuFunc `json:"menuFuncs"` }
func GetAllMenus ¶
func GetBaseMenuTree ¶
@author: [guoxf](https://github.com/guoxf) @function: GetBaseMenuTree @description: 获取基础路由树 @return: err error, menus []Menu
func GetInfoList ¶
@author: [guoxf](https://github.com/guoxf) @function: GetInfoList @description: 获取路由分页 @return: err error, list interface{}, total int64
func GetMenuByID ¶
@author: [guoxf](https://github.com/guoxf) @function: GetMenuByID @description: 返回当前选中menu @param: id uint @return: err error, menu Menu
func GetMenuTree ¶
@author: [guoxf](https://github.com/guoxf) @function: GetMenuTree @description: 获取动态菜单树 @param: roleID string @return: err error, menus []RoleMenu
type MenuFunc ¶
type MenuFunc struct { model.Model MenuID string `json:"menuID" gorm:"index"` Name string `json:"name" gorm:"size:100;comment:功能名称"` Title string `json:"title" gorm:"size:100;comment:显示名称"` Hidden bool `json:"hidden" gorm:"comment:是否隐藏"` MenuFuncApis []MenuFuncApi `json:"menuFuncApis"` }
func PBToMenuFuncs ¶
type MenuFuncApi ¶
type MenuFuncApi struct { model.Model MenuFuncID string `json:"menuFuncID" gorm:"index"` APIID string `json:"apiID" gorm:"column:api_id"` API *API `json:"apiInfo"` }
func PBToMenuFuncApis ¶
func PBToMenuFuncApis(params []*apipb.MenuFuncApi) []MenuFuncApi
type MenuParameter ¶
type MenuParameter struct { model.Model MenuID string `json:"menuID" gorm:"index"` Type string `json:"type" gorm:"size:50;comment:地址栏携带参数为params还是query"` Key string `json:"key" gorm:"size:100;comment:地址栏携带参数的key"` Value string `json:"value" gorm:"size:200;comment:地址栏携带参数的值"` }
func PBToMenuParameters ¶
func PBToMenuParameters(params []*apipb.MenuParameter) []*MenuParameter
type QueryAPIRequest ¶
type QueryAPIRequest struct { model.CommonRequest Path string `json:"path" form:"path" path:"path"` Method string `json:"method" form:"method" path:"method"` Group string `json:"group" form:"group" path:"group"` CheckAuth int `json:"checkAuth" form:"checkAuth" path:"checkAuth"` CheckLogin int `json:"checkLogin" form:"checkLogin" path:"checkLogin"` }
type QueryAPIResponse ¶
type QueryAPIResponse struct { model.CommonResponse Data []API `json:"data"` }
type QueryAPPRequest ¶
type QueryAPPRequest struct { model.CommonRequest Name string `json:"name" form:"name" uri:"name"` Enable int `json:"enable" form:"enable" uri:"enable"` }
type QueryAPPResponse ¶
type QueryAPPResponse struct { model.CommonResponse Data []*APP `json:"data"` }
type QueryMenuRequest ¶
type QueryMenuRequest struct { model.CommonRequest Name string `json:"name" form:"name" uri:"name"` Path string `json:"path" form:"path" uri:"path"` ParentID string `json:"group" form:"group" uri:"group"` Title string `json:"title" form:"title" uri:"title"` Level uint `json:"level" form:"level" uri:"level"` }
type QueryMenuResponse ¶
type QueryMenuResponse struct { model.CommonResponse Data []*Menu `json:"data"` }
type QueryTenantRequest ¶
type QueryTenantRequest struct { model.CommonRequest Name string `json:"name" form:"name" uri:"name"` }
type QueryTenantResponse ¶
type QueryTenantResponse struct { model.CommonResponse Data []*Tenant `json:"data"` }
type QueryTitleRequest ¶
type QueryTitleRequest struct { model.CommonRequest Name string `json:"name" form:"name" uri:"name"` DisplayName string `json:"displayName" form:"displayName" uri:"displayName"` }
type QueryTitleResponse ¶
type QueryTitleResponse struct { model.CommonResponse Data []Title `json:"data"` }
type QueryUserRequest ¶
type QueryUserRequest struct { model.CommonRequest UserName string `json:"userName" form:"userName" uri:"userName"` Nickname string `json:"nickname" form:"nickname" uri:"nickname"` IDCard string `json:"idCard" form:"idCard" uri:"idCard"` Mobile string `json:"mobile" form:"mobile" uri:"mobile"` WechatID string `json:"wechatID" form:"wechatID" uri:"wechatID"` Title string `json:"title" form:"title" uri:"title"` UserNames string `json:"userNames" form:"userNames" uri:"userNames"` }
type QueryUserResponse ¶
type QueryUserResponse struct { model.CommonResponse Data []*User `json:"data"` }
type Role ¶
type Role struct { model.Model TenantID *sql.NullString `json:"tenantID" gorm:"index;size:36"` Name string `json:"name" gorm:"size:100;comment:角色名"` ParentID string `json:"parentID" gorm:"comment:父角色ID"` Children []*Role `json:"children" gorm:"-"` RoleMenus []*RoleMenu `json:"roleMenus"` DefaultRouter string `json:"defaultRouter" gorm:"size:100;comment:默认菜单;default:dashboard"` Description string `json:"description" gorm:"size:200;"` CanDel bool `json:"canDel" gorm:"default:1"` Tenant *Tenant `json:"tenant"` }
func CopyRole ¶
func CopyRole(copyInfo RoleCopyResponse) (*Role, error)
@author: [guoxf](https://github.com/guoxf) @function: CopyRole @description: 复制一个角色 @param: copyInfo RoleCopyResponse @return: err error, role Role
func GetAllRole ¶
GetAllRole 获取所有用户 containerCommon true-包含公共角色 false-不包含公共角色 公共角色定义:不设置租户的角色
func GetFullRoleByID ¶
func GetRoleByID ¶
type RoleCopyResponse ¶
type RoleMenu ¶
type RoleMenu struct { model.Model RoleID string `json:"roleID" gorm:"index;comment:角色ID"` MenuID string `json:"menuID" gorm:"index;comment:菜单ID"` Funcs string `json:"funcs" gorm:"size:500;comment:功能名称,多个以逗号隔开"` Menu *Menu `json:"menu"` }
func GetMenuRole ¶
@author: [guoxf](https://github.com/guoxf) @function: GetMenuRole @description: 查看当前角色权限树 @param: info *request.GetAuthorityId @return: err error, menus []RoleMenu
func PBToRoleMenus ¶
type RoleResponse ¶
type RoleResponse struct {
Role Role `json:"role"`
}
type Tenant ¶
type Tenant struct { model.Model // 租户名称 // required: true // @inject_tag: validate:"required" Name string `json:"name" validate:"required" gorm:"index;size:200"` // 联系人 Contact string `json:"contact" gorm:"size:100"` // 联系人电话 CellPhone string `json:"cellPhone" gorm:"size:50"` // 地址 Address string `json:"address" gorm:"size:200"` // 业务范围 BusinessScope string `json:"businessScope" gorm:"size:200"` // 占地面积 AreaCovered string `json:"areaCovered" gorm:"size:100"` // 人员规模 StaffSize int32 `json:"staffSize"` Enable bool `json:"enable" gorm:"index"` }
func GetAllTenant ¶
func GetTenantByID ¶
func PBToTenant ¶
func PBToTenant(in *apipb.TenantInfo) *Tenant
type Title ¶
type Title struct { model.TenantModel Name string `json:"name" gorm:"size:100;"` DisplayName string `json:"displayName" gorm:"size:100;"` Description string `json:"description" gorm:"size:200;"` }
func GetAllTitles ¶
func GetTitleById ¶
type User ¶
type User struct { model.TenantModel //账号信息 UserName string `json:"userName" validate:"required" gorm:"size:50;index;comment:用户登录名"` Password string `json:"password" gorm:"size:200;comment:用户登录密码"` Nickname string `json:"nickname" validate:"required" gorm:"size:100;index;default:未设置;comment:用户昵称" ` UserRoles []*UserRole `json:"userRoles"` RoleIDs []string `json:"roleIDs" gorm:"-"` WechatUnionID string `json:"wechatUnionID" gorm:"size:36;index;comment:微信UionID"` WechatOpenID string `json:"wechatOpenID" gorm:"size:36;index;comment:微信OpenID"` //用户类型 Type int32 `json:"type" gorm:"index"` Group string `json:"group" gorm:"index;size:50"` //启用账号后可以登录系统 Enable bool `json:"enable" gorm:"index"` // 用户名/密码错误次数 ErrNumber int32 `json:"errNumber"` // 随着密码/用户名错误次数增加,用户被锁定的时间也就越长,一天最多错误5次 LockedExpired int64 `json:"lockedExpired"` // 强制修改密码 ForceChangePwd bool `json:"forceChangePwd"` // 用户过期时间 Expired int64 `json:"expired"` ChangePwdErrNum int32 `json:"changePwdErrNum"` ChangePwdLockedExpired int64 `json:"changePwdLockedExpired"` CanDel bool `json:"canDel"` //基本信息 Email string `json:"email" gorm:"size:100;"` Mobile string `json:"mobile" gorm:"size:20;index;comment:手机号"` IDCard string `json:"idCard" gorm:"size:18;index;comment:身份证号"` Avatar string `json:"avatar" gorm:"size:200;comment:用户头像"` EID string `json:"eid" gorm:"size:50;"` Title string `json:"title" gorm:"size:100;comment:职位"` Description string `json:"description" gorm:"size:200;"` RealName string `json:"realName" gorm:"index;size:50;"` Gender bool `json:"gender"` Country string `json:"country" gorm:"size:100;"` //国家 Province string `json:"province" gorm:"size:100;"` //省份 City string `json:"city" gorm:"size:100;"` //城市 County string `json:"county" gorm:"size:100;"` //区县 Birthday int64 `json:"birthday"` //公历出生日期包含时分 Tenant *Tenant `json:"tenant"` }
func GetAllUsers ¶
func GetAllUsers(req *apipb.GetAllUsersRequest) (users []*User, err error)
@author: [guoxf](https://github.com/guoxf) @function: GetAllUsers @description: 获取所有User @return: users []User , err error
func GetUserById ¶
@author: [guoxf](https://github.com/guoxf) @function: GetUserById @description: 根据id获取user @param: id uint @return: user User , err error
func UserProfileToUser ¶ added in v1.1.3
func UserProfileToUser(in *apipb.UserProfile) *User
func (User) GetRoleIDs ¶
type UserProfile ¶
type UserProfile struct { apipb.UserProfile Menus []*Menu `json:"menus"` }