refactor: 重构项目结构并优化路由组织
All checks were successful
部署开发环境 / deploy-dev (push) Successful in 8m30s

This commit is contained in:
2025-10-28 12:20:16 +08:00
parent ea9ecb770d
commit 819a2eb8ec
7 changed files with 50 additions and 33 deletions

26
internal/db/redis.go Normal file
View File

@@ -0,0 +1,26 @@
package db
import (
"dypid/config"
"dypid/global"
"fmt"
"github.com/redis/go-redis/v9"
)
// InitRedis 初始化Redis
func InitRedis() {
global.RDB = redis.NewClient(&redis.Options{
Addr: config.APPConfig.Redis.Host,
Password: config.APPConfig.Redis.Password,
DB: config.APPConfig.Redis.DB,
//PoolSize: 1000,
})
ping := global.RDB.Ping(global.RCtx)
if ping.Err() != nil {
fmt.Println("Redis初始化失败", ping.Err())
panic("Redis error")
} else {
fmt.Println("Redis初始化完成")
}
}