From 8d2867be577d4fbda7d35ad0c3861ab330390181 Mon Sep 17 00:00:00 2001 From: momo <1012651275@qq.com> Date: Mon, 27 Nov 2023 16:37:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8B=E5=8D=95=E8=B0=83=E6=95=B4=E5=88=86?= =?UTF-8?q?=E5=B8=83=E5=BC=8F=E9=94=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order/internal/logic/createorderlogic.go | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/server/order/internal/logic/createorderlogic.go b/server/order/internal/logic/createorderlogic.go index 1e40a2a2..81beaddb 100644 --- a/server/order/internal/logic/createorderlogic.go +++ b/server/order/internal/logic/createorderlogic.go @@ -6,7 +6,6 @@ import ( "fusenapi/service/repositories" "fusenapi/utils/auth" "fusenapi/utils/basic" - "strconv" "sync" "time" @@ -47,14 +46,14 @@ func (l *CreateOrderLogic) CreateOrder(req *types.CreateOrderReq, userinfo *auth return resp.SetStatus(basic.CodeUnAuth) } - var lockKey string - for _, v := range req.CartIds { - var vStr = strconv.Itoa(int(v)) - lockKey = lockKey + "|" + vStr - } - // 分布式锁--防止重复下单 - LockWith(lockKey) //获取锁 - fmt.Println("获取到了锁") + // var lockKey string + // for _, v := range req.CartIds { + // var vStr = strconv.Itoa(int(v)) + // lockKey = lockKey + "|" + vStr + // } + // // 分布式锁--防止重复下单 + // LockWith(lockKey) //获取锁 + // fmt.Println("获取到了锁") tPlus60Days := time.Now().AddDate(0, 0, 60).UTC() res, err := l.svcCtx.Repositories.NewOrder.Create(l.ctx, &repositories.CreateReq{ @@ -66,7 +65,7 @@ func (l *CreateOrderLogic) CreateOrder(req *types.CreateOrderReq, userinfo *auth DeliveryMethod: constants.DELIVERYMETHODDSCLOUDSTORE, }) - UnlockWith(lockKey) //释放锁 + // UnlockWith(lockKey) //释放锁 if err != nil { return resp.SetStatus(&res.ErrorCode)