fix and code

This commit is contained in:
2025-03-17 15:59:09 +08:00
parent 8e8e6780c5
commit 15d9896c1d
32 changed files with 988 additions and 313 deletions

View File

@@ -0,0 +1,17 @@
package app
import (
"net/http"
"tydata-server/app/user/cmd/api/internal/logic/app"
"tydata-server/app/user/cmd/api/internal/svc"
"tydata-server/common/result"
)
func HealthCheckHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := app.NewHealthCheckLogic(r.Context(), svcCtx)
resp, err := l.HealthCheck()
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -25,11 +25,6 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
Path: "/audit/status",
Handler: agent.GetAgentAuditStatusHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/commission",
Handler: agent.GetAgentCommissionHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/generating_link",
@@ -40,6 +35,18 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
Path: "/info",
Handler: agent.GetAgentInfoHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/product_config",
Handler: agent.GetAgentProductConfigHandler(serverCtx),
},
},
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
rest.WithPrefix("/api/v1/agent"),
)
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodPost,
Path: "/membership/save_user_config",
@@ -50,10 +57,17 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
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: "/product_config",
Handler: agent.GetAgentProductConfigHandler(serverCtx),
Path: "/commission",
Handler: agent.GetAgentCommissionHandler(serverCtx),
},
{
Method: http.MethodGet,
@@ -108,6 +122,12 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
Path: "/app/version",
Handler: app.GetAppVersionHandler(serverCtx),
},
{
// 心跳检测接口
Method: http.MethodGet,
Path: "/health/check",
Handler: app.HealthCheckHandler(serverCtx),
},
},
rest.WithPrefix("/api/v1"),
)