2024-11-03 15:28:10 +08:00
|
|
|
// Code generated by goctl. DO NOT EDIT.
|
|
|
|
package handler
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
2025-02-13 19:39:16 +08:00
|
|
|
agent "qnc-server/app/user/cmd/api/internal/handler/agent"
|
2024-11-03 15:28:10 +08:00
|
|
|
auth "qnc-server/app/user/cmd/api/internal/handler/auth"
|
2025-01-01 02:00:06 +08:00
|
|
|
notification "qnc-server/app/user/cmd/api/internal/handler/notification"
|
2024-11-21 12:14:34 +08:00
|
|
|
pay "qnc-server/app/user/cmd/api/internal/handler/pay"
|
|
|
|
product "qnc-server/app/user/cmd/api/internal/handler/product"
|
|
|
|
query "qnc-server/app/user/cmd/api/internal/handler/query"
|
2024-11-03 15:28:10 +08:00
|
|
|
user "qnc-server/app/user/cmd/api/internal/handler/user"
|
|
|
|
"qnc-server/app/user/cmd/api/internal/svc"
|
|
|
|
|
|
|
|
"github.com/zeromicro/go-zero/rest"
|
|
|
|
)
|
|
|
|
|
|
|
|
func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
2025-02-13 19:39:16 +08:00
|
|
|
server.AddRoutes(
|
|
|
|
[]rest.Route{
|
|
|
|
{
|
|
|
|
Method: http.MethodPost,
|
2025-02-18 15:23:26 +08:00
|
|
|
Path: "/apply",
|
2025-02-13 19:39:16 +08:00
|
|
|
Handler: agent.ApplyForAgentHandler(serverCtx),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Method: http.MethodGet,
|
2025-02-18 15:23:26 +08:00
|
|
|
Path: "/audit/status",
|
2025-02-13 19:39:16 +08:00
|
|
|
Handler: agent.GetAgentAuditStatusHandler(serverCtx),
|
|
|
|
},
|
2025-02-18 15:23:26 +08:00
|
|
|
{
|
|
|
|
Method: http.MethodGet,
|
|
|
|
Path: "/info",
|
|
|
|
Handler: agent.GetAgentInfoHandler(serverCtx),
|
|
|
|
},
|
2025-02-13 19:39:16 +08:00
|
|
|
},
|
2025-02-18 15:23:26 +08:00
|
|
|
rest.WithPrefix("/api/v1/agent"),
|
2025-02-13 19:39:16 +08:00
|
|
|
)
|
|
|
|
|
2024-11-03 15:28:10 +08:00
|
|
|
server.AddRoutes(
|
|
|
|
[]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"),
|
|
|
|
)
|
|
|
|
|
2024-11-23 16:13:23 +08:00
|
|
|
server.AddRoutes(
|
2024-12-24 11:37:25 +08:00
|
|
|
rest.WithMiddlewares(
|
|
|
|
[]rest.Middleware{serverCtx.SourceInterceptor},
|
|
|
|
[]rest.Route{
|
|
|
|
{
|
|
|
|
Method: http.MethodPost,
|
|
|
|
Path: "/pay/iap_callback",
|
|
|
|
Handler: pay.IapCallbackHandler(serverCtx),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Method: http.MethodPost,
|
|
|
|
Path: "/pay/payment",
|
|
|
|
Handler: pay.PaymentHandler(serverCtx),
|
|
|
|
},
|
|
|
|
}...,
|
|
|
|
),
|
2024-11-23 16:13:23 +08:00
|
|
|
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(
|
|
|
|
rest.WithMiddlewares(
|
|
|
|
[]rest.Middleware{serverCtx.SourceInterceptor},
|
|
|
|
[]rest.Route{
|
|
|
|
{
|
|
|
|
Method: http.MethodGet,
|
|
|
|
Path: "/render_list/:module",
|
|
|
|
Handler: product.GetProductRenderListHandler(serverCtx),
|
|
|
|
},
|
|
|
|
}...,
|
|
|
|
),
|
|
|
|
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),
|
|
|
|
},
|
2024-11-23 16:13:23 +08:00
|
|
|
{
|
|
|
|
// 获取查询临时订单
|
|
|
|
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{
|
|
|
|
{
|
2024-11-03 19:06:09 +08:00
|
|
|
// mobile code login
|
2024-11-03 15:28:10 +08:00
|
|
|
Method: http.MethodPost,
|
2024-11-03 19:06:09 +08:00
|
|
|
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),
|
|
|
|
},
|
2025-01-03 02:13:31 +08:00
|
|
|
{
|
|
|
|
// 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
|
|
|
)
|
|
|
|
}
|