tydata-server/app/user/cmd/api/internal/handler/agent/agentwithdrawalhandler.go
2025-03-07 03:52:12 +08:00

30 lines
810 B
Go

package agent
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/user/cmd/api/internal/logic/agent"
"tydata-server/app/user/cmd/api/internal/svc"
"tydata-server/app/user/cmd/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AgentWithdrawalHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.WithdrawalReq
if err := httpx.Parse(r, &req); err != nil {
result.ParamErrorResult(r, w, err)
return
}
if err := validator.Validate(req); err != nil {
result.ParamValidateErrorResult(r, w, err)
return
}
l := agent.NewAgentWithdrawalLogic(r.Context(), svcCtx)
resp, err := l.AgentWithdrawal(&req)
result.HttpResult(r, w, resp, err)
}
}