Sfoglia il codice sorgente

fix(order): 缩短订单创建防重提交锁的有效时间

- 将 Redis 锁的过期时间从 30 秒调整为 15 秒
- 防止长时间锁定导致用户无法重新提交订单
- 优化并发场景下的用户体验
shichen 2 mesi fa
parent
commit
cac5c7fc54
1 ha cambiato i file con 1 aggiunte e 1 eliminazioni
  1. 1 1
      app/controller/api/store/order/StoreGroupOrder.php

+ 1 - 1
app/controller/api/store/order/StoreGroupOrder.php

@@ -58,7 +58,7 @@ class StoreGroupOrder extends BaseController
58 58
         $redisHandler = Cache::store('redis')->handler();
59 59
         $cartIdList = $storeOrderCreateRequestEntity->getCartIdList();
60 60
         sort($cartIdList);
61
-        $isSet = $redisHandler->set('createStoreGroupOrder' . '-' . implode('-', $cartIdList), 1, ['nx', 'ex' => 30]);
61
+        $isSet = $redisHandler->set('createStoreGroupOrder' . '-' . implode('-', $cartIdList), 1, ['nx', 'ex' => 15]);
62 62
         if (!$isSet) {
63 63
             return app('json')->fail('请勿重复下单');
64 64
         }