fusenapi/server/order/internal/handler/createprepaymentbydeposithandler.go

36 lines
782 B
Go
Raw Normal View History

2023-09-20 07:07:12 +00:00
package handler
import (
"net/http"
"reflect"
"fusenapi/utils/basic"
"fusenapi/server/order/internal/logic"
"fusenapi/server/order/internal/svc"
"fusenapi/server/order/internal/types"
)
2023-09-21 04:11:15 +00:00
func CreatePrePaymentByDepositHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
2023-09-20 07:07:12 +00:00
return func(w http.ResponseWriter, r *http.Request) {
2023-09-21 04:11:15 +00:00
var req types.CreatePrePaymentByDepositReq
2023-09-20 07:07:12 +00:00
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}
// 创建一个业务逻辑层实例
2023-09-21 04:11:15 +00:00
l := logic.NewCreatePrePaymentByDepositLogic(r.Context(), svcCtx)
2023-09-20 07:07:12 +00:00
rl := reflect.ValueOf(l)
basic.BeforeLogic(w, r, rl)
2023-09-21 04:11:15 +00:00
resp := l.CreatePrePaymentByDeposit(&req, userinfo)
2023-09-20 07:07:12 +00:00
if !basic.AfterLogic(w, r, rl, resp) {
basic.NormalAfterLogic(w, r, resp)
}
}
}