service

package
v0.0.0-...-27e9f93 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2020 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearUserFromRedis

func ClearUserFromRedis(uid string) error

ClearUserFromRedis 清除登录信息

func CreateAuthAccount

func CreateAuthAccount(data *model.AuthAccountCreateReq) error

CreateAuthAccount 创建帐号

func FileExist

func FileExist(filename string) bool

FileExist 检查文件或目录是否存在

func GetAuth

func GetAuth(id string) (model.Auth, error)

GetAuth 获取指定ID认证帐号

func GetAuthWithRoles

func GetAuthWithRoles(id string) (model.Auth, error)

GetAuthWithRoles 获取指定ID认证帐号

func GetAuthWithUser

func GetAuthWithUser(id string) (model.Auth, error)

GetAuthWithUser 获取指定ID认证帐号及用户资料

func GetCurrentUser

func GetCurrentUser(c *gin.Context) (model.User, error)

GetCurrentUser 获取当前用户

func GetCurrentUserGroups

func GetCurrentUserGroups(c *gin.Context) ([]model.UserGroup, error)

GetCurrentUserGroups 获取当前用户组列表

func GetCurrentUserMenus

func GetCurrentUserMenus(c *gin.Context) ([]model.Menu, error)

GetCurrentUserMenus 获取当前用户菜单列表

func GetCurrentUserRoles

func GetCurrentUserRoles(c *gin.Context) ([]model.Role, error)

GetCurrentUserRoles 获取当前用户角色列表

func GetFileContentType

func GetFileContentType(file *os.File) (string, error)

GetFileContentType 获取文件类型

func GetFileHeaderContentType

func GetFileHeaderContentType(file *multipart.FileHeader) string

GetFileHeaderContentType 获取文件类型

func GetReqInfo

func GetReqInfo(c *gin.Context) model.ReqInfo

GetReqInfo 获取请求信息

func GetUser

func GetUser(id string) (model.User, error)

GetUser 获取指定ID用户

func GetUserFromRedis

func GetUserFromRedis(uid string) (model.UserCurrent, error)

GetUserFromRedis 从缓存中获取用户信息

func GetUserMenus

func GetUserMenus(user model.User) ([]model.Menu, error)

GetUserMenus 获取用户菜单(作废)

func HTTPAbortError

func HTTPAbortError(c *gin.Context, msg string, code int, err error)

HTTPAbortError 返回错误

func HTTPError

func HTTPError(c *gin.Context, msg string, code int, err error)

HTTPError 返回错误

func HTTPSuccess

func HTTPSuccess(c *gin.Context, msg string)

HTTPSuccess 返回成功

func ImageResize

func ImageResize(srcPath string, outPath string) error

ImageResize 图片处理 https://github.com/h2non/bimg(依赖libvips,不推荐) https://github.com/disintegration/imaging(推荐)

func MakeToken

func MakeToken(user *model.UserJWT) (int64, string, error)

MakeToken 创建JWT的TOKEN

func NewError

func NewError(msg string, code int, errs []error, c *gin.Context) model.HTTPError

NewError 创建错误对象

func RemoveDuplicateMenu

func RemoveDuplicateMenu(menus []model.Menu) []model.Menu

RemoveDuplicateMenu Menu去重(作废,已用IFUniqueItem接口实现)

func RolesToNames

func RolesToNames(roles []model.Role) []string

RolesToNames 获取角色名列表

func SaveFile

func SaveFile(c *gin.Context, file *multipart.FileHeader) (model.UploadRes, error)

SaveFile 保存文件

func SetUserToRedis

func SetUserToRedis(user *model.UserCurrent) error

SetUserToRedis 保存用户登录信息到redis

Types

type JWTClaims

type JWTClaims struct {
	UserID string `json:"uid" binding:"required"`
	jwt.StandardClaims
}

JWTClaims JWT加密的结构体

func ParseToken

func ParseToken(tokenString string) (*JWTClaims, error)

ParseToken 解析JWT的TOKEN

Jump to

Keyboard shortcuts

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