Files
juwan-backend/desc/api/order.api
T
wwweww 19cc7a778c Refactor: Remove deprecated gRPC service files and implement new API structure
- Deleted old gRPC service definitions in `game_grpc.pb.go` and `public.go`.
- Added new API server implementations for objectstory, player, and shop services.
- Introduced configuration files for new APIs in `etc/*.yaml`.
- Created main entry points for each service in `objectstory.go`, `player.go`, and `shop.go`.
- Removed unused user update handler and user API files.
- Added utility functions for context management and HTTP header parsing.
- Introduced PostgreSQL backup configuration in `backup/postgreSql.yaml`.
2026-02-28 18:35:56 +08:00

94 lines
2.5 KiB
Plaintext

syntax = "v1"
import "common.api"
type (
PathId {
Id int64 `path:"id"`
}
Order {
Id int64 `json:"id"`
ConsumerId int64 `json:"consumerId"`
ConsumerName string `json:"consumerName"`
PlayerId string `json:"playerId"`
PlayerName string `json:"playerName"`
ShopId int64 `json:"shopId,optional"`
ShopName string `json:"shopName,optional"`
Service PlayerService `json:"service"`
Status string `json:"status"`
TotalPrice float64 `json:"totalPrice"`
Note string `json:"note,optional"`
CreatedAt string `json:"createdAt"`
AcceptedAt string `json:"acceptedAt,optional"`
CompletedAt string `json:"completedAt,optional"`
}
OrderListReq {
PageReq
Role string `form:"role"` // consumer, player, owner
Status string `form:"status,optional"`
}
OrderListResp {
Items []Order `json:"items"`
Meta PageMeta `json:"meta"`
}
CreateOrderReq {
PlayerId int64 `json:"playerId"`
ShopId int64 `json:"shopId,optional"`
ServiceId int64 `json:"serviceId"`
Quantity int `json:"quantity"`
Note string `json:"note,optional"`
}
CreateOrderResp {
Ok bool `json:"ok"`
Order Order `json:"order"`
}
)
@server(
prefix: api/v1/orders
group: order
)
service order-api {
@doc "获取订单列表"
@handler ListOrders
get / (OrderListReq) returns (OrderListResp)
@doc "获取订单详情"
@handler GetOrder
get /:id (PathId) returns (Order)
@doc "创建订单"
@handler CreateOrder
post / (CreateOrderReq) returns (CreateOrderResp)
@doc "创建并支付订单"
@handler CreateAndPayOrder
post /paid (CreateOrderReq) returns (CreateOrderResp)
@doc "支付订单"
@handler PayOrder
post /:id/pay (PathId) returns (EmptyResp)
@doc "接单"
@handler AcceptOrder
post /:id/accept (PathId) returns (EmptyResp)
@doc "申请结算"
@handler RequestCloseOrder
post /:id/request-close (PathId) returns (EmptyResp)
@doc "确认结算"
@handler ConfirmCloseOrder
post /:id/confirm-close (PathId) returns (EmptyResp)
@doc "取消订单"
@handler CancelOrder
post /:id/cancel (PathId) returns (EmptyResp)
@doc "再来一单"
@handler Reorder
post /:id/reorder (PathId) returns (CreateOrderResp)
}