f
This commit is contained in:
30
app/main/api/internal/handler/pay/xpayadmindeliverhandler.go
Normal file
30
app/main/api/internal/handler/pay/xpayadmindeliverhandler.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package pay
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"qnc-server/app/main/api/internal/logic/pay"
|
||||
"qnc-server/app/main/api/internal/svc"
|
||||
"qnc-server/app/main/api/internal/types"
|
||||
"qnc-server/common/result"
|
||||
"qnc-server/pkg/lzkit/validator"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
)
|
||||
|
||||
func XpayAdminDeliverHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.XpayAdminDeliverReq
|
||||
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 := pay.NewXpayAdminDeliverLogic(r.Context(), svcCtx)
|
||||
resp, err := l.XpayAdminDeliver(&req, r)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
||||
22
app/main/api/internal/handler/pay/xpaypushhandler.go
Normal file
22
app/main/api/internal/handler/pay/xpaypushhandler.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package pay
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"qnc-server/app/main/api/internal/logic/pay"
|
||||
"qnc-server/app/main/api/internal/svc"
|
||||
)
|
||||
|
||||
func XpayPushHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
l := pay.NewXpayPushLogic(svcCtx)
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
switch r.Method {
|
||||
case http.MethodGet:
|
||||
l.HandleGET(w, r)
|
||||
case http.MethodPost:
|
||||
l.HandlePOST(w, r)
|
||||
default:
|
||||
w.WriteHeader(http.StatusMethodNotAllowed)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -937,6 +937,21 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||
Path: "/pay/wechat/refund_callback",
|
||||
Handler: pay.WechatPayRefundCallbackHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/pay/xpay/push",
|
||||
Handler: pay.XpayPushHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/pay/xpay/push",
|
||||
Handler: pay.XpayPushHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/pay/xpay/admin/deliver",
|
||||
Handler: pay.XpayAdminDeliverHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
rest.WithPrefix("/api/v1"),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user