初始化项目框架,完成部分接口开发

This commit is contained in:
2025-07-10 21:04:29 +08:00
commit b2871ec0d2
168 changed files with 6399 additions and 0 deletions

View File

@ -0,0 +1,20 @@
package middleware
import (
"server/utility/i18n"
"github.com/gogf/gf/v2/net/ghttp"
)
// Language 语言检测中间件
// 从请求头或查询参数中检测语言设置,并设置到上下文中
func Language(r *ghttp.Request) {
// 获取语言设置
lang := i18n.GetLanguage(r.GetCtx())
// 将语言设置到上下文中,供后续使用
r.SetCtxVar("language", lang)
// 继续下一个中间件
r.Middleware.Next()
}