sys_service

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2022 License: MIT Imports: 9 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterArea

func RegisterArea(i IArea)

func RegisterBizCtx added in v0.2.0

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 RegisterSdkAliyun

func RegisterSdkAliyun(i ISdkAliyun)

func RegisterSdkBaidu

func RegisterSdkBaidu(i ISdkBaidu)

func RegisterSdkCtyun

func RegisterSdkCtyun(i ISdkCtyun)

func RegisterSdkHuawei

func RegisterSdkHuawei(i ISdkHuawei)

func RegisterSdkTencent

func RegisterSdkTencent(i ISdkTencent)

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) (*sys_model.AreaListRes, error)
	GetAreaById(ctx context.Context, id int64) *sys_entity.SysArea
	GetAreaByCode(ctx context.Context, areaCode string) *sys_entity.SysArea
}

func Area

func Area() IArea

type IBizCtx added in v0.2.0

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

func BizCtx added in v0.2.0

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 sys_enum_upload.EventStateEnum, hookFunc sys_model.FileHookFunc) int64
	UnInstallHook(savedHookId int64)
	CleanAllHook()
	Upload(ctx context.Context, in sys_model.FileUploadInput, userId int64) (*sys_model.FileUploadOutput, error)
	GetUploadFile(ctx context.Context, uploadId int64, userId int64, message ...string) (*sys_model.FileUploadOutput, error)
	SaveFile(ctx context.Context, storageAddr string, userId int64, info sys_model.FileUploadOutput) (*sys_entity.SysFile, error)
	UploadIDCard(ctx context.Context, in sys_model.OCRIDCardFileUploadInput, userId int64) (*sys_model.IDCardWithOCR, error)
	UploadBankCard(ctx context.Context, in sys_model.BankCardWithOCRInput, userId int64) (*sys_model.BankCardWithOCR, error)
	UploadBusinessLicense(ctx context.Context, in sys_model.OCRBusinessLicense, userId int64) (*sys_model.BusinessLicenseWithOCR, error)
	DownLoadFile(ctx context.Context, savePath string, url string) (string, error)
}

func File

func File() IFile

type IJwt

type IJwt interface {
	GenerateToken(user *sys_entity.SysUser) (*sys_model.TokenInfo, error)
	CreateToken(claims *sys_model.JwtCustomClaims) (string, error)
	RefreshToken(oldToken string, claims *sys_model.JwtCustomClaims) (string, error)
	CustomMiddleware(r *ghttp.Request)
	Middleware(r *ghttp.Request)
	ParseToken(tokenString string) (*sys_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 ISdkAliyun

type ISdkAliyun interface {
	GetAliyunSdkToken(ctx context.Context, tokenInfo sys_model.AliyunSdkConfToken, err error)
	GetAliyunSdkConfToken(ctx context.Context, identifier string) (tokenInfo *sys_model.AliyunSdkConfToken, err error)
	GetAliyunSdkConfList(ctx context.Context) (*[]sys_model.AliyunSdkConf, error)
	GetAliyunSdkConf(ctx context.Context, identifier string) (tokenInfo *sys_model.AliyunSdkConf, err error)
	SaveAliyunSdkConf(ctx context.Context, info sys_model.AliyunSdkConf, isCreate bool) (*sys_model.AliyunSdkConf, error)
	DeleteAliyunSdkConf(ctx context.Context, identifier string) (bool, error)
}

func SdkAliyun

func SdkAliyun() ISdkAliyun

type ISdkBaidu

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

func SdkBaidu

func SdkBaidu() ISdkBaidu

type ISdkCtyun

type ISdkCtyun interface {
	GetCtyunSdkConfList(ctx context.Context) (*[]sys_model.CtyunSdkConf, error)
	GetCtyunSdkConf(ctx context.Context, identifier string) (tokenInfo *sys_model.CtyunSdkConf, err error)
	SaveCtyunSdkConf(ctx context.Context, info sys_model.CtyunSdkConf, isCreate bool) (*sys_model.CtyunSdkConf, error)
	DeleteCtyunSdkConf(ctx context.Context, identifier string) (bool, error)
}

func SdkCtyun

func SdkCtyun() ISdkCtyun

type ISdkHuawei

type ISdkHuawei interface {
	GetHuaweiSdkConfToken(ctx context.Context, identifier string) (tokenInfo *sys_model.HuaweiSdkConfToken, err error)
	GetHuaweiSdkConfList(ctx context.Context) (*[]sys_model.HuaweiSdkConf, error)
	GetHuaweiSdkConf(ctx context.Context, identifier string) (tokenInfo *sys_model.HuaweiSdkConf, err error)
	SaveHuaweiSdkConf(ctx context.Context, info sys_model.HuaweiSdkConf, isCreate bool) (*sys_model.HuaweiSdkConf, error)
	DeleteHuaweiSdkConf(ctx context.Context, identifier string) (bool, error)
}

func SdkHuawei

func SdkHuawei() ISdkHuawei

type ISdkTencent

type ISdkTencent interface {
	GetTencentSdkConfToken(ctx context.Context, identifier string) (tokenInfo *sys_model.TencentSdkConfToken, err error)
	GetTencentSdkConfList(ctx context.Context) (*[]sys_model.TencentSdkConf, error)
	GetTencentSdkConf(ctx context.Context, identifier string) (tokenInfo *sys_model.TencentSdkConf, err error)
	SaveTencentSdkConf(ctx context.Context, info sys_model.TencentSdkConf, isCreate bool) (*sys_model.TencentSdkConf, error)
	DeleteTencentSdkConf(ctx context.Context, identifier string) (bool, error)
}

func SdkTencent

func SdkTencent() ISdkTencent

type ISysAuth

type ISysAuth interface {
	InstallHook(actionType sys_enum_auth.ActionTypeEnum, userType sys_enum_user.TypeEnum, hookFunc sys_model.AuthHookFunc) int64
	UnInstallHook(savedHookId int64)
	CleanAllHook()
	Login(ctx context.Context, req sys_model.LoginInfo, needCaptcha ...bool) (*sys_model.TokenInfo, error)
	InnerLogin(ctx context.Context, sysUserInfo *sys_entity.SysUser) (*sys_model.TokenInfo, error)
	LoginByMobile(ctx context.Context, req sys_model.LoginByMobileInfo) (*sys_model.TokenInfo, error)
	Register(ctx context.Context, info sys_model.SysUserRegister) (*sys_entity.SysUser, error)
	ForgotPassword(ctx context.Context, info sys_model.ForgotPassword) (int64, error)
	ResetPassword(ctx context.Context, password string, confirmPassword string, idKey string) (bool, error)
}

func SysAuth

func SysAuth() ISysAuth

type ISysLogs

type ISysLogs interface {
	Write(ctx context.Context, err error, info sys_entity.SysLogs) error
	Error(ctx context.Context, err error, info sys_entity.SysLogs) error
	ErrorSimple(ctx context.Context, err error, context string, category string) error
	Info(ctx context.Context, err error, info sys_entity.SysLogs) error
	InfoSimple(ctx context.Context, err error, context string, category string) error
	Warn(ctx context.Context, err error, info sys_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) (*sys_entity.SysMenu, error)
	SaveMenu(ctx context.Context, info sys_model.SysMenu) (*sys_entity.SysMenu, error)
}

func SysMenu

func SysMenu() ISysMenu

type ISysOrganization

type ISysOrganization interface {
	QueryOrganizationList(ctx context.Context, info sys_model.SearchParams) (*sysapi.OrganizationInfoListRes, error)
	GetOrganizationList(ctx context.Context, parentId int64, IsRecursive bool) (*[]sys_entity.SysOrganization, int, error)
	GetOrganizationTree(ctx context.Context, parentId int64) (*[]sys_model.SysOrganizationTree, error)
	CreateOrganizationInfo(ctx context.Context, info sys_model.SysOrganizationInfo) (*sys_entity.SysOrganization, error)
	UpdateOrganizationInfo(ctx context.Context, info sys_model.SysOrganizationInfo) (*sys_entity.SysOrganization, error)
	SaveOrganizationInfo(ctx context.Context, info sys_model.SysOrganizationInfo) (*sys_entity.SysOrganization, error)
	GetOrganizationInfo(ctx context.Context, id int64) (*sys_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) (*sys_entity.SysPermission, error)
	GetPermissionByName(ctx context.Context, permissionName string) (*sys_entity.SysPermission, error)
	QueryPermissionList(ctx context.Context, info sys_model.SearchParams) (*sysapi.SysPermissionInfoListRes, error)
	GetPermissionList(ctx context.Context, parentId int64, IsRecursive bool) (*[]sys_entity.SysPermission, error)
	GetPermissionTree(ctx context.Context, parentId int64) (*[]sys_model.SysPermissionTree, error)
	CreatePermission(ctx context.Context, info sys_model.SysPermission) (*sys_entity.SysPermission, error)
	UpdatePermission(ctx context.Context, info sys_model.SysPermission) (*sys_entity.SysPermission, error)
	SavePermission(ctx context.Context, info sys_model.SysPermission) (*sys_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 sys_model.SearchParams) (*sysapi.RoleListRes, error)
	Create(ctx context.Context, info sys_model.SysRole) (*sys_entity.SysRole, error)
	Update(ctx context.Context, info sys_model.SysRole) (*sys_entity.SysRole, error)
	Save(ctx context.Context, info sys_model.SysRole) (*sys_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) (*[]sys_model.SysUser, error)
	GetUserRoleList(ctx context.Context, userId int64) (*[]sys_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(event kyUser2.EventEnum, hookFunc sys_model.UserHookFunc) int64
	UnInstallHook(savedHookId int64)
	CleanAllHook()
	QueryUserList(ctx context.Context, info *sys_model.SearchParams, isExport bool) (response *sys_model.SysUserRes, err error)
	SetUserRoleIds(ctx context.Context, roleIds []int64, userId int64) (bool, error)
	CreateUser(ctx context.Context, info sys_model.UserInnerRegister, userState kyUser2.StateEnum, userType kyUser2.TypeEnum, customId ...int64) (*sys_model.SysUserRegisterRes, error)
	GetSysUserByUsername(ctx context.Context, username string) (*sys_entity.SysUser, error)
	HasSysUserByUsername(ctx context.Context, username string) bool
	GetSysUserById(ctx context.Context, userId int64) (*sys_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)
	UpdateUserPassword(ctx context.Context, info sys_model.UpdateUserPassword) (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