tianyuan-api-server/apps/gateway/gateway.api
2024-10-15 17:19:23 +08:00

303 lines
7.3 KiB
Plaintext

syntax = "console"
//---------------------------- Base ------------------------
type (
healthResp {
time string `json:"time"`
}
)
@server (
group: base
prefix: /api/console/base
)
service gateway-api {
@handler health
get /health returns (healthResp)
}
//--------------------------- Auth ------------------------
type (
LoginReq {
username string `json:"username"`
password string `json:"password"`
}
phoneLoginReq {
phone string `json:"phone"`
code string `json:"code"`
}
RegisterReq {
username string `json:"username"`
password string `json:"password"`
confirmPassword string `json:"confirmPassword"`
phone string `json:"phone"`
code string `json:"code"`
}
GetVerifyCodeReq {
phone string `json:"phone"`
actionType string `json:"actionType"`
}
)
@server (
group: auth
prefix: /api/console/auth
)
service gateway-api {
@handler registerUser
post /register (RegisterReq)
@handler loginUser
post /login (LoginReq)
@handler phoneLoginUser
post /phoneLogin (phoneLoginReq)
@handler getVerifyCode
post /getVerifyCode (GetVerifyCodeReq)
@handler Logout
post /logout
}
//------------------------------ User -----------------------------
type (
enterpriseAuthReq {
enterpriseName string `json:"enterpriseName"`
creditCode string `json:"creditCode"`
legalPerson string `json:"legalPerson"`
businessLicense string `json:"businessLicense"`
enterpriseContact string `json:"enterpriseContact"`
}
UserInfoResp {
username string `json:"username"`
phone string `json:"phone"`
enterpriseAuthStatus string `json:"enterpriseAuthStatus"`
enterpriseName string `json:"enterpriseName"`
creditCode string `json:"creditCode"`
legalPerson string `json:"legalPerson"`
}
UploadBusinessLicenseResp {
url string `json:"url"`
enterpriseName string `json:"enterpriseName"`
creditCode string `json:"creditCode"`
legalPerson string `json:"legalPerson"`
}
secretInfoResp {
AccessId string `json:"accessId"`
AccessKey string `json:"accessKey"`
}
)
@server (
group: user
prefix: /api/console/user
middleware: AuthInterceptor
)
service gateway-api {
@handler getUserInfo
get /info returns (UserInfoResp)
@handler enterpriseAuth
post /enterpriseAuth (enterpriseAuthReq)
@handler UploadBusinessLicense
post /businessLicenseUpload returns (UploadBusinessLicenseResp)
@handler GetSecretInfo
post /getSecretInfo returns (secretInfoResp)
}
type (
GetProductByIdReq {
ProductId int64 `path:"productId"`
}
GetProductByIdResp {
ProductItem
}
GetProductListReq {
Page int64 `form:"page"`
PageSize int64 `form:"pageSize"`
}
GetProductListResp {
Total int64 `json:"total"`
List []ProductItem `json:"list"`
}
ProductItem {
ProductId int64 `json:"productId"`
ProductName string `json:"productName"`
ProductCode string `json:"productCode"`
ProductDescription string `json:"productDescription"`
ProductContent string `json:"productContent"`
ProductGroup string `json:"productGroup"`
ProductPrice float64 `json:"productPrice"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
)
@server (
group: product
prefix: /api/console/product
middleware: AuthInterceptor
)
service gateway-api {
@handler getProductById
get /:productId (GetProductByIdReq) returns (GetProductByIdResp)
@handler getProductList
get /list (GetProductListReq) returns (GetProductListResp)
}
type (
// 添加用户产品请求
AddUserProductReq {
ProductId int64 `json:"productId"`
}
// 删除用户产品请求
DeleteUserProductReq {
Id int64 `json:"id"`
}
// 分页查询用户产品列表请求
GetUserProductListReq {
Page int64 `form:"page"`
PageSize int64 `form:"pageSize"`
}
// 分页查询用户产品列表响应
GetUserProductListResp {
Total int64 `json:"total"`
List []UserProductItem `json:"list"`
}
// 用户产品条目
UserProductItem {
Id int64 `json:"id"` // 用户产品ID
ProductId int64 `json:"productId"` // 产品ID
ProductName string `json:"productName"` // 产品名称
ProductCode string `json:"productCode"` // 产品编号
ProductDescription string `json:"productDescription"` // 产品简介
ProductGroup string `json:"productGroup"` // 产品分类
ProductPrice float64 `json:"productPrice"` // 产品价格
CreatedAt string `json:"createdAt"` // 创建时间
UpdatedAt string `json:"updatedAt"` // 更新时间
}
)
@server (
group: userProduct
prefix: /api/console/user-product
middleware: AuthInterceptor
)
service gateway-api {
@handler getUserProductList
get /userProductList (GetUserProductListReq) returns (GetUserProductListResp)
}
@server (
group: userProduct
prefix: /api/console/user-product
middleware: AuthInterceptor,EntAuthInterceptor
)
service gateway-api {
@handler addUserProduct
post /userProductAdd (AddUserProductReq)
@handler deleteUserProduct
delete /userProductDel/:id (DeleteUserProductReq)
}
type (
AddWhitelistReq {
Ip string `json:"ip"`
}
DeleteWhitelistReq {
Id int64 `json:"id"`
}
GetWhitelistListReq {
Page int64 `form:"page"`
PageSize int64 `form:"pageSize"`
}
GetWhitelistListResp {
Total int64 `json:"total"`
List []WhitelistItem `json:"list"`
}
WhitelistItem {
Id int64 `json:"id"` // 用户产品ID
WhitelistIp string `json:"whiteIp"` // 产品名称
CreatedAt string `json:"createdAt"` // 创建时间
UpdatedAt string `json:"updatedAt"` // 更新时间
}
)
@server (
group: whitelistr
prefix: /api/console/whitelist
middleware: AuthInterceptor
)
service gateway-api {
@handler getWhitelistList
get /getWhitelistList (GetWhitelistListReq) returns (GetUserProductListResp)
}
@server (
group: whitelistr
prefix: /api/console/whitelist
middleware: AuthInterceptor,EntAuthInterceptor
)
service gateway-api {
@handler addWhitelist
post /addWhitelist (AddWhitelistReq)
@handler deleteWhitelist
delete /delWhitelist (DeleteWhitelistReq)
}
type (
AliTopUpRequest {
amount int64 `json:"amount"`
}
AliTopUpResponse {
payUrl string `json:"payUrl"`
}
GetTopUpListReq {
Page int64 `form:"page"`
PageSize int64 `form:"pageSize"`
}
GetTopUpListResp {
Total int64 `json:"total"`
List []TopUpItem `json:"list"`
}
TopUpItem {
Id int64 `json:"id"` // 主键ID
UserId int64 `json:"user_id"` // 用户ID
TransactionId string `json:"transaction_id"` // 交易ID
OutTradeNo string `json:"out_trade_no"` // 外部订单号
Amount float64 `json:"amount"` // 充值金额
PaymentMethod int64 `json:"payment_method"` // 支付方式
CreatedAt string `json:"created_at"` // 创建时间
UpdatedAt string `json:"updated_at"` // 更新时间
}
)
@server (
group: topup
prefix: /api/console/topup
middleware: AuthInterceptor,EntAuthInterceptor
)
service gateway-api {
@handler aliTopUp
post /aliTopUp (AliTopUpRequest) returns (AliTopUpResponse)
@handler topList
get /topUpList (GetTopUpListReq) returns (GetTopUpListResp)
}
@server (
group: topup
prefix: /api/console/topup
)
service gateway-api {
@handler aliTopUpCallback
post /aliTopUpCallback
}