2 Star 2 Fork 3

联犀/core

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
serviceContext.go 1.63 KB
一键复制 编辑 原始数据 按行查看 历史
杨磊 提交于 2024-10-10 21:56 . feat: 更新mod
package svc
import (
"gitee.com/unitedrhino/core/service/apisvr/exportMiddleware"
"gitee.com/unitedrhino/core/service/datasvr/internal/config"
"gitee.com/unitedrhino/core/service/datasvr/internal/repo/relationDB"
"gitee.com/unitedrhino/core/service/syssvr/client/common"
"gitee.com/unitedrhino/core/service/syssvr/client/log"
role "gitee.com/unitedrhino/core/service/syssvr/client/rolemanage"
tenant "gitee.com/unitedrhino/core/service/syssvr/client/tenantmanage"
user "gitee.com/unitedrhino/core/service/syssvr/client/usermanage"
"gitee.com/unitedrhino/core/service/syssvr/sysExport"
"gitee.com/unitedrhino/share/ctxs"
"gitee.com/unitedrhino/share/stores"
"github.com/zeromicro/go-zero/core/logx"
"github.com/zeromicro/go-zero/rest"
"github.com/zeromicro/go-zero/zrpc"
)
type ServiceContext struct {
Config config.Config
CheckTokenWare rest.Middleware
Slot sysExport.SlotCacheT
InitCtxsWare rest.Middleware
}
func NewServiceContext(c config.Config) *ServiceContext {
stores.InitConn(c.Database)
logx.Must(relationDB.Migrate(c.Database))
var ur user.UserManage
var ro role.RoleManage
ur = user.NewUserManage(zrpc.MustNewClient(c.SysRpc.Conf))
ro = role.NewRoleManage(zrpc.MustNewClient(c.SysRpc.Conf))
tm := tenant.NewTenantManage(zrpc.MustNewClient(c.SysRpc.Conf))
lo := log.NewLog(zrpc.MustNewClient(c.SysRpc.Conf))
Slot, err := sysExport.NewSlotCache(common.NewCommon(zrpc.MustNewClient(c.SysRpc.Conf)))
logx.Must(err)
return &ServiceContext{
Config: c,
CheckTokenWare: exportMiddleware.NewCheckTokenWareMiddleware(ur, ro, tm, lo).Handle,
InitCtxsWare: ctxs.InitMiddleware,
Slot: Slot,
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/unitedrhino/core.git
git@gitee.com:unitedrhino/core.git
unitedrhino
core
core
v0.2.2

搜索帮助