Files
Message-Push-Nest/pkg/app/request.go
T

17 lines
259 B
Go
Raw Normal View History

2023-12-30 17:40:20 +08:00
package app
import (
"fmt"
"github.com/gin-gonic/gin"
)
// 从请求中获取当前用户
func GetCurrentUserName(c *gin.Context) string {
userName, ok := c.Get("currentUserName")
if !ok {
return ""
} else {
return fmt.Sprintf("%s", userName)
}
}