补齐座驾购买金币流水

This commit is contained in:
pllx
2026-04-30 10:02:59 +08:00
parent 363c45a140
commit b60f3615c1
5 changed files with 58 additions and 10 deletions
+11 -4
View File
@@ -16,10 +16,17 @@ abstract class TestCase extends BaseTestCase
*/
protected function flushChatRoomRedisState(): void
{
$keys = Redis::keys('room:*');
$prefix = config('database.redis.options.prefix', '');
$cursor = '0';
if ($keys !== []) {
Redis::del(...$keys);
}
do {
[$cursor, $keys] = Redis::scan($cursor, ['match' => $prefix.'room:*', 'count' => 200]);
foreach ($keys ?? [] as $fullKey) {
// Laravel Redis Facade 写入时会自动追加前缀,删除时要还原成业务短 key。
$shortKey = $prefix ? substr((string) $fullKey, strlen($prefix)) : (string) $fullKey;
Redis::del($shortKey);
}
} while ($cursor !== '0');
}
}