新增后台管理

This commit is contained in:
2025-06-08 15:14:34 +08:00
parent 7762ad46fe
commit e75c7b3dd3
488 changed files with 20273 additions and 15879 deletions

View File

@@ -4,20 +4,516 @@ package handler
import (
"net/http"
agent "tydata-server/app/user/cmd/api/internal/handler/agent"
app "tydata-server/app/user/cmd/api/internal/handler/app"
auth "tydata-server/app/user/cmd/api/internal/handler/auth"
notification "tydata-server/app/user/cmd/api/internal/handler/notification"
pay "tydata-server/app/user/cmd/api/internal/handler/pay"
product "tydata-server/app/user/cmd/api/internal/handler/product"
query "tydata-server/app/user/cmd/api/internal/handler/query"
user "tydata-server/app/user/cmd/api/internal/handler/user"
"tydata-server/app/user/cmd/api/internal/svc"
admin_agent "tydata-server/app/main/api/internal/handler/admin_agent"
admin_auth "tydata-server/app/main/api/internal/handler/admin_auth"
admin_feature "tydata-server/app/main/api/internal/handler/admin_feature"
admin_menu "tydata-server/app/main/api/internal/handler/admin_menu"
admin_notification "tydata-server/app/main/api/internal/handler/admin_notification"
admin_order "tydata-server/app/main/api/internal/handler/admin_order"
admin_platform_user "tydata-server/app/main/api/internal/handler/admin_platform_user"
admin_product "tydata-server/app/main/api/internal/handler/admin_product"
admin_promotion "tydata-server/app/main/api/internal/handler/admin_promotion"
admin_query "tydata-server/app/main/api/internal/handler/admin_query"
admin_role "tydata-server/app/main/api/internal/handler/admin_role"
admin_user "tydata-server/app/main/api/internal/handler/admin_user"
agent "tydata-server/app/main/api/internal/handler/agent"
app "tydata-server/app/main/api/internal/handler/app"
auth "tydata-server/app/main/api/internal/handler/auth"
notification "tydata-server/app/main/api/internal/handler/notification"
pay "tydata-server/app/main/api/internal/handler/pay"
product "tydata-server/app/main/api/internal/handler/product"
query "tydata-server/app/main/api/internal/handler/query"
user "tydata-server/app/main/api/internal/handler/user"
"tydata-server/app/main/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: "/agent-commission-deduction/list",
Handler: admin_agent.AdminGetAgentCommissionDeductionListHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/agent-commission/list",
Handler: admin_agent.AdminGetAgentCommissionListHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/agent-link/list",
Handler: admin_agent.AdminGetAgentLinkListHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/agent-membership-config/list",
Handler: admin_agent.AdminGetAgentMembershipConfigListHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/agent-membership-config/update",
Handler: admin_agent.AdminUpdateAgentMembershipConfigHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/agent-membership-recharge-order/list",
Handler: admin_agent.AdminGetAgentMembershipRechargeOrderListHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/agent-platform-deduction/list",
Handler: admin_agent.AdminGetAgentPlatformDeductionListHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/agent-production-config/list",
Handler: admin_agent.AdminGetAgentProductionConfigListHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/agent-production-config/update",
Handler: admin_agent.AdminUpdateAgentProductionConfigHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/agent-reward/list",
Handler: admin_agent.AdminGetAgentRewardListHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/agent-withdrawal/list",
Handler: admin_agent.AdminGetAgentWithdrawalListHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/list",
Handler: admin_agent.AdminGetAgentListHandler(serverCtx),
},
},
rest.WithPrefix("/api/v1/admin/agent"),
)
server.AddRoutes(
[]rest.Route{
{
// 登录
Method: http.MethodPost,
Path: "/login",
Handler: admin_auth.AdminLoginHandler(serverCtx),
},
},
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{
{
// 获取所有菜单(树形结构)
Method: http.MethodGet,
Path: "/all",
Handler: admin_menu.GetMenuAllHandler(serverCtx),
},
{
// 创建菜单
Method: http.MethodPost,
Path: "/create",
Handler: admin_menu.CreateMenuHandler(serverCtx),
},
{
// 删除菜单
Method: http.MethodDelete,
Path: "/delete/:id",
Handler: admin_menu.DeleteMenuHandler(serverCtx),
},
{
// 获取菜单详情
Method: http.MethodGet,
Path: "/detail/:id",
Handler: admin_menu.GetMenuDetailHandler(serverCtx),
},
{
// 获取菜单列表
Method: http.MethodGet,
Path: "/list",
Handler: admin_menu.GetMenuListHandler(serverCtx),
},
{
// 更新菜单
Method: http.MethodPut,
Path: "/update/:id",
Handler: admin_menu.UpdateMenuHandler(serverCtx),
},
},
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
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{
{
// 创建推广链接
Method: http.MethodPost,
Path: "/create",
Handler: admin_promotion.CreatePromotionLinkHandler(serverCtx),
},
{
// 删除推广链接
Method: http.MethodDelete,
Path: "/delete/:id",
Handler: admin_promotion.DeletePromotionLinkHandler(serverCtx),
},
{
// 获取推广链接详情
Method: http.MethodGet,
Path: "/detail/:id",
Handler: admin_promotion.GetPromotionLinkDetailHandler(serverCtx),
},
{
// 获取推广链接列表
Method: http.MethodGet,
Path: "/list",
Handler: admin_promotion.GetPromotionLinkListHandler(serverCtx),
},
{
// 更新推广链接
Method: http.MethodPut,
Path: "/update/:id",
Handler: admin_promotion.UpdatePromotionLinkHandler(serverCtx),
},
},
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
rest.WithPrefix("/api/v1/admin/promotion/link"),
)
server.AddRoutes(
[]rest.Route{
{
// 记录链接点击
Method: http.MethodGet,
Path: "/record/:path",
Handler: admin_promotion.RecordLinkClickHandler(serverCtx),
},
},
rest.WithPrefix("/api/v1/admin/promotion/link"),
)
server.AddRoutes(
[]rest.Route{
{
// 获取推广历史记录
Method: http.MethodGet,
Path: "/history",
Handler: admin_promotion.GetPromotionStatsHistoryHandler(serverCtx),
},
{
// 获取推广总统计
Method: http.MethodGet,
Path: "/total",
Handler: admin_promotion.GetPromotionStatsTotalHandler(serverCtx),
},
},
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
rest.WithPrefix("/api/v1/admin/promotion/stats"),
)
server.AddRoutes(
[]rest.Route{
{
// 更新清理配置
Method: http.MethodPut,
Path: "/cleanup/config",
Handler: admin_query.AdminUpdateQueryCleanupConfigHandler(serverCtx),
},
{
// 获取清理配置列表
Method: http.MethodGet,
Path: "/cleanup/configs",
Handler: admin_query.AdminGetQueryCleanupConfigListHandler(serverCtx),
},
{
// 获取清理详情列表
Method: http.MethodGet,
Path: "/cleanup/details/:log_id",
Handler: admin_query.AdminGetQueryCleanupDetailListHandler(serverCtx),
},
{
// 获取清理日志列表
Method: http.MethodGet,
Path: "/cleanup/logs",
Handler: admin_query.AdminGetQueryCleanupLogListHandler(serverCtx),
},
{
// 获取查询详情
Method: http.MethodGet,
Path: "/detail/:order_id",
Handler: admin_query.AdminGetQueryDetailByOrderIdHandler(serverCtx),
},
},
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
rest.WithPrefix("/api/v1/admin/query"),
)
server.AddRoutes(
[]rest.Route{
{
// 创建角色
Method: http.MethodPost,
Path: "/create",
Handler: admin_role.CreateRoleHandler(serverCtx),
},
{
// 删除角色
Method: http.MethodDelete,
Path: "/delete/:id",
Handler: admin_role.DeleteRoleHandler(serverCtx),
},
{
// 获取角色详情
Method: http.MethodGet,
Path: "/detail/:id",
Handler: admin_role.GetRoleDetailHandler(serverCtx),
},
{
// 获取角色列表
Method: http.MethodGet,
Path: "/list",
Handler: admin_role.GetRoleListHandler(serverCtx),
},
{
// 更新角色
Method: http.MethodPut,
Path: "/update/:id",
Handler: admin_role.UpdateRoleHandler(serverCtx),
},
},
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
rest.WithPrefix("/api/v1/admin/role"),
)
server.AddRoutes(
[]rest.Route{
{
// 创建用户
Method: http.MethodPost,
Path: "/create",
Handler: admin_user.AdminCreateUserHandler(serverCtx),
},
{
// 删除用户
Method: http.MethodDelete,
Path: "/delete/:id",
Handler: admin_user.AdminDeleteUserHandler(serverCtx),
},
{
// 获取用户详情
Method: http.MethodGet,
Path: "/detail/:id",
Handler: admin_user.AdminGetUserDetailHandler(serverCtx),
},
{
// 用户信息
Method: http.MethodGet,
Path: "/info",
Handler: admin_user.AdminUserInfoHandler(serverCtx),
},
{
// 获取用户列表
Method: http.MethodGet,
Path: "/list",
Handler: admin_user.AdminGetUserListHandler(serverCtx),
},
{
// 更新用户
Method: http.MethodPut,
Path: "/update/:id",
Handler: admin_user.AdminUpdateUserHandler(serverCtx),
},
},
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
rest.WithPrefix("/api/v1/admin/user"),
)
server.AddRoutes(
[]rest.Route{
{