[feat] 重新梳理依赖

This commit is contained in:
2024-05-09 13:15:24 +08:00
parent 9172fb2f34
commit bddd754869
28 changed files with 341 additions and 1075 deletions
+7 -7
View File
@@ -3,7 +3,7 @@ package base
import (
"github.com/samber/lo"
"git.fsdpf.net/go/contracts"
"git.fsdpf.net/go/req"
)
type user struct {
@@ -12,7 +12,7 @@ type user struct {
username string
nickname string
roles []string
runtime contracts.UserRuntime
runtime req.UserRuntime
}
func (this user) ID() int64 {
@@ -47,19 +47,19 @@ func (this user) IsAnonymous() bool {
return this.id == 0
}
func (this user) Runtime() contracts.UserRuntime {
func (this user) Runtime() req.UserRuntime {
return this.runtime
}
// 获取匿名用户
func GetAnonymous(opts ...contracts.UserRuntimeOption) contracts.User {
func GetAnonymous(opts ...req.UserRuntimeOption) req.User {
u := user{
id: 0,
uuid: "00000000-0000-0000-0000-000000000000",
username: "anonymous",
nickname: "匿名者",
roles: []string{"00000000-0000-0000-0000-000000000000"},
runtime: contracts.UserRuntime{},
runtime: req.UserRuntime{},
}
for _, opt := range opts {
@@ -70,14 +70,14 @@ func GetAnonymous(opts ...contracts.UserRuntimeOption) contracts.User {
}
// 系统用户
func GetSystemUser(opts ...contracts.UserRuntimeOption) contracts.User {
func GetSystemUser(opts ...req.UserRuntimeOption) req.User {
u := user{
id: -1,
uuid: "ffffffff-ffff-ffff-ffff-ffffffffffff",
username: "system",
nickname: "系统",
roles: []string{"ffffffff-ffff-ffff-ffff-ffffffffffff"},
runtime: contracts.UserRuntime{},
runtime: req.UserRuntime{},
}
for _, opt := range opts {