用DDD分项目模块

This commit is contained in:
2025-10-05 01:46:48 +08:00
parent 48461b9c49
commit 28acc5104c
41 changed files with 1138 additions and 17 deletions

View File

@@ -0,0 +1,31 @@
// Code scaffolded by goctl. Safe to edit.
// goctl 1.9.1
package ping
import (
"net/http"
"github.com/JACKYMYPERSON/hldrCenter/config"
"github.com/JACKYMYPERSON/hldrCenter/internal/logic/ping"
"github.com/JACKYMYPERSON/hldrCenter/internal/types"
"github.com/zeromicro/go-zero/rest/httpx"
)
func PingHandler(cfg *config.Config) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.PingReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := ping.NewPingLogic(r.Context(), cfg)
resp, err := l.Ping(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}