1234567891011121314151617 |
- package unity
- import (
- "github.com/gin-gonic/gin"
- )
- func GetUId(c *gin.Context) (int, string) {
- //mustGet := c.MustGet("user")
- value, exists := c.Get("user")
- if exists {
- users := value.(map[string]interface{})
- id := int(users["ID"].(float64))
- name := users["username"].(string)
- return id, name
- }
- return 0, ""
- }
|