This commit is contained in:
Mrx
2026-06-06 11:52:06 +08:00
parent a79c464329
commit a85436950e
16 changed files with 864 additions and 25 deletions

View 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)
}
}

View 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)
}
}
}

View File

@@ -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"),
)