修复产品修改、删除
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
auth "tianyuan-api/apps/gateway/internal/handler/auth"
|
||||
base "tianyuan-api/apps/gateway/internal/handler/base"
|
||||
product "tianyuan-api/apps/gateway/internal/handler/product"
|
||||
topup "tianyuan-api/apps/gateway/internal/handler/topup"
|
||||
user "tianyuan-api/apps/gateway/internal/handler/user"
|
||||
userProduct "tianyuan-api/apps/gateway/internal/handler/userProduct"
|
||||
whitelistr "tianyuan-api/apps/gateway/internal/handler/whitelistr"
|
||||
@@ -79,6 +80,25 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||
rest.WithPrefix("/api/console/product"),
|
||||
)
|
||||
|
||||
server.AddRoutes(
|
||||
rest.WithMiddlewares(
|
||||
[]rest.Middleware{serverCtx.AuthInterceptor, serverCtx.EntAuthInterceptor},
|
||||
[]rest.Route{
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/aliTopUp",
|
||||
Handler: topup.AliTopUpHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/aliTopUpCallback",
|
||||
Handler: topup.AliTopUpCallbackHandler(serverCtx),
|
||||
},
|
||||
}...,
|
||||
),
|
||||
rest.WithPrefix("/api/console/topupfmghnjx"),
|
||||
)
|
||||
|
||||
server.AddRoutes(
|
||||
rest.WithMiddlewares(
|
||||
[]rest.Middleware{serverCtx.AuthInterceptor},
|
||||
@@ -111,6 +131,20 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||
server.AddRoutes(
|
||||
rest.WithMiddlewares(
|
||||
[]rest.Middleware{serverCtx.AuthInterceptor},
|
||||
[]rest.Route{
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/userProductList",
|
||||
Handler: userProduct.GetUserProductListHandler(serverCtx),
|
||||
},
|
||||
}...,
|
||||
),
|
||||
rest.WithPrefix("/api/console/user-product"),
|
||||
)
|
||||
|
||||
server.AddRoutes(
|
||||
rest.WithMiddlewares(
|
||||
[]rest.Middleware{serverCtx.AuthInterceptor, serverCtx.EntAuthInterceptor},
|
||||
[]rest.Route{
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
@@ -122,11 +156,6 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||
Path: "/userProductDel/:id",
|
||||
Handler: userProduct.DeleteUserProductHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/userProductList",
|
||||
Handler: userProduct.GetUserProductListHandler(serverCtx),
|
||||
},
|
||||
}...,
|
||||
),
|
||||
rest.WithPrefix("/api/console/user-product"),
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package topup
|
||||
|
||||
import (
|
||||
"github.com/smartwalle/alipay/v3"
|
||||
"net/http"
|
||||
|
||||
"tianyuan-api/apps/gateway/internal/logic/topup"
|
||||
"tianyuan-api/apps/gateway/internal/svc"
|
||||
)
|
||||
|
||||
func AliTopUpCallbackHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
l := topup.NewAliTopUpCallbackLogic(r.Context(), svcCtx)
|
||||
err := l.AliTopUpCallback(r)
|
||||
if err != nil {
|
||||
alipay.ACKNotification(w)
|
||||
}
|
||||
}
|
||||
}
|
||||
30
apps/gateway/internal/handler/topup/alitopuphandler.go
Normal file
30
apps/gateway/internal/handler/topup/alitopuphandler.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 AliTopUpHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.AliTopUpRequest
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := topup.NewAliTopUpLogic(r.Context(), svcCtx)
|
||||
resp, err := l.AliTopUp(&req)
|
||||
if err != nil {
|
||||
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
|
||||
} else {
|
||||
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user