400 lines
9.2 KiB
Go
400 lines
9.2 KiB
Go
// Code generated by goctl. DO NOT EDIT.
|
|
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"
|
|
|
|
"github.com/zeromicro/go-zero/rest"
|
|
)
|
|
|
|
func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/audit/status",
|
|
Handler: agent.GetAgentAuditStatusHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/generating_link",
|
|
Handler: agent.GeneratingLinkHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/info",
|
|
Handler: agent.GetAgentInfoHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/product_config",
|
|
Handler: agent.GetAgentProductConfigHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/subordinate/contribution/detail",
|
|
Handler: agent.GetAgentSubordinateContributionDetailHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/subordinate/list",
|
|
Handler: agent.GetAgentSubordinateListHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
|
|
rest.WithPrefix("/api/v1/agent"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/membership/save_user_config",
|
|
Handler: agent.SaveAgentMembershipUserConfigHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/membership/user_config",
|
|
Handler: agent.GetAgentMembershipProductConfigHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
|
|
rest.WithPrefix("/api/v1/agent"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/commission",
|
|
Handler: agent.GetAgentCommissionHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/revenue",
|
|
Handler: agent.GetAgentRevenueInfoHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/rewards",
|
|
Handler: agent.GetAgentRewardsHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/withdrawal",
|
|
Handler: agent.GetAgentWithdrawalHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/withdrawal",
|
|
Handler: agent.AgentWithdrawalHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
|
|
rest.WithPrefix("/api/v1/agent"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/apply",
|
|
Handler: agent.ApplyForAgentHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/link",
|
|
Handler: agent.GetLinkDataHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/membership/activate",
|
|
Handler: agent.ActivateAgentMembershipHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithPrefix("/api/v1/agent"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/app/version",
|
|
Handler: app.GetAppVersionHandler(serverCtx),
|
|
},
|
|
{
|
|
// 心跳检测接口
|
|
Method: http.MethodGet,
|
|
Path: "/health/check",
|
|
Handler: app.HealthCheckHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithPrefix("/api/v1"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
// get mobile verify code
|
|
Method: http.MethodPost,
|
|
Path: "/auth/sendSms",
|
|
Handler: auth.SendSmsHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithPrefix("/api/v1"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
// get notifications
|
|
Method: http.MethodGet,
|
|
Path: "/notification/list",
|
|
Handler: notification.GetNotificationsHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithPrefix("/api/v1"),
|
|
)
|
|
|
|
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(
|
|
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),
|
|
},
|
|
}...,
|
|
),
|
|
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
|
|
rest.WithPrefix("/api/v1"),
|
|
)
|
|
|
|
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"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/app_en/:product_en",
|
|
Handler: product.GetProductAppByEnHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithPrefix("/api/v1/product"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
// query service agent
|
|
Method: http.MethodPost,
|
|
Path: "/query/service_agent/:product",
|
|
Handler: query.QueryServiceAgentHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/query/service_app/:product",
|
|
Handler: query.QueryServiceAppHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithPrefix("/api/v1"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
// query service
|
|
Method: http.MethodPost,
|
|
Path: "/query/service/:product",
|
|
Handler: query.QueryServiceHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
|
|
rest.WithPrefix("/api/v1"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
// 查询示例
|
|
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),
|
|
},
|
|
{
|
|
// 查询详情 按订单号
|
|
Method: http.MethodGet,
|
|
Path: "/query/orderNo/:order_no",
|
|
Handler: query.QueryDetailByOrderNoHandler(serverCtx),
|
|
},
|
|
{
|
|
// 获取查询临时订单
|
|
Method: http.MethodGet,
|
|
Path: "/query/provisional_order/:id",
|
|
Handler: query.QueryProvisionalOrderHandler(serverCtx),
|
|
},
|
|
{
|
|
// 重试查询
|
|
Method: http.MethodPost,
|
|
Path: "/query/retry/:id",
|
|
Handler: query.QueryRetryHandler(serverCtx),
|
|
},
|
|
},
|
|
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.MethodPost,
|
|
Path: "/query/single/test",
|
|
Handler: query.QuerySingleTestHandler(serverCtx),
|
|
},
|
|
{
|
|
// 更新查询数据
|
|
Method: http.MethodPost,
|
|
Path: "/query/update_data",
|
|
Handler: query.UpdateQueryDataHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithPrefix("/api/v1"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
// agent mobile code login
|
|
Method: http.MethodPost,
|
|
Path: "/user/agent_mobile_code_login",
|
|
Handler: user.AgentMobileCodeLoginHandler(serverCtx),
|
|
},
|
|
{
|
|
// mobile code login
|
|
Method: http.MethodPost,
|
|
Path: "/user/mobileCodeLogin",
|
|
Handler: user.MobileCodeLoginHandler(serverCtx),
|
|
},
|
|
{
|
|
// mobile login
|
|
Method: http.MethodPost,
|
|
Path: "/user/mobileLogin",
|
|
Handler: user.MobileLoginHandler(serverCtx),
|
|
},
|
|
{
|
|
// register
|
|
Method: http.MethodPost,
|
|
Path: "/user/register",
|
|
Handler: user.RegisterHandler(serverCtx),
|
|
},
|
|
{
|
|
// 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),
|
|
},
|
|
},
|
|
rest.WithPrefix("/api/v1"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/user/cancelOut",
|
|
Handler: user.CancelOutHandler(serverCtx),
|
|
},
|
|
{
|
|
// get user info
|
|
Method: http.MethodGet,
|
|
Path: "/user/detail",
|
|
Handler: user.DetailHandler(serverCtx),
|
|
},
|
|
{
|
|
// get new token
|
|
Method: http.MethodPost,
|
|
Path: "/user/getToken",
|
|
Handler: user.GetTokenHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
|
|
rest.WithPrefix("/api/v1"),
|
|
)
|
|
}
|