初始化v1

This commit is contained in:
2025-08-03 00:11:15 +08:00
commit b88c8b8afa
171 changed files with 22353 additions and 0 deletions

19
api/middleware/cors.go Normal file
View File

@@ -0,0 +1,19 @@
package middleware
import (
"github.com/gogf/gf/v2/net/ghttp"
)
// CORS 跨域处理中间件
func CORS(r *ghttp.Request) {
// 设置CORS头
r.Response.CORSDefault()
// 处理预检请求
if r.Method == "OPTIONS" {
r.Response.WriteHeader(200)
return
}
r.Middleware.Next()
}