refactor: separate backend domains and storage adapters

This commit is contained in:
2026-08-14 01:37:56 +08:00
parent e6775f0966
commit 8c4c6ba661
102 changed files with 6644 additions and 5735 deletions
+26
View File
@@ -0,0 +1,26 @@
package handler
import (
"net/http"
"kra/internal/server/httpx"
"kra/internal/service"
"github.com/gin-gonic/gin"
)
type Session struct{ settings *service.SettingsService }
func NewSession(settings *service.SettingsService) *Session { return &Session{settings: settings} }
func (h *Session) Logout(c *gin.Context) {
token := c.GetHeader("x-token")
if token == "" {
token, _ = c.Cookie("x-token")
}
if err := h.settings.BlacklistToken(c.Request.Context(), token); err != nil {
httpx.Fail(c, "退出失败")
return
}
http.SetCookie(c.Writer, &http.Cookie{Name: "x-token", Value: "", Path: "/", MaxAge: -1, HttpOnly: true})
httpx.OK(c)
}