93 lines
2.6 KiB
Plaintext
93 lines
2.6 KiB
Plaintext
syntax = "v1"
|
|
import "common.api"
|
|
import "player.api" // 为了使用 PlayerService 定义
|
|
|
|
type (
|
|
Order {
|
|
Id string `json:"id"`
|
|
ConsumerId string `json:"consumerId"`
|
|
ConsumerName string `json:"consumerName"`
|
|
PlayerId string `json:"playerId"`
|
|
PlayerName string `json:"playerName"`
|
|
ShopId string `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 string `json:"playerId"`
|
|
ShopId string `json:"shopId,optional"`
|
|
ServiceId string `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
|
|
jwt: Auth
|
|
)
|
|
service juwan-api {
|
|
@doc "获取订单列表"
|
|
@handler ListOrders
|
|
get / (OrderListReq) returns (OrderListResp)
|
|
|
|
@doc "获取订单详情"
|
|
@handler GetOrder
|
|
get /:id (EmptyResp) returns (Order)
|
|
|
|
@doc "创建订单"
|
|
@handler CreateOrder
|
|
post / (CreateOrderReq) returns (CreateOrderResp)
|
|
|
|
@doc "创建并支付订单"
|
|
@handler CreateAndPayOrder
|
|
post /paid (CreateOrderReq) returns (CreateOrderResp)
|
|
|
|
@doc "支付订单"
|
|
@handler PayOrder
|
|
post /:id/pay (EmptyResp) returns (EmptyResp)
|
|
|
|
@doc "接单"
|
|
@handler AcceptOrder
|
|
post /:id/accept (EmptyResp) returns (EmptyResp)
|
|
|
|
@doc "申请结算"
|
|
@handler RequestCloseOrder
|
|
post /:id/request-close (EmptyResp) returns (EmptyResp)
|
|
|
|
@doc "确认结算"
|
|
@handler ConfirmCloseOrder
|
|
post /:id/confirm-close (EmptyResp) returns (EmptyResp)
|
|
|
|
@doc "取消订单"
|
|
@handler CancelOrder
|
|
post /:id/cancel (EmptyResp) returns (EmptyResp)
|
|
|
|
@doc "再来一单"
|
|
@handler Reorder
|
|
post /:id/reorder (EmptyResp) returns (CreateOrderResp)
|
|
} |