From d012b82fcec10b607a1e6de27b9931ddb8823740 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E9=92=8A?= Date: Sat, 27 Sep 2025 10:14:42 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E8=B6=85=E5=87=BA=E5=8F=91?= =?UTF-8?q?=E6=94=BE=E7=A4=BC=E7=89=A9=E9=97=AE=E9=A2=98-=E5=B7=A1?= =?UTF-8?q?=E4=B9=90=E4=BC=9A-=E5=8A=A0=E6=B8=85=E9=99=A4=E7=BC=93?= =?UTF-8?q?=E5=AD=98=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/model/BlindBoxTurntableGiftDraw.php | 36 ++----------------- 1 file changed, 2 insertions(+), 34 deletions(-) diff --git a/application/api/model/BlindBoxTurntableGiftDraw.php b/application/api/model/BlindBoxTurntableGiftDraw.php index 0ddc041..362c000 100644 --- a/application/api/model/BlindBoxTurntableGiftDraw.php +++ b/application/api/model/BlindBoxTurntableGiftDraw.php @@ -1576,43 +1576,11 @@ class BlindBoxTurntableGiftDraw extends Model 'num' => $num, 'gift_user_ids' => $gift_user_ids, 'precomputed_results_count' => count($precomputedResults), + 'precomputed_results' => $precomputedResults, 'error_type' => 'draw_count_mismatch' ]; // 将错误信息推送到Redis列表中 - $this->redis->lpush('blind_box_draw_errors', json_encode($errorData)); - - // 同时记录到哈希结构,便于按房间ID或用户ID查询 - $errorKey = 'blind_box_error:' . $room_id . ':' . time() . ':' . uniqid(); - $this->redis->hmset($errorKey, $errorData); - $this->redis->expire($errorKey, 86400 * 7); // 设置1天过期时间 + $this->redis->set('blind_box_draw_errors', json_encode($errorData),86400 * 7); } - - /** - * 获取抽奖错误统计信息 - */ - public function getDrawErrorStats() - { - $errors = $this->redis->lrange('blind_box_draw_errors', 0, 99); // 获取最近100条错误记录 - $stats = [ - 'total_errors' => $this->redis->llen('blind_box_draw_errors'), - 'recent_errors' => [], - 'error_distribution' => [] - ]; - - foreach ($errors as $error) { - $errorData = json_decode($error, true); - $stats['recent_errors'][] = $errorData; - - // 统计错误分布 - $errorType = $errorData['error_type'] ?? 'unknown'; - if (!isset($stats['error_distribution'][$errorType])) { - $stats['error_distribution'][$errorType] = 0; - } - $stats['error_distribution'][$errorType]++; - } - - return $stats; - } - }