service

package
v0.0.0-...-5901162 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiService

type ApiService interface {
	CreateApi(ctx context.Context, req *model.CreateApiRequest) error
	GetApiById(ctx context.Context, id int) (*model.Api, error)
	UpdateApi(ctx context.Context, req *model.UpdateApiRequest) error
	DeleteApi(ctx context.Context, id int) error
	ListApis(ctx context.Context, req *model.ListApisRequest) (model.ListResp[*model.Api], error)
	GetApiStatistics(ctx context.Context) (*model.ApiStatistics, error)
}

func NewApiService

func NewApiService(l *zap.Logger, dao dao.ApiDAO) ApiService

type AuditService

type AuditService interface {
	CreateAuditLog(ctx context.Context, req *model.CreateAuditLogRequest) error
	CreateAuditLogAsync(ctx context.Context, req *model.CreateAuditLogRequest)
	BatchCreateAuditLogs(ctx context.Context, logs []model.AuditLog) error
	ListAuditLogs(ctx context.Context, req *model.ListAuditLogsRequest) (*model.ListResp[model.AuditLog], error)
	GetAuditLogDetail(ctx context.Context, id int) (*model.AuditLog, error)
	SearchAuditLogs(ctx context.Context, req *model.SearchAuditLogsRequest) (*model.ListResp[model.AuditLog], error)
	GetAuditStatistics(ctx context.Context) (*model.AuditStatistics, error)
	GetAuditTypes(ctx context.Context) ([]model.AuditTypeInfo, error)
	DeleteAuditLog(ctx context.Context, id int) error
	BatchDeleteAuditLogs(ctx context.Context, ids []int) error
	ArchiveAuditLogs(ctx context.Context, req *model.ArchiveAuditLogsRequest) error
	Close() error
}

func NewAuditService

func NewAuditService(dao dao.AuditDAO, logger *zap.Logger) AuditService

type RoleService

type RoleService interface {
	// 角色管理
	ListRoles(ctx context.Context, req *model.ListRolesRequest) (*model.ListResp[*model.Role], error)
	CreateRole(ctx context.Context, req *model.CreateRoleRequest) (*model.Role, error)
	UpdateRole(ctx context.Context, req *model.UpdateRoleRequest) (*model.Role, error)
	DeleteRole(ctx context.Context, id int) error
	GetRoleByID(ctx context.Context, id int) (*model.Role, error)

	// 角色权限管理
	AssignApisToRole(ctx context.Context, roleID int, apiIds []int) error
	RevokeApisFromRole(ctx context.Context, roleID int, apiIds []int) error
	GetRoleApis(ctx context.Context, roleID int) (*model.ListResp[*model.Api], error)

	// 用户角色管理
	AssignRolesToUser(ctx context.Context, userID int, roleIds []int, grantedBy int) error
	RevokeRolesFromUser(ctx context.Context, userID int, roleIds []int) error
	GetRoleUsers(ctx context.Context, roleID int) (*model.ListResp[*model.User], error)
	GetUserRoles(ctx context.Context, userID int) (*model.ListResp[*model.Role], error)

	// 权限检查
	CheckUserPermission(ctx context.Context, userID int, method, path string) (bool, error)
	GetUserPermissions(ctx context.Context, userID int) (*model.ListResp[*model.Api], error)
}

func NewRoleService

func NewRoleService(roleDao dao.RoleDAO, l *zap.Logger) RoleService

type SystemService

type SystemService interface {
	GetCurrentSystemInfo(ctx context.Context) (*model.System, error)
	GetSystemMetrics(ctx context.Context) (*model.System, error)
	RefreshSystemInfo(ctx context.Context) (*model.System, error)
}

func NewSystemService

func NewSystemService(l *zap.Logger, redis redis.Cmdable) SystemService

Jump to

Keyboard shortcuts

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