You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
561 B
25 lines
561 B
package handler
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/zeromicro/x/errors"
|
|
|
|
"demo/internal/logic"
|
|
"demo/internal/svc"
|
|
|
|
"github.com/zeromicro/go-zero/rest/httpx"
|
|
)
|
|
|
|
func Test503Handler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
|
return func(w http.ResponseWriter, r *http.Request) {
|
|
l := logic.NewTest503Logic(r.Context(), svcCtx)
|
|
resp, err := l.Test503()
|
|
if err != nil {
|
|
// httpx.ErrorCtx(r.Context(), w, err)
|
|
httpx.WriteJson(w, http.StatusServiceUnavailable, errors.New(503, "503"))
|
|
} else {
|
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
|
}
|
|
}
|
|
}
|
|
|