40 lines
1.3 KiB
Plaintext
Raw Normal View History

2025-01-20 01:55:44 +08:00
syntax = "v1"
2025-01-20 17:36:03 +08:00
import "common.api"
2025-01-20 01:55:44 +08:00
type SetUserGameScoreRequest {
2025-01-20 14:37:14 +08:00
Score uint64 `json:"score"`
}
type RankingData {
Nickname string `json:"nickname" db:"nickname"` // 昵称
Avatar string `json:"avatar" db:"avatar"` // 头像
Score uint32 `json:"score" db:"score"` // 得分
UserId uint64 `json:"-" db:"app_user_id"` // 用户 ID
Rank uint32 `json:"rank" db:"t_rank"` // 排名
Self bool `json:"self" db:"-"` // 是否是自己
2025-01-20 01:55:44 +08:00
}
2025-01-21 10:02:04 +08:00
type RankingResponse {
Base
RankingData []RankingData `json:"data"`
}
2025-01-20 14:37:14 +08:00
@server(
2025-01-20 01:55:44 +08:00
group: game
prefix: /v1/game // 对当前 Foo 语法块下的所有路由,新增 /v1 路由前缀,不需要则请删除此行
2025-01-20 14:37:14 +08:00
jwt: Auth // 开启 jwt 认证
2025-01-20 01:55:44 +08:00
timeout: 3s // 对当前 Foo 语法块下的所有路由进行超时配置,不需要则请删除此行
maxBytes: 1048576 // 对当前 Foo 语法块下的所有路由添加请求体大小控制,单位为 byte,goctl 版本 >= 1.5.0 才支持
)
2025-01-20 14:37:14 +08:00
service game_open_api-api {
2025-01-20 01:55:44 +08:00
@handler rankingList
2025-01-20 14:37:14 +08:00
get /ranking/list returns ([]RankingData)
2025-01-20 01:55:44 +08:00
@handler rankingSetScore
2025-01-20 17:36:03 +08:00
post /ranking/set_score (SetUserGameScoreRequest) returns (Base)
2025-01-20 01:55:44 +08:00
}