feat: minilogin改造
This commit is contained in:
@@ -3,15 +3,18 @@ package svc
|
||||
import (
|
||||
plantModel "sundynix-micro-go/app/plant/model"
|
||||
"sundynix-micro-go/app/plant/rpc/internal/config"
|
||||
"sundynix-micro-go/app/system/rpc/systemservice"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
"gorm.io/driver/mysql"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type ServiceContext struct {
|
||||
Config config.Config
|
||||
DB *gorm.DB
|
||||
Config config.Config
|
||||
DB *gorm.DB
|
||||
SystemRpc systemservice.SystemService
|
||||
}
|
||||
|
||||
func NewServiceContext(c config.Config) *ServiceContext {
|
||||
@@ -55,5 +58,9 @@ func NewServiceContext(c config.Config) *ServiceContext {
|
||||
logx.Errorf("数据库迁移失败: %v", err)
|
||||
}
|
||||
|
||||
return &ServiceContext{Config: c, DB: db}
|
||||
// 初始化 System RPC 客户端
|
||||
sysRpc := systemservice.NewSystemService(zrpc.MustNewClient(c.SystemRpc))
|
||||
logx.Info("[plant-rpc] ✅ SystemRpc 已连接")
|
||||
|
||||
return &ServiceContext{Config: c, DB: db, SystemRpc: sysRpc}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user