Files
SingBox-Gopanel/internal/handler/user_handler.go
CN-JS-HuiBai 1ed31b9292
All checks were successful
build / build (api, amd64, linux) (push) Successful in -47s
build / build (api, arm64, linux) (push) Successful in -48s
build / build (api.exe, amd64, windows) (push) Successful in -47s
first commit
2026-04-17 09:49:16 +08:00

26 lines
445 B
Go

//go:build ignore
package handler
import (
"net/http"
"xboard-go/internal/database"
"xboard-go/internal/model"
"github.com/gin-gonic/gin"
)
func UserInfo(c *gin.Context) {
userID, _ := c.Get("user_id")
var user model.User
if err := database.DB.Preload("Plan").First(&user, userID).Error; err != nil {
c.JSON(http.StatusNotFound, gin.H{"message": "用户不存在"})
return
}
c.JSON(http.StatusOK, gin.H{
"data": user,
})
}