This commit is contained in:
2025-05-27 18:35:01 +08:00
parent ca66cc91d4
commit 79e1ba2616
115 changed files with 22039 additions and 1045 deletions

View File

@@ -5,7 +5,12 @@ import (
"net/http"
admin_auth "tyc-server/app/main/api/internal/handler/admin_auth"
admin_feature "tyc-server/app/main/api/internal/handler/admin_feature"
admin_menu "tyc-server/app/main/api/internal/handler/admin_menu"
admin_notification "tyc-server/app/main/api/internal/handler/admin_notification"
admin_order "tyc-server/app/main/api/internal/handler/admin_order"
admin_platform_user "tyc-server/app/main/api/internal/handler/admin_platform_user"
admin_product "tyc-server/app/main/api/internal/handler/admin_product"
admin_promotion "tyc-server/app/main/api/internal/handler/admin_promotion"
admin_role "tyc-server/app/main/api/internal/handler/admin_role"
admin_user "tyc-server/app/main/api/internal/handler/admin_user"
@@ -33,6 +38,37 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
rest.WithPrefix("/api/v1/admin/auth"),
)
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodPost,
Path: "/create",
Handler: admin_feature.AdminCreateFeatureHandler(serverCtx),
},
{
Method: http.MethodDelete,
Path: "/delete/:id",
Handler: admin_feature.AdminDeleteFeatureHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/detail/:id",
Handler: admin_feature.AdminGetFeatureDetailHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/list",
Handler: admin_feature.AdminGetFeatureListHandler(serverCtx),
},
{
Method: http.MethodPut,
Path: "/update/:id",
Handler: admin_feature.AdminUpdateFeatureHandler(serverCtx),
},
},
rest.WithPrefix("/api/v1/admin/feature"),
)
server.AddRoutes(
[]rest.Route{
{
@@ -76,6 +112,153 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
rest.WithPrefix("/api/v1/admin/menu"),
)
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodPost,
Path: "/create",
Handler: admin_notification.AdminCreateNotificationHandler(serverCtx),
},
{
Method: http.MethodDelete,
Path: "/delete/:id",
Handler: admin_notification.AdminDeleteNotificationHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/detail/:id",
Handler: admin_notification.AdminGetNotificationDetailHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/list",
Handler: admin_notification.AdminGetNotificationListHandler(serverCtx),
},
{
Method: http.MethodPut,
Path: "/update/:id",
Handler: admin_notification.AdminUpdateNotificationHandler(serverCtx),
},
},
rest.WithPrefix("/api/v1/admin/notification"),
)
server.AddRoutes(
[]rest.Route{
{
// 创建订单
Method: http.MethodPost,
Path: "/create",
Handler: admin_order.AdminCreateOrderHandler(serverCtx),
},
{
// 删除订单
Method: http.MethodDelete,
Path: "/delete/:id",
Handler: admin_order.AdminDeleteOrderHandler(serverCtx),
},
{
// 获取订单详情
Method: http.MethodGet,
Path: "/detail/:id",
Handler: admin_order.AdminGetOrderDetailHandler(serverCtx),
},
{
// 获取订单列表
Method: http.MethodGet,
Path: "/list",
Handler: admin_order.AdminGetOrderListHandler(serverCtx),
},
{
// 订单退款
Method: http.MethodPost,
Path: "/refund/:id",
Handler: admin_order.AdminRefundOrderHandler(serverCtx),
},
{
// 更新订单
Method: http.MethodPut,
Path: "/update/:id",
Handler: admin_order.AdminUpdateOrderHandler(serverCtx),
},
},
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
rest.WithPrefix("/api/v1/admin/order"),
)
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodPost,
Path: "/create",
Handler: admin_platform_user.AdminCreatePlatformUserHandler(serverCtx),
},
{
Method: http.MethodDelete,
Path: "/delete/:id",
Handler: admin_platform_user.AdminDeletePlatformUserHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/detail/:id",
Handler: admin_platform_user.AdminGetPlatformUserDetailHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/list",
Handler: admin_platform_user.AdminGetPlatformUserListHandler(serverCtx),
},
{
Method: http.MethodPut,
Path: "/update/:id",
Handler: admin_platform_user.AdminUpdatePlatformUserHandler(serverCtx),
},
},
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
rest.WithPrefix("/api/v1/admin/platform_user"),
)
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodPost,
Path: "/create",
Handler: admin_product.AdminCreateProductHandler(serverCtx),
},
{
Method: http.MethodDelete,
Path: "/delete/:id",
Handler: admin_product.AdminDeleteProductHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/detail/:id",
Handler: admin_product.AdminGetProductDetailHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/feature/list/:product_id",
Handler: admin_product.AdminGetProductFeatureListHandler(serverCtx),
},
{
Method: http.MethodPut,
Path: "/feature/update/:product_id",
Handler: admin_product.AdminUpdateProductFeaturesHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/list",
Handler: admin_product.AdminGetProductListHandler(serverCtx),
},
{
Method: http.MethodPut,
Path: "/update/:id",
Handler: admin_product.AdminUpdateProductHandler(serverCtx),
},
},
rest.WithPrefix("/api/v1/admin/product"),
)
server.AddRoutes(
[]rest.Route{
{