tyc-server/app/main/api/internal/handler/routes.go

456 lines
11 KiB
Go
Raw Normal View History

2024-11-03 15:28:10 +08:00
// Code generated by goctl. DO NOT EDIT.
package handler
import (
"net/http"
2025-05-09 17:54:28 +08:00
admin_auth "tyc-server/app/main/api/internal/handler/admin_auth"
admin_menu "tyc-server/app/main/api/internal/handler/admin_menu"
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"
2025-04-27 12:17:18 +08:00
auth "tyc-server/app/main/api/internal/handler/auth"
notification "tyc-server/app/main/api/internal/handler/notification"
pay "tyc-server/app/main/api/internal/handler/pay"
product "tyc-server/app/main/api/internal/handler/product"
query "tyc-server/app/main/api/internal/handler/query"
user "tyc-server/app/main/api/internal/handler/user"
"tyc-server/app/main/api/internal/svc"
2024-11-03 15:28:10 +08:00
"github.com/zeromicro/go-zero/rest"
)
func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
2025-05-09 17:54:28 +08:00
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.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_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.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"),
)
2025-02-13 19:39:16 +08:00
server.AddRoutes(
2024-11-03 15:28:10 +08:00
[]rest.Route{
{
// get mobile verify code
Method: http.MethodPost,
Path: "/auth/sendSms",
Handler: auth.SendSmsHandler(serverCtx),
},
},
2024-11-21 12:14:34 +08:00
rest.WithPrefix("/api/v1"),
)
2025-01-01 02:00:06 +08:00
server.AddRoutes(
[]rest.Route{
{
// get notifications
Method: http.MethodGet,
Path: "/notification/list",
Handler: notification.GetNotificationsHandler(serverCtx),
},
},
rest.WithPrefix("/api/v1"),
)
2024-11-21 12:14:34 +08:00
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodPost,
Path: "/pay/alipay/callback",
Handler: pay.AlipayCallbackHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/pay/wechat/callback",
Handler: pay.WechatPayCallbackHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/pay/wechat/refund_callback",
Handler: pay.WechatPayRefundCallbackHandler(serverCtx),
},
},
rest.WithPrefix("/api/v1"),
)
server.AddRoutes(
2025-05-09 17:54:28 +08:00
[]rest.Route{
{
Method: http.MethodPost,
Path: "/pay/iap_callback",
Handler: pay.IapCallbackHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/pay/payment",
Handler: pay.PaymentHandler(serverCtx),
},
},
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
rest.WithPrefix("/api/v1"),
)
2024-11-21 12:14:34 +08:00
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodGet,
Path: "/:id",
Handler: product.GetProductByIDHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/en/:product_en",
Handler: product.GetProductByEnHandler(serverCtx),
},
},
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
rest.WithPrefix("/api/v1/product"),
)
2025-01-18 22:34:27 +08:00
server.AddRoutes(
2025-05-09 17:54:28 +08:00
[]rest.Route{
{
Method: http.MethodGet,
Path: "/render_list/:module",
Handler: product.GetProductRenderListHandler(serverCtx),
},
},
2025-01-18 22:34:27 +08:00
rest.WithPrefix("/api/v1/product"),
)
2024-11-21 12:14:34 +08:00
server.AddRoutes(
[]rest.Route{
2024-12-24 11:37:25 +08:00
{
// query service
Method: http.MethodPost,
Path: "/query/service/:product",
Handler: query.QueryServiceHandler(serverCtx),
},
2024-11-21 12:14:34 +08:00
},
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
rest.WithPrefix("/api/v1"),
)
server.AddRoutes(
[]rest.Route{
{
// 查询详情
Method: http.MethodGet,
Path: "/query/:id",
Handler: query.QueryDetailHandler(serverCtx),
},
{
// 查询示例
Method: http.MethodGet,
Path: "/query/example",
Handler: query.QueryExampleHandler(serverCtx),
},
{
// 查询列表
Method: http.MethodGet,
Path: "/query/list",
Handler: query.QueryListHandler(serverCtx),
},
{
// 查询详情 按订单号 付款查询时
Method: http.MethodGet,
Path: "/query/orderId/:order_id",
Handler: query.QueryDetailByOrderIdHandler(serverCtx),
},
2024-12-24 11:37:25 +08:00
{
// 查询详情 按订单号
Method: http.MethodGet,
Path: "/query/orderNo/:order_no",
Handler: query.QueryDetailByOrderNoHandler(serverCtx),
},
{
// 获取查询临时订单
Method: http.MethodGet,
Path: "/query/provisional_order/:id",
Handler: query.QueryProvisionalOrderHandler(serverCtx),
},
2024-11-21 12:14:34 +08:00
{
// 重试查询
Method: http.MethodPost,
Path: "/query/retry/:id",
Handler: query.QueryRetryHandler(serverCtx),
},
},
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
rest.WithPrefix("/api/v1"),
2024-11-03 15:28:10 +08:00
)
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodPost,
Path: "/query/single/test",
Handler: query.QuerySingleTestHandler(serverCtx),
},
2025-04-16 19:43:46 +08:00
{
// 更新查询数据
Method: http.MethodPost,
Path: "/query/update_data",
Handler: query.UpdateQueryDataHandler(serverCtx),
},
},
rest.WithPrefix("/api/v1"),
)
2024-11-03 15:28:10 +08:00
server.AddRoutes(
[]rest.Route{
2025-04-04 01:02:26 +08:00
{
Method: http.MethodPost,
Path: "/user/decryptMobile",
Handler: user.DecryptMobileHandler(serverCtx),
},
2024-11-03 15:28:10 +08:00
{
// mobile code login
2024-11-03 15:28:10 +08:00
Method: http.MethodPost,
Path: "/user/mobileCodeLogin",
Handler: user.MobileCodeLoginHandler(serverCtx),
},
{
// mobile login
Method: http.MethodPost,
Path: "/user/mobileLogin",
Handler: user.MobileLoginHandler(serverCtx),
2024-11-03 15:28:10 +08:00
},
{
// register
Method: http.MethodPost,
Path: "/user/register",
Handler: user.RegisterHandler(serverCtx),
},
2024-12-24 11:37:25 +08:00
{
// wechat mini auth
Method: http.MethodPost,
Path: "/user/wxMiniAuth",
Handler: user.WxMiniAuthHandler(serverCtx),
},
{
// wechat h5 auth
Method: http.MethodPost,
Path: "/user/wxh5Auth",
Handler: user.WxH5AuthHandler(serverCtx),
},
2024-11-03 15:28:10 +08:00
},
2024-11-21 12:14:34 +08:00
rest.WithPrefix("/api/v1"),
2024-11-03 15:28:10 +08:00
)
server.AddRoutes(
[]rest.Route{
{
// get user info
2024-11-21 12:14:34 +08:00
Method: http.MethodGet,
2024-11-03 15:28:10 +08:00
Path: "/user/detail",
Handler: user.DetailHandler(serverCtx),
},
{
// get new token
Method: http.MethodPost,
Path: "/user/getToken",
Handler: user.GetTokenHandler(serverCtx),
},
2024-11-03 15:28:10 +08:00
},
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
2024-11-21 12:14:34 +08:00
rest.WithPrefix("/api/v1"),
2024-11-03 15:28:10 +08:00
)
}