package handlers import ( "go-msa-auth/internal/services" "net/http" "github.com/gin-gonic/gin" ) // AuthHandler 处理授权请求 func AuthHandler(c *gin.Context) { var req services.AuthRequest // 解析 JSON 请求 if err := c.ShouldBindJSON(&req); err != nil { c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid request format"}) return } // 调用业务逻辑 resp := services.HandleAuth(req) // 返回响应 c.JSON(http.StatusOK, resp) }