package server import ( "fmt" "net/http" "strconv" "time" ) type AuthServer struct { } func NewAuthLogic() *AuthServer { return &AuthServer{} } func (l *AuthServer) GetChatUserId(r *http.Request) int64 { query := r.URL.Query() if query != nil && query["userId"] != nil { var uid = fmt.Sprintf("%v", query["userId"]) atoi, err := strconv.Atoi(uid) if err != nil { return time.Now().UnixMilli() } return int64(atoi) } return time.Now().UnixMilli() }