feat: 初次启动

This commit is contained in:
Blizzard
2026-04-27 21:23:13 +08:00
parent e515f6a287
commit bb8ad4d515
148 changed files with 8602 additions and 5678 deletions
+6 -13
View File
@@ -5,26 +5,19 @@ package svc
import (
"sundynix-micro-go/app/system/api/internal/config"
"sundynix-micro-go/app/system/rpc/systemservice"
"github.com/zeromicro/go-zero/core/logx"
"gorm.io/driver/mysql"
"gorm.io/gorm"
"github.com/zeromicro/go-zero/zrpc"
)
type ServiceContext struct {
Config config.Config
DB *gorm.DB
Config config.Config
SystemRpc systemservice.SystemService
}
func NewServiceContext(c config.Config) *ServiceContext {
db, err := gorm.Open(mysql.Open(c.DB.DataSource), &gorm.Config{})
if err != nil {
logx.Errorf("连接数据库失败: %v", err)
panic(err)
}
return &ServiceContext{
Config: c,
DB: db,
Config: c,
SystemRpc: systemservice.NewSystemService(zrpc.MustNewClient(c.SystemRpc)),
}
}