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`.
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
// Code generated by goctl. DO NOT EDIT.
|
||||
// goctl 1.9.2
|
||||
|
||||
package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
order "juwan-backend/app/order/api/internal/handler/order"
|
||||
"juwan-backend/app/order/api/internal/svc"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest"
|
||||
)
|
||||
|
||||
func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||
server.AddRoutes(
|
||||
[]rest.Route{
|
||||
{
|
||||
// 获取订单列表
|
||||
Method: http.MethodGet,
|
||||
Path: "/",
|
||||
Handler: order.ListOrdersHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 创建订单
|
||||
Method: http.MethodPost,
|
||||
Path: "/",
|
||||
Handler: order.CreateOrderHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 获取订单详情
|
||||
Method: http.MethodGet,
|
||||
Path: "/:id",
|
||||
Handler: order.GetOrderHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 接单
|
||||
Method: http.MethodPost,
|
||||
Path: "/:id/accept",
|
||||
Handler: order.AcceptOrderHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 取消订单
|
||||
Method: http.MethodPost,
|
||||
Path: "/:id/cancel",
|
||||
Handler: order.CancelOrderHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 确认结算
|
||||
Method: http.MethodPost,
|
||||
Path: "/:id/confirm-close",
|
||||
Handler: order.ConfirmCloseOrderHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 支付订单
|
||||
Method: http.MethodPost,
|
||||
Path: "/:id/pay",
|
||||
Handler: order.PayOrderHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 再来一单
|
||||
Method: http.MethodPost,
|
||||
Path: "/:id/reorder",
|
||||
Handler: order.ReorderHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 申请结算
|
||||
Method: http.MethodPost,
|
||||
Path: "/:id/request-close",
|
||||
Handler: order.RequestCloseOrderHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 创建并支付订单
|
||||
Method: http.MethodPost,
|
||||
Path: "/paid",
|
||||
Handler: order.CreateAndPayOrderHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
rest.WithPrefix("/api/v1/orders"),
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user