system

package
v0.0.0-...-38e5134 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 11, 2022 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package system @program: arco-design-pro-gin @author: [lliuhuan](https://github.com/lliuhuan) @create: 2022-01-09 21:20

Package system @program: arco-design-pro-gin @author: [lliuhuan](https://github.com/lliuhuan) @create: 2021-12-10 17:54

Package system @program: arco-design-pro-gin @author: [lliuhuan](https://github.com/lliuhuan) @create: 2021-12-20 12:47

Package system @program: arco-design-pro-gin @author: [lliuhuan](https://github.com/lliuhuan) @create: 2021-12-14 10:25

Package system @program: arco-design-pro-gin @author: [lliuhuan](https://github.com/lliuhuan) @create: 2021-12-14 10:26

Package system @program: arco-design-pro-gin @author: [lliuhuan](https://github.com/lliuhuan) @create: 2021-12-10 17:57

Package system @program: arco-design-pro-gin @author: [lliuhuan](https://github.com/lliuhuan) @create: 2022-01-07 16:55

Index

Constants

This section is empty.

Variables

View Source
var ApiServiceApp = new(ApiService)
View Source
var AuthorityServiceApp = new(AuthorityService)
View Source
var CasbinServiceApp = new(CasbinService)
View Source
var MenuServiceApp = new(MenuService)

Functions

func LoadAll

func LoadAll()

Types

type ApiService

type ApiService struct {
}

func (*ApiService) CreateApi

func (apiService *ApiService) CreateApi(api system.SysApi) (err error)

CreateApi 新增基础api @author: [lliuhuan](https://github.com/lliuhuan) @function: CreateApi @description: 新增基础api @param: api model.SysApi @return: err error

func (*ApiService) DeleteApi

func (apiService *ApiService) DeleteApi(api system.SysApi) (err error)

DeleteApi 删除基础api @author: [lliuhuan](https://github.com/lliuhuan) @function: DeleteApi @description: 删除基础api @param: api model.SysApi @return: err error

func (*ApiService) DeleteApiByIds

func (apiService *ApiService) DeleteApiByIds(ids []string) (err error)

func (*ApiService) DeleteApisByIds

func (apiService *ApiService) DeleteApisByIds(ids request.IdsReq) (err error)

DeleteApisByIds 删除选中API @author: [lliuhuan](https://github.com/lliuhuan) @function: DeleteApis @description: 删除选中API @param: apis []model.SysApi @return: err error

func (*ApiService) GetAPIInfoList

func (apiService *ApiService) GetAPIInfoList(api system.SysApi, info request.PageInfo, order string, desc bool) (err error, list interface{}, total int64)

GetAPIInfoList 分页获取数据 @author: [lliuhuan](https://github.com/lliuhuan) @function: GetAPIInfoList @description: 分页获取数据 @param: api model.SysApi, info request.PageInfo, order string, desc bool @return: err error

func (*ApiService) GetAllApis

func (apiService *ApiService) GetAllApis() (err error, apis []system.SysApi)

GetAllApis 获取所有的api @author: [lliuhuan](https://github.com/lliuhuan) @function: GetAllApis @description: 获取所有的api @return: err error, apis []model.SysApi

func (*ApiService) GetApiById

func (apiService *ApiService) GetApiById(id float64) (err error, api system.SysApi)

GetApiById 根据id获取api @author: [lliuhuan](https://github.com/lliuhuan) @function: GetApiById @description: 根据id获取api @param: id float64 @return: err error, api model.SysApi

func (*ApiService) UpdateApi

func (apiService *ApiService) UpdateApi(api system.SysApi) (err error)

UpdateApi 根据id更新api @author: [lliuhuan](https://github.com/lliuhuan) @function: UpdateApi @description: 根据id更新api @param: api model.SysApi @return: err error

type AuthorityService

type AuthorityService struct {
}

func (*AuthorityService) CopyAuthority

func (authorityService *AuthorityService) CopyAuthority(copyInfo response.SysAuthorityCopyResponse) (err error, authority system.SysAuthority)

CopyAuthority 复制一个角色 @author: [lliuhuan](https://github.com/lliuhuan) @function: CopyAuthority @description: 复制一个角色 @param: copyInfo response.SysAuthorityCopyResponse @return: err error, authority model.SysAuthority

func (*AuthorityService) CreateAuthority

func (authorityService *AuthorityService) CreateAuthority(auth system.SysAuthority) (err error, authority system.SysAuthority)

CreateAuthority 创建一个角色 @author: [lliuhuan](https://github.com/lliuhuan) @function: CreateAuthority @description: 创建一个角色 @param: auth model.SysAuthority @return: err error, authority model.SysAuthority

func (*AuthorityService) DeleteAuthority

func (authorityService *AuthorityService) DeleteAuthority(auth *system.SysAuthority) (err error)

DeleteAuthority 删除角色 @author: [lliuhuan](https://github.com/lliuhuan) @function: DeleteAuthority @description: 删除角色 @param: auth *model.SysAuthority @return: err error

func (*AuthorityService) GetAuthorityInfo

func (authorityService *AuthorityService) GetAuthorityInfo(auth system.SysAuthority) (err error, sa system.SysAuthority)

GetAuthorityInfo 获取所有角色信息 @author: [lliuhuan](https://github.com/lliuhuan) @function: GetAuthorityInfo @description: 获取所有角色信息 @param: auth model.SysAuthority @return: err error, sa model.SysAuthority

func (*AuthorityService) GetAuthorityInfoList

func (authorityService *AuthorityService) GetAuthorityInfoList(info request.PageInfo) (err error, list interface{}, total int64)

GetAuthorityInfoList 分页获取数据 @author: [lliuhuan](https://github.com/lliuhuan) @function: GetAuthorityInfoList @description: 分页获取数据 @param: info request.PageInfo @return: err error, list interface{}, total int64

func (*AuthorityService) SetDataAuthority

func (authorityService *AuthorityService) SetDataAuthority(auth system.SysAuthority) error

SetDataAuthority 设置角色资源权限 @author: [lliuhuan](https://github.com/lliuhuan) @function: SetDataAuthority @description: 设置角色资源权限 @param: auth model.SysAuthority @return: error

func (*AuthorityService) SetMenuAuthority

func (authorityService *AuthorityService) SetMenuAuthority(auth *system.SysAuthority) error

SetMenuAuthority 菜单与角色绑定 @author: [lliuhuan](https://github.com/lliuhuan) @function: SetMenuAuthority @description: 菜单与角色绑定 @param: auth *model.SysAuthority @return: error

func (*AuthorityService) UpdateAuthority

func (authorityService *AuthorityService) UpdateAuthority(auth system.SysAuthority) (err error, authority system.SysAuthority)

UpdateAuthority 更改一个角色 @author: [lliuhuan](https://github.com/lliuhuan) @function: UpdateAuthority @description: 更改一个角色 @param: auth model.SysAuthority @return: err error, authority model.SysAuthority

type BaseMenuService

type BaseMenuService struct {
}

func (*BaseMenuService) DeleteBaseMenu

func (baseMenuService *BaseMenuService) DeleteBaseMenu(id float64) (err error)

DeleteBaseMenu 删除基础路由 @author: [lliuhuan](https://github.com/lliuhuan) @function: DeleteBaseMenu @description: 删除基础路由 @param: id float64 @return: err error

func (*BaseMenuService) DeleteBaseMenus

func (baseMenuService *BaseMenuService) DeleteBaseMenus(ids []float64) (res response.SysBaseMenuDelete)

DeleteBaseMenus 删除基础路由 @author: [lliuhuan](https://github.com/lliuhuan) @function: DeleteBaseMenu @description: 删除基础路由 @param: id float64 @return: err error

func (*BaseMenuService) GetBaseMenuById

func (baseMenuService *BaseMenuService) GetBaseMenuById(id float64) (err error, menu system.SysBaseMenu)

GetBaseMenuById 返回当前选中menu @author: [lliuhuan](https://github.com/lliuhuan) @function: GetBaseMenuById @description: 返回当前选中menu @param: id float64 @return: err error, menu model.SysBaseMenu

func (*BaseMenuService) UpdateBaseMenu

func (baseMenuService *BaseMenuService) UpdateBaseMenu(menu system.SysBaseMenu) (err error)

UpdateBaseMenu 更新路由 @author: [lliuhuan](https://github.com/lliuhuan) @function: UpdateBaseMenu @description: 更新路由 @param: menu model.SysBaseMenu @return: err error

type CasbinService

type CasbinService struct {
}

func (*CasbinService) Casbin

func (casbinService *CasbinService) Casbin() *casbin.SyncedEnforcer

func (*CasbinService) ClearCasbin

func (casbinService *CasbinService) ClearCasbin(v int, p ...string) bool

ClearCasbin 清除匹配的权限 @author: [lliuhuan](https://github.com/lliuhuan) @function: ClearCasbin @description: 清除匹配的权限 @param: v int, p ...string @return: bool

func (*CasbinService) GetPolicyPathByAuthorityId

func (casbinService *CasbinService) GetPolicyPathByAuthorityId(authorityId string) (pathMaps []request.CasbinInfo)

GetPolicyPathByAuthorityId 获取权限列表 @author: [lliuhuan](https://github.com/lliuhuan) @function: GetPolicyPathByAuthorityId @description: 获取权限列表 @param: authorityId string @return: pathMaps []request.CasbinInfo

func (*CasbinService) UpdateCasbin

func (casbinService *CasbinService) UpdateCasbin(authorityId string, casbinInfos []request.CasbinInfo) error

UpdateCasbin 更新casbin权限

func (*CasbinService) UpdateCasbinApi

func (casbinService *CasbinService) UpdateCasbinApi(oldPath string, newPath string, oldMethod string, newMethod string) error

UpdateCasbinApi API更新随动 @author: [lliuhuan](https://github.com/lliuhuan) @function: UpdateCasbinApi @description: API更新随动 @param: oldPath string, newPath string, oldMethod string, newMethod string @return: error

type InitDBService

type InitDBService struct{}

func (*InitDBService) InitDB

func (initDBService *InitDBService) InitDB(conf request.InitDB) error

InitDB 创建数据库并初始化 总入口 @author: [lliuhuan](https://github.com/lliuhuan)

type JwtService

type JwtService struct {
}

func (*JwtService) GetRedisJWT

func (jwtService *JwtService) GetRedisJWT(userName string) (err error, redisJWT string)

GetRedisJWT 从redis取jwt @author: [lliuhuan](https://github.com/lliuhuan) @function: GetRedisJWT @description: 从redis取jwt @param: userName string @return: err error, redisJWT string

func (*JwtService) IsBlacklist

func (jwtService *JwtService) IsBlacklist(jwt string) bool

IsBlacklist 判断JWT是否在黑名单内部 @author: [lliuhuan](https://github.com/lliuhuan) @function: IsBlacklist @description: 判断JWT是否在黑名单内部 @param: jwt string @return: bool

func (*JwtService) JsonInBlacklist

func (jwtService *JwtService) JsonInBlacklist(jwtList system.JwtBlacklist) (err error)

func (*JwtService) SetRedisJWT

func (jwtService *JwtService) SetRedisJWT(jwt string, userName string) (err error)

SetRedisJWT jwt存入redis并设置过期时间 @author: [lliuhuan](https://github.com/lliuhuan) @function: SetRedisJWT @description: jwt存入redis并设置过期时间 @param: jwt string, userName string @return: err error

type MenuService struct {
}
func (menuService *MenuService) AddBaseMenu(menu system.SysBaseMenu) error

AddBaseMenu 添加基础路由 @author: [lliuhuan](https://github.com/lliuhuan) @function: AddBaseMenu @description: 添加基础路由 @param: menu model.SysBaseMenu @return: error

func (menuService *MenuService) AddMenuAuthority(menus []system.SysBaseMenu, authorityId string) (err error)

AddMenuAuthority 为角色增加menu树 @author: [lliuhuan](https://github.com/lliuhuan) @function: AddMenuAuthority @description: 为角色增加menu树 @param: menus []model.SysBaseMenu, authorityId string @return: err error

func (menuService *MenuService) GetBaseMenuTree() (err error, menus []system.SysBaseMenu)

GetBaseMenuTree 获取基础路由树 @author: [lliuhuan](https://github.com/lliuhuan) @function: GetBaseMenuTree @description: 获取基础路由树 @return: err error, menus []model.SysBaseMenu

func (menuService *MenuService) GetInfoList() (err error, list interface{}, total int64)

GetInfoList 获取路由分页 @author: [lliuhuan](https://github.com/lliuhuan) @function: GetInfoList @description: 获取路由分页 @return: err error, list interface{}, total int64

func (menuService *MenuService) GetMenuAuthority(info *request.GetAuthorityId) (err error, menus []system.SysMenu)

GetMenuAuthority 查看当前角色树 @author: [lliuhuan](https://github.com/lliuhuan) @function: GetMenuAuthority @description: 查看当前角色树 @param: info *request.GetAuthorityId @return: err error, menus []model.SysMenu

func (menuService *MenuService) GetMenuTree(authorityId string) (err error, menus []system.SysMenu)

GetMenuTree 获取动态菜单树 @author: [lliuhuan](https://github.com/lliuhuan) @function: GetMenuTree @description: 获取动态菜单树 @param: authorityId string @return: err error, menus []model.SysMenu

type OperationRecordService

type OperationRecordService struct {
}

func (*OperationRecordService) CreateSysOperationRecord

func (operationRecordService *OperationRecordService) CreateSysOperationRecord(sysOperationRecord system.SysOperationRecord) (err error)

CreateSysOperationRecord 创建接口请求信息 @author: [lliuhuan](https://github.com/lliuhuan) @function: CreateSysOperationRecord @description: 创建记录 @param: sysOperationRecord model.SysOperationRecord @return: err erro

func (*OperationRecordService) DeleteSysOperationRecord

func (operationRecordService *OperationRecordService) DeleteSysOperationRecord(sysOperationRecord system.SysOperationRecord) (err error)

DeleteSysOperationRecord 删除操作记录 @author: [lliuhuan](https://github.com/lliuhuan) @function: DeleteSysOperationRecord @description: 删除操作记录 @param: sysOperationRecord model.SysOperationRecord @return: err error

func (*OperationRecordService) DeleteSysOperationRecordByIds

func (operationRecordService *OperationRecordService) DeleteSysOperationRecordByIds(ids request.IdsReq) (err error)

DeleteSysOperationRecordByIds 批量删除记录 @author: [lliuhuan](https://github.com/lliuhuan) @function: DeleteSysOperationRecordByIds @description: 批量删除记录 @param: ids request.IdsReq @return: err error

func (*OperationRecordService) GetSysOperationRecord

func (operationRecordService *OperationRecordService) GetSysOperationRecord(id uint) (err error, sysOperationRecord system.SysOperationRecord)

GetSysOperationRecord 根据id获取单条操作记录 @author: [lliuhuan](https://github.com/lliuhuan) @function: DeleteSysOperationRecord @description: 根据id获取单条操作记录 @param: id uint @return: err error, sysOperationRecord model.SysOperationRecord

func (*OperationRecordService) GetSysOperationRecordInfoList

func (operationRecordService *OperationRecordService) GetSysOperationRecordInfoList(info systemReq.SysOperationRecordSearch) (err error, list interface{}, total int64)

GetSysOperationRecordInfoList 分页获取操作记录列表 @author: [lliuhuan](https://github.com/lliuhuan) @function: GetSysOperationRecordInfoList @description: 分页获取操作记录列表 @param: info systemReq.SysOperationRecordSearch @return: err error, list interface{}, total int64

type SysService

type SysService struct {
}

func (*SysService) GetServerInfo

func (sysService *SysService) GetServerInfo() (server *utils.Server, err error)

GetServerInfo 获取服务器信息 @author: [lliuhuan](https://github.com/lliuhuan) @function: GetServerInfo @description: 获取服务器信息 @return: server *utils.Server, err error

type UserService

type UserService struct {
}

func (*UserService) ChangePassword

func (userService *UserService) ChangePassword(u *system.SysUser, newPassword string) (err error, userInter *system.SysUser)

ChangePassword 修改用户密码 @author: [lliuhuan](https://github.com/lliuhuan) @function: ChangePassword @description: 修改用户密码 @param: u *model.SysUser, newPassword string @return: err error, userInter *model.SysUser

func (*UserService) DeleteUser

func (userService *UserService) DeleteUser(id float64) (err error)

DeleteUser 删除用户 @author: [lliuhuan](https://github.com/lliuhuan) @function: DeleteUser @description: 删除用户 @param: id float64 @return: err error

func (*UserService) FindUserById

func (userService *UserService) FindUserById(id int) (err error, user *system.SysUser)

FindUserById 通过id获取用户信息 @author: [lliuhuan](https://github.com/lliuhuan) @function: FindUserById @description: 通过id获取用户信息 @param: id int @return: err error, user *model.SysUser

func (*UserService) FindUserByUuid

func (userService *UserService) FindUserByUuid(uuid string) (err error, user *system.SysUser)

FindUserByUuid 通过uuid获取用户信息 @author: [lliuhuan](https://github.com/lliuhuan) @function: FindUserByUuid @description: 通过uuid获取用户信息 @param: uuid string @return: err error, user *model.SysUser

func (*UserService) GetUserInfo

func (userService *UserService) GetUserInfo(uuid uuid.UUID) (err error, user system.SysUser)

GetUserInfo 获取用户信息 @author: [lliuhuan](https://github.com/lliuhuan) @function: GetUserInfo @description: 获取用户信息 @param: uuid uuid.UUID @return: err error, user system.SysUser

func (*UserService) GetUserInfoList

func (userService *UserService) GetUserInfoList(info request.PageInfo) (err error, list interface{}, total int64)

GetUserInfoList 分页查询用户数据 @author: [lliuhuan](https://github.com/lliuhuan) @function: GetUserInfoList @description: 分页获取数据 @param: info request.PageInfo @return: err error, list interface{}, total int64

func (*UserService) Login

func (userService *UserService) Login(u *system.SysUser) (err error, userInter *system.SysUser)

Login 用户登陆 @author: [lliuhuan](https://github.com/lliuhuan) @function: Login @description: 用户登录 @param: u *model.SysUser @return: err error, userInter *model.SysUser

func (*UserService) Register

func (userService *UserService) Register(u system.SysUser) (err error, userInter system.SysUser)

Register 用户注册 @author: [lliuhuan](https://github.com/lliuhuan) @function: Register @description: 用户注册 @param: u model.SysUser @return: err error, userInter model.SysUser

func (*UserService) ResetPassword

func (userService *UserService) ResetPassword(ID uint) (err error)

ResetPassword 修改用户密码 @author: [lliuhuan](https://github.com/lliuhuan) @function: resetPassword @description: 修改用户密码 @param: ID uint @return: err error

func (*UserService) SetUserAuthorities

func (userService *UserService) SetUserAuthorities(id uint, authorityIds []string) (err error)

SetUserAuthorities 设置一个用户的权限 @author: [lliuhuan](https://github.com/lliuhuan) @function: SetUserAuthorities @description: 设置一个用户的权限 @param: id uint, authorityIds []string @return: err error

func (*UserService) SetUserAuthority

func (userService *UserService) SetUserAuthority(id uint, uuid uuid.UUID, authorityId string) (err error)

SetUserAuthority 设置一个用户的权限 @author: [lliuhuan](https://github.com/lliuhuan) @function: SetUserAuthority @description: 设置一个用户的权限 @param: uuid uuid.UUID, authorityId string @return: err error

func (*UserService) SetUserInfo

func (userService *UserService) SetUserInfo(reqUser system.SysUser) (err error, user system.SysUser)

SetUserInfo 设置用户信息 @author: [lliuhuan](https://github.com/lliuhuan) @function: SetUserInfo @description: 设置用户信息 @param: reqUser model.SysUser @return: err error, user model.SysUser

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL