new
This commit is contained in:
@@ -90,13 +90,24 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||
Handler: topup.AliTopUpHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/aliTopUpCallback",
|
||||
Handler: topup.AliTopUpCallbackHandler(serverCtx),
|
||||
Method: http.MethodGet,
|
||||
Path: "/topUpList",
|
||||
Handler: topup.TopListHandler(serverCtx),
|
||||
},
|
||||
}...,
|
||||
),
|
||||
rest.WithPrefix("/api/console/topupfmghnjx"),
|
||||
rest.WithPrefix("/api/console/topup"),
|
||||
)
|
||||
|
||||
server.AddRoutes(
|
||||
[]rest.Route{
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/aliTopUpCallback",
|
||||
Handler: topup.AliTopUpCallbackHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
rest.WithPrefix("/api/console/topup"),
|
||||
)
|
||||
|
||||
server.AddRoutes(
|
||||
|
||||
30
apps/gateway/internal/handler/topup/toplisthandler.go
Normal file
30
apps/gateway/internal/handler/topup/toplisthandler.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package topup
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"tianyuan-api/apps/gateway/internal/logic/topup"
|
||||
"tianyuan-api/apps/gateway/internal/svc"
|
||||
"tianyuan-api/apps/gateway/internal/types"
|
||||
|
||||
xhttp "github.com/zeromicro/x/http"
|
||||
)
|
||||
|
||||
func TopListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.GetTopUpListReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := topup.NewTopListLogic(r.Context(), svcCtx)
|
||||
resp, err := l.TopList(&req)
|
||||
if err != nil {
|
||||
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
|
||||
} else {
|
||||
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user