Files
2024-01-01 13:09:44 +08:00

17 lines
259 B
Go

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)
}
}