package common import ( "github.com/gin-gonic/gin" ) // GetAppUserID 从上下文获取前台用户 ID func GetAppUserID(c *gin.Context) uint { if userID, exists := c.Get("appUserId"); exists { return userID.(uint) } return 0 } // GetAppUsername 从上下文获取前台用户名 func GetAppUsername(c *gin.Context) string { if username, exists := c.Get("appUsername"); exists { return username.(string) } return "" }