From 20ad1818e0bf9849ea9c275cc7500aba11d42ad7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E9=92=8A?= Date: Thu, 16 Oct 2025 20:18:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E9=9C=80=E6=B1=82-=E6=B4=BB=E5=8A=A8?= =?UTF-8?q?=E9=9C=80=E6=B1=82-=E7=9B=B2=E7=9B=92=E8=BD=AC=E7=9B=98?= =?UTF-8?q?=E8=B0=83=E9=80=9A=E7=9B=98-=E5=B7=A1=E4=B9=90=E4=BC=9A-?= =?UTF-8?q?=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/BlindBoxTurntableGiftDrawWorld.php | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/application/api/model/BlindBoxTurntableGiftDrawWorld.php b/application/api/model/BlindBoxTurntableGiftDrawWorld.php index 874f6c9..8586423 100644 --- a/application/api/model/BlindBoxTurntableGiftDrawWorld.php +++ b/application/api/model/BlindBoxTurntableGiftDrawWorld.php @@ -493,9 +493,9 @@ class BlindBoxTurntableGiftDrawWorld extends Model $bagGiftPrice = $bag_data['gift_price'] * $num * $gift_user_num; // 增加重试机制 - $maxRetries = 3; - for ($retry = 0; $retry < $maxRetries; $retry++) { - try { +// $maxRetries = 3; +// for ($retry = 0; $retry < $maxRetries; $retry++) { +// try { db::startTrans(); // 按照固定顺序处理事务步骤 // 1. 扣除用户金币(优先处理) @@ -540,17 +540,17 @@ class BlindBoxTurntableGiftDrawWorld extends Model 'gift_counts' => $giftCounts ] ]; - } catch (\Exception $e) { - db::rollback(); - // 检查是否是死锁错误 - if (strpos($e->getMessage(), 'Deadlock') !== false && $retry < $maxRetries - 1) { - // 等待随机时间后重试 - usleep(rand(10000, 100000)); // 10-100ms - continue; - } - return ['code' => 0, 'msg' => $e->getMessage(), 'data' => null]; - } - } +// } catch (\Exception $e) { +// db::rollback(); +// // 检查是否是死锁错误 +// if (strpos($e->getMessage(), 'Deadlock') !== false && $retry < $maxRetries - 1) { +// // 等待随机时间后重试 +// usleep(rand(10000, 100000)); // 10-100ms +// continue; +// } +// return ['code' => 0, 'msg' => $e->getMessage(), 'data' => null]; +// } +// } return ['code' => 0, 'msg' => '操作超时,请重试', 'data' => null]; }