CroupierCroupier
指南
架构
API 参考
开发
  • C++ SDK
  • Go SDK
  • Java SDK
  • JavaScript SDK
  • Python SDK
  • C# SDK
  • Lua SDK
分析
GitHub
指南
架构
API 参考
开发
  • C++ SDK
  • Go SDK
  • Java SDK
  • JavaScript SDK
  • Python SDK
  • C# SDK
  • Lua SDK
分析
GitHub
  • API 参考

    • API 概览
    • gRPC API
    • REST API
  • 运维管理

    • 运维 API
    • 运维核心 API
    • 运维简化 API
    • 管理员 API
    • 备份 API
    • 配置 API
    • 迁移 API
    • 监控 API
    • 节点 API
  • Agent & 函数

    • Agent API
    • 函数 API
    • 任务 API
    • /api/pack.html
    • Schema API
  • 认证与权限

    • 认证 API
    • 审批 API
    • 审计 API
    • 限流 API
  • 游戏管理

    • 游戏 API
    • 玩家 API
    • 实体 API
    • /api/component.html
    • 注册表 API
  • 消息通知

    • 消息 API
    • 告警 API
    • 支持 API
    • 工单 API
    • 反馈 API
  • 平台与集成

    • 平台 API
    • Provider API
    • 证书 API
    • 存储 API
  • 数据分析

    • 数据分析 API
    • 行为分析 API
    • 分析概览 API
    • 支付分析 API
    • 留存分析 API
  • 其他

    • 分配 API
    • 常见问题
    • 元数据 API
    • 配置文件 API
    • Workspace API

认证 API

1. "用户登录"

  1. route definition
  • Url: /api/v1/auth/login
  • Method: POST
  • Request: LoginRequest
  • Response: LoginResponse
  1. request definition
type LoginRequest struct {
	Username string `json:"username"` // 用户名
	Password string `json:"password"` // 密码
}
  1. response definition
type LoginResponse struct {
	Token string `json:"token"`
	User UserInfo `json:"user"`
}

type UserInfo struct {
	Username string `json:"username"`
	Roles []string `json:"roles"`
	Nickname string `json:"nickname,omitempty"`
	Email string `json:"email,omitempty"`
	Phone string `json:"phone,omitempty"`
}

2. "用户登出"

  1. route definition
  • Url: /api/v1/auth/logout
  • Method: POST
  • Request: LogoutRequest
  • Response: LogoutResponse
  1. request definition
type LogoutRequest struct {
}
  1. response definition
type LogoutResponse struct {
}

3. "权限校验"

  1. route definition
  • Url: /api/v1/auth/check
  • Method: POST
  • Auth: Bearer Token
  • Request: CheckRequest
  • Response: CheckResponse
  1. request definition
type CheckRequest struct {
	Resource string `json:"resource"` // 例如 roles、games、functions
	Action   string `json:"action"`   // 例如 read、write、manage
	GameID   string `json:"gameId,omitempty"`
	Env      string `json:"env,omitempty"`
}
  1. response definition
type CheckResponse struct {
	Allowed bool   `json:"allowed"`
	Reason  string `json:"reason,omitempty"`
}

4. "批量权限校验"

  1. route definition
  • Url: /api/v1/auth/check/batch
  • Method: POST
  • Auth: Bearer Token
  • Request: BatchCheckRequest
  • Response: BatchCheckResponse
  1. request definition
type BatchCheckRequest struct {
	Checks []CheckRequest `json:"checks"`
}
  1. response definition
type BatchCheckResponse struct {
	Results []CheckResponse `json:"results"`
}

说明

  • 校验基于当前登录用户在数据库中的角色和权限,不依赖前端缓存。
  • gameId 与 env 字段当前保留用于兼容前端请求结构,现阶段权限判断主要按资源和动作执行。
在 GitHub 上编辑此页
最后更新: 2026/3/19 10:26
Next
审批 API