补齐座驾购买金币流水
This commit is contained in:
+11
-4
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user