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; - } - }