57 lines
1.1 KiB
Plaintext
57 lines
1.1 KiB
Plaintext
syntax = "v1"
|
|
|
|
info (
|
|
title: "钱包服务"
|
|
desc: "处理钱包充值相关。ID 字段(int64)以 string 传输"
|
|
author: "Asadz"
|
|
version: "1.0"
|
|
)
|
|
|
|
import "common.api"
|
|
|
|
type (
|
|
WalletBalance {
|
|
Balance string `json:"balance"`
|
|
FrozenBalance string `json:"frozenBalance"`
|
|
}
|
|
Transaction {
|
|
Id int64 `json:"id,string"`
|
|
Type string `json:"type"`
|
|
Amount string `json:"amount"`
|
|
Description string `json:"description"`
|
|
OrderId string `json:"orderId,optional"`
|
|
CreatedAt string `json:"createdAt"`
|
|
}
|
|
TransactionListResp {
|
|
Items []Transaction `json:"items"`
|
|
Meta PageMeta `json:"meta"`
|
|
}
|
|
TopupReq {
|
|
Amount string `json:"amount"`
|
|
Method string `json:"method"`
|
|
}
|
|
)
|
|
|
|
@server (
|
|
prefix: api/v1/wallet
|
|
group: wallet
|
|
)
|
|
service wallet-api {
|
|
@doc "获取余额"
|
|
@handler GetBalance
|
|
get /balance (EmptyResp) returns (WalletBalance)
|
|
|
|
@doc "获取流水"
|
|
@handler ListTransactions
|
|
get /transactions (PageReq) returns (TransactionListResp)
|
|
|
|
@doc "充值"
|
|
@handler Topup
|
|
post /topup (TopupReq) returns (EmptyResp)
|
|
|
|
@doc "提现"
|
|
@handler Withdraw
|
|
post /withdraw (TopupReq) returns (EmptyResp)
|
|
}
|
|
|