service

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterArea

func RegisterArea(i IArea)

func RegisterBizCtx

func RegisterBizCtx(i IBizCtx)

func RegisterCaptcha

func RegisterCaptcha(i ICaptcha)

func RegisterCasbin

func RegisterCasbin(i ICasbin)

func RegisterFile

func RegisterFile(i IFile)

func RegisterJwt

func RegisterJwt(i IJwt)

func RegisterMiddleware

func RegisterMiddleware(i IMiddleware)

func RegisterSdkBaidu

func RegisterSdkBaidu(i ISdkBaidu)

func RegisterSysAudit

func RegisterSysAudit(i ISysAudit)

func RegisterSysAuth

func RegisterSysAuth(i ISysAuth)

func RegisterSysLogs

func RegisterSysLogs(i ISysLogs)

func RegisterSysMenu

func RegisterSysMenu(i ISysMenu)

func RegisterSysOrganization

func RegisterSysOrganization(i ISysOrganization)

func RegisterSysPermission

func RegisterSysPermission(i ISysPermission)

func RegisterSysRole

func RegisterSysRole(i ISysRole)

func RegisterSysSms

func RegisterSysSms(i ISysSms)

func RegisterSysUser

func RegisterSysUser(i ISysUser)

Types

type IArea

type IArea interface {
	GetAreaListByParentId(ctx context.Context, parentId int64) (*model.AreaListRes, error)
	GetAreaById(ctx context.Context, id int64) *entity.SysArea
	GetAreaByCode(ctx context.Context, areaCode string) *entity.SysArea
}

func Area

func Area() IArea

type IBizCtx

type IBizCtx interface {
	Init(r *ghttp.Request, customCtx *model.Context)
	Get(ctx context.Context) *model.Context
	SetUser(ctx context.Context, claimsUser *model.JwtCustomClaims)
}

func BizCtx

func BizCtx() IBizCtx

type ICaptcha

type ICaptcha interface {
	MakeCaptcha(ctx context.Context) error
	VerifyAndClear(_ *ghttp.Request, value string) bool
}

func Captcha

func Captcha() ICaptcha

type ICasbin

type ICasbin interface {
	Check() error
	Enforcer() *casbin.Enforcer
	Middleware(r *ghttp.Request)
	AddRoleForUserInDomain(userName string, roleName string, domain string) (bool, error)
	DeleteRoleForUserInDomain(userName, roleName string, domain string) (bool, error)
	DeleteRolesForUser(userName string, domain string) (bool, error)
	AddPermissionForUser(roleName, path, method string) (bool, error)
	AddPermissionsForUser(roleName string, path []string) (bool, error)
	DeletePermissionForUser(roleName, path, method string) (bool, error)
	DeletePermissionsForUser(roleName string) (bool, error)
	Enforce(userName, path, method string) (bool, error)
}

func Casbin

func Casbin() ICasbin

type IFile

type IFile interface {
	InstallHook(state kyEnum.UploadEventState, hookFunc model.FileHookFunc) int64
	UnInstallHook(savedHookId int64)
	CleanAllHook()
	Upload(ctx context.Context, in model.FileUploadInput, userId int64) (*model.FileUploadOutput, error)
	GetUploadFile(ctx context.Context, uploadId int64, userId int64, message ...string) (*model.FileUploadOutput, error)
	SaveFile(ctx context.Context, storageAddr string, userId int64, info model.FileUploadOutput) (*entity.SysFile, error)
	UploadIDCard(ctx context.Context, in model.OCRIDCardFileUploadInput, userId int64) (*model.IDCardWithOCR, error)
	UploadBankCard(ctx context.Context, in model.BankCardWithOCRInput, userId int64) (*model.BankCardWithOCR, error)
	UploadBusinessLicense(ctx context.Context, in model.OCRBusinessLicense, userId int64) (*model.BusinessLicenseWithOCR, error)
}

func File

func File() IFile

type IJwt

type IJwt interface {
	GenerateToken(user *entity.SysUser) (*model.TokenInfo, error)
	CreateToken(claims *model.JwtCustomClaims) (string, error)
	RefreshToken(oldToken string, claims *model.JwtCustomClaims) (string, error)
	CustomMiddleware(r *ghttp.Request)
	Middleware(r *ghttp.Request)
	ParseToken(tokenString string) (*model.JwtCustomClaims, error)
}

func Jwt

func Jwt() IJwt

type IMiddleware

type IMiddleware interface {
	Auth(r *ghttp.Request)
	CTX(r *ghttp.Request)
	CORS(r *ghttp.Request)
	ResponseHandler(r *ghttp.Request)
	Casbin(r *ghttp.Request)
}

func Middleware

func Middleware() IMiddleware

type ISdkBaidu

type ISdkBaidu interface {
	GetBaiduSdkConfToken(ctx context.Context, identifier string) (tokenInfo *model.BaiduSdkConfToken, err error)
	GetBaiduSdkConfList(ctx context.Context) (*[]model.BaiduSdkConf, error)
	GetBaiduSdkConf(ctx context.Context, identifier string) (*model.BaiduSdkConf, error)
	SaveBaiduSdkConf(ctx context.Context, info model.BaiduSdkConf, isCreate bool) (*model.BaiduSdkConf, error)
	DeleteBaiduSdkConf(ctx context.Context, identifier string) (bool, error)
	OCRBankCard(ctx context.Context, imageBase64 string) (*model.OCRBankCard, error)
	OCRIDCard(ctx context.Context, imageBase64 string, detectRisk string, idCardSide string) (*model.BaiduSdkOCRIDCard, error)
	OCRBusinessLicense(ctx context.Context, imageBase64 string) (*model.BusinessLicenseOCR, error)
}

func SdkBaidu

func SdkBaidu() ISdkBaidu

type ISysAudit

type ISysAudit interface {
	InstallHook(state kyAudit.EventState, category int, hookFunc model.AuditHookFunc) int64
	UnInstallHook(savedHookId int64)
	CleanAllHook()
	GetAuditList(ctx context.Context, category int, state int, pagination *model.Pagination) (*model.SysAuditListRes, error)
	GetAuditById(ctx context.Context, id int64) *entity.SysAudit
	GetAuditByLatestUnionId(ctx context.Context, unionId int64) *entity.SysAudit
	CreateAudit(ctx context.Context, info model.CreateSysAudit) (*entity.SysAudit, error)
	UpdateAudit(ctx context.Context, id int64, state int, replay string) (bool, error)
}

func SysAudit

func SysAudit() ISysAudit

type ISysAuth

type ISysAuth interface {
	InstallHook(state kyAuth.ActionType, userType userType.Code, hookFunc model.AuthHookFunc) int64
	UnInstallHook(savedHookId int64)
	CleanAllHook()
	Login(ctx context.Context, req model.LoginInfo, needCaptcha ...bool) (*model.TokenInfo, error)
	Register(ctx context.Context, info model.SysUserRegister) (*entity.SysUser, error)
	ForgotPassword(ctx context.Context, info model.ForgotPassword) (int64, error)
	ResetPassword(ctx context.Context, username string, password string, idKey string) (bool, error)
}

func SysAuth

func SysAuth() ISysAuth

type ISysLogs

type ISysLogs interface {
	Write(ctx context.Context, err error, info entity.SysLogs) error
	Error(ctx context.Context, err error, info entity.SysLogs) error
	ErrorSimple(ctx context.Context, err error, context string, category string) error
	Info(ctx context.Context, err error, info entity.SysLogs) error
	InfoSimple(ctx context.Context, err error, context string, category string) error
	Warn(ctx context.Context, err error, info entity.SysLogs) error
	WarnSimple(ctx context.Context, err error, context string, category string) error
}

func SysLogs

func SysLogs() ISysLogs

type ISysMenu

type ISysMenu interface {
	GetMenuById(ctx context.Context, menuId int64) (*entity.SysMenu, error)
	SaveMenu(ctx context.Context, info model.SysMenu) (*entity.SysMenu, error)
}

func SysMenu

func SysMenu() ISysMenu

type ISysOrganization

type ISysOrganization interface {
	QueryOrganizationList(ctx context.Context, info model.SearchFilter) (*sysapi.OrganizationInfoListRes, error)
	GetOrganizationList(ctx context.Context, parentId int64, IsRecursive bool) (*[]entity.SysOrganization, int, error)
	GetOrganizationTree(ctx context.Context, parentId int64) (*[]model.SysOrganizationTree, error)
	CreateOrganizationInfo(ctx context.Context, info model.SysOrganizationInfo) (*entity.SysOrganization, error)
	UpdateOrganizationInfo(ctx context.Context, info model.SysOrganizationInfo) (*entity.SysOrganization, error)
	SaveOrganizationInfo(ctx context.Context, info model.SysOrganizationInfo) (*entity.SysOrganization, error)
	GetOrganizationInfo(ctx context.Context, id int64) (*entity.SysOrganization, error)
	DeleteOrganizationInfo(ctx context.Context, id int64) (bool, error)
}

func SysOrganization

func SysOrganization() ISysOrganization

type ISysPermission

type ISysPermission interface {
	GetPermissionById(ctx context.Context, permissionId int64) (*entity.SysPermission, error)
	GetPermissionByName(ctx context.Context, permissionName string) (*entity.SysPermission, error)
	QueryPermissionList(ctx context.Context, info model.SearchFilter) (*sysapi.SysPermissionInfoListRes, error)
	GetPermissionList(ctx context.Context, parentId int64, IsRecursive bool) (*[]entity.SysPermission, error)
	GetPermissionTree(ctx context.Context, parentId int64) (*[]model.SysPermissionTree, error)
	CreatePermission(ctx context.Context, info model.SysPermission) (*entity.SysPermission, error)
	UpdatePermission(ctx context.Context, info model.SysPermission) (*entity.SysPermission, error)
	SavePermission(ctx context.Context, info model.SysPermission) (*entity.SysPermission, error)
	DeletePermission(ctx context.Context, permissionId int64) (bool, error)
}

func SysPermission

func SysPermission() ISysPermission

type ISysRole

type ISysRole interface {
	QueryRoleList(ctx context.Context, info model.SearchFilter) (*sysapi.RoleListRes, error)
	Create(ctx context.Context, info model.SysRole) (*entity.SysRole, error)
	Update(ctx context.Context, info model.SysRole) (*entity.SysRole, error)
	Save(ctx context.Context, info model.SysRole) (*entity.SysRole, error)
	Delete(ctx context.Context, roleId int64) (bool, error)
	SetRoleForUser(ctx context.Context, roleId int64, userId int64) (bool, error)
	RemoveRoleForUser(ctx context.Context, roleId int64, userId int64) (bool, error)
	GetRoleUsers(ctx context.Context, roleId int64) (*[]model.SysUser, error)
	GetUserRoleList(ctx context.Context, userId int64) (*[]entity.SysRole, error)
	SetRolePermissions(ctx context.Context, roleId int64, permissionIds []int64) (bool, error)
	GetRolePermissions(ctx context.Context, roleId int64) ([]int64, error)
}

func SysRole

func SysRole() ISysRole

type ISysSms

type ISysSms interface{}

func SysSms

func SysSms() ISysSms

type ISysUser

type ISysUser interface {
	InstallHook(state kyEnum.UserEventState, hookFunc model.UserHookFunc) int64
	UnInstallHook(savedHookId int64)
	CleanAllHook()
	QueryUserList(ctx context.Context, info *model.SearchFilter, isExport bool) (response *model.SysUserRes, err error)
	SetUserRoleIds(ctx context.Context, roleIds []int64, userId int64) (bool, error)
	CreateUser(ctx context.Context, info model.UserInnerRegister, userState kyEnum.UserState, userType kyEnum.UserType, customId ...int64) (*model.SysUserRegisterRes, error)
	GetSysUserByUsername(ctx context.Context, username string) (*entity.SysUser, error)
	HasSysUserByUsername(ctx context.Context, username string) bool
	GetSysUserById(ctx context.Context, userId int64) (*entity.SysUser, error)
	SetUserPermissionIds(ctx context.Context, userId int64, permissionIds []int64) (bool, error)
	GetUserPermissionIds(ctx context.Context, userId int64) ([]int64, error)
	SetUsername(ctx context.Context, newUsername string) (bool, error)
}

func SysUser

func SysUser() ISysUser

Jump to

Keyboard shortcuts

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