新增几大中心功能

This commit is contained in:
Administrator
2026-04-23 15:29:07 +08:00
parent 5c2a146a44
commit c6354ee065
123 changed files with 13074 additions and 229 deletions

View File

@@ -0,0 +1,37 @@
package app
import (
"errors"
"git.echol.cn/loser/Go-Web-Template/server/global"
appModel "git.echol.cn/loser/Go-Web-Template/server/model/app"
"git.echol.cn/loser/Go-Web-Template/server/model/common/response"
"git.echol.cn/loser/Go-Web-Template/server/utils"
"github.com/gin-gonic/gin"
"gorm.io/gorm"
)
type AppAuthApi struct{}
func (a *AppAuthApi) Me(c *gin.Context) {
uid := utils.GetUserID(c)
if uid == 0 {
response.NoAuth("未登录或非法访问,请登录", c)
return
}
var user appModel.AppUser
if err := global.GVA_DB.First(&user, uid).Error; err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
response.NoAuth("用户不存在", c)
return
}
response.FailWithMessage(err.Error(), c)
return
}
response.OkWithData(gin.H{
"id": user.ID,
"uuid": user.UUID,
"username": user.Username,
"enable": user.Enable,
}, c)
}