22 lines
501 B
Go
22 lines
501 B
Go
|
package base
|
||
|
|
||
|
import (
|
||
|
"net/http"
|
||
|
|
||
|
xhttp "github.com/zeromicro/x/http"
|
||
|
"tianyuan-api/apps/gateway/internal/logic/base"
|
||
|
"tianyuan-api/apps/gateway/internal/svc"
|
||
|
)
|
||
|
|
||
|
func HealthHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||
|
l := base.NewHealthLogic(r.Context(), svcCtx)
|
||
|
resp, err := l.Health()
|
||
|
if err != nil {
|
||
|
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
|
||
|
} else {
|
||
|
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
|
||
|
}
|
||
|
}
|
||
|
}
|