tianyuan-api-server/apps/admin/admin.api

193 lines
4.9 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

syntax = "v1"
info (
title: "Enterprise API"
desc: "API for managing enterprise reviews and authentication"
author: "Your Name"
date: "2024-09-25"
)
type (
LoginReq {
Username string `json:"username"`
Password string `json:"password"`
}
LoginResp {}
)
type (
GetPendingEnterpriseReq {
Page int64 `form:"page"`
PageSize int64 `form:"pageSize"`
}
GetPendingEnterpriseResp {
Total int64 `json:"total"`
List []EnterpriseItem `json:"list"`
}
ReviewEnterpriseReq {
EnterpriseID int64 `json:"enterpriseId"`
Status string `json:"status"`
Remarks string `json:"remarks"`
}
ReviewEnterpriseResp {}
)
type EnterpriseItem {
Id int64 `json:"id"` // 企业ID
EnterpriseName string `json:"enterpriseName"` // 企业名称
CreditCode string `json:"creditCode"` // 企业信用代码
LegalPerson string `json:"legalPerson"` // 法人
EnterpriseContact string `json:"enterpriseContact"` // 企业联系方式
AuthStatus string `json:"authStatus"` // 认证状态
BusinessLicense string `json:"businessLicense"`
CreatedAt string `json:"createdAt"` // 创建时间
UpdatedAt string `json:"updatedAt"` // 更新时间
}
type (
UserInfoResp {
username string `json:"username"`
}
)
@server (
group: auth
prefix: /api/admin/auth
)
service admin-api {
@handler login
post /login (LoginReq) returns (LoginResp)
}
@server (
group: user
prefix: /api/admin/user
middleware: AuthInterceptor
)
service admin-api {
@handler getUserInfo
get /info returns (UserInfoResp)
}
@server (
group: review
prefix: /api/admin/enterprise
middleware: AuthInterceptor
)
service admin-api {
@handler reviewEnterprise
post /review (ReviewEnterpriseReq) returns (ReviewEnterpriseResp)
@handler getPendingEnterprise
get /pending (GetPendingEnterpriseReq) returns (GetPendingEnterpriseResp)
}
type (
CreateProductReq {
ProductName string `json:"productName"`
ProductCode string `json:"productCode"`
ProductDescription string `json:"productDescription"`
ProductContent string `json:"productContent"`
ProductGroup string `json:"productGroup"`
ProductPrice float64 `json:"productPrice"`
}
UpdateProductReq {
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"`
}
DeleteProductReq {
ProductId int64 `json:"productId"`
}
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/admin/product
middleware: AuthInterceptor
)
service admin-api {
@handler createProduct
post /create (CreateProductReq)
@handler updateProduct
post /update (UpdateProductReq)
@handler deleteProduct
post /delete (DeleteProductReq)
@handler getProductById
get /:productId (GetProductByIdReq) returns (GetProductByIdResp)
@handler getProductList
get /list (GetProductListReq) returns (GetProductListResp)
}
type (
UserListRequest {
Page int64 `json:"page"` // 分页页码
PageSize int64 `json:"pageSize"` // 每页大小
}
UserListResponse {
List []UserItem `json:"list"`
Total int64 `json:"total"`
}
UserItem {
Id int64 `json:"id"` // 主键ID
Username string `json:"username"` // 用户名
Phone string `json:"phone"` // 电话
Disable int64 `json:"disable"` // 是否禁用状态1为禁用0为启用
QuotaExceeded int64 `json:"quotaExceeded"` // 是否超出配额1为超出0为未超出
Balance float64 `json:"balance"` // 余额
CreatedAt string `json:"createdAt"` // 创建时间
UpdatedAt string `json:"updatedAt"` // 更新时间
}
rechargeRequest {
UserId int64 `json:userId`
Amount int64 `json:amount`
}
)
@server (
group: user
prefix: /api/admin/user
middleware: AuthInterceptor
)
service admin-api {
@handler getUserList
post /user/list (UserListRequest) returns (UserListResponse)
@handler recharge
post /user/recharge (rechargeRequest)
}