ycc-server/app/main/api/internal/handler/agent/agentwithdrawalhandler.go

31 lines
784 B
Go
Raw Normal View History

2025-06-19 17:12:48 +08:00
package agent
import (
"net/http"
"ycc-server/app/main/api/internal/logic/agent"
"ycc-server/app/main/api/internal/svc"
"ycc-server/app/main/api/internal/types"
"ycc-server/common/result"
"ycc-server/pkg/lzkit/validator"
"github.com/zeromicro/go-zero/rest/httpx"
)
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)
}
}