|
@@ -10,7 +10,7 @@ export class UsersService {
|
|
|
@InjectRedis() private readonly redis: Redis,
|
|
|
@Inject(forwardRef(() => RoomService))
|
|
|
private roomService: RoomService,
|
|
|
- ) {}
|
|
|
+ ) { }
|
|
|
|
|
|
async isUserInRooms(RoomId: string, UserId: string): Promise<boolean> {
|
|
|
const res = await this.redis.hexists(
|
|
@@ -119,6 +119,20 @@ export class UsersService {
|
|
|
`'room setting: ${RoomId},isExist:${isExist} `,
|
|
|
'room-config',
|
|
|
);
|
|
|
+ // 存在正常房间ttl存活时间
|
|
|
+ if (RoomConfig?.ttl) {
|
|
|
+ this.roomService.logger.log(
|
|
|
+ `'正常设置房间-ttl: ${RoomConfig.ttl}`,
|
|
|
+ 'room-ttl',
|
|
|
+ );
|
|
|
+ await this.redis.set(
|
|
|
+ `kankan:socket:tempRoom:${RoomId}`,
|
|
|
+ '',
|
|
|
+ 'EX',
|
|
|
+ RoomConfig.ttl,
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
if (isExist) {
|
|
|
const config = JSON.parse(isExist);
|
|
|
const obj = Object.assign({}, config, RoomConfig);
|