This commit is contained in:
laodaming
2023-09-20 11:05:59 +08:00
parent d8707e3a4a
commit f284702448
5 changed files with 1 additions and 122 deletions

View File

@@ -1,35 +0,0 @@
package handler
import (
"net/http"
"reflect"
"fusenapi/utils/basic"
"fusenapi/server/shopping-cart/internal/logic"
"fusenapi/server/shopping-cart/internal/svc"
"fusenapi/server/shopping-cart/internal/types"
)
func ModifyCartPurchaseQuantityHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.ModifyCartPurchaseQuantityReq
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}
// 创建一个业务逻辑层实例
l := logic.NewModifyCartPurchaseQuantityLogic(r.Context(), svcCtx)
rl := reflect.ValueOf(l)
basic.BeforeLogic(w, r, rl)
resp := l.ModifyCartPurchaseQuantity(&req, userinfo)
if !basic.AfterLogic(w, r, rl, resp) {
basic.NormalAfterLogic(w, r, resp)
}
}
}

View File

@@ -22,11 +22,6 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
Path: "/api/shopping-cart/delete",
Handler: DeleteCartHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/api/shopping-cart/modify",
Handler: ModifyCartPurchaseQuantityHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/api/shopping-cart/get_carts",