fix(reversi/backend): refactor and fixes
This commit is contained in:
parent
5719a929ad
commit
60156a40b2
|
@ -120,7 +120,9 @@ export class ReversiService implements OnApplicationShutdown, OnModuleInit {
|
||||||
if (invitations.includes(targetUser.id)) {
|
if (invitations.includes(targetUser.id)) {
|
||||||
await this.redisClient.zrem(`reversi:matchSpecific:${me.id}`, targetUser.id);
|
await this.redisClient.zrem(`reversi:matchSpecific:${me.id}`, targetUser.id);
|
||||||
|
|
||||||
const game = await this.matched(targetUser.id, me.id);
|
const game = await this.matched(targetUser.id, me.id, {
|
||||||
|
noIrregularRules: false,
|
||||||
|
});
|
||||||
|
|
||||||
return game;
|
return game;
|
||||||
}
|
}
|
||||||
|
@ -166,7 +168,9 @@ export class ReversiService implements OnApplicationShutdown, OnModuleInit {
|
||||||
const invitorId = invitations[Math.floor(Math.random() * invitations.length)];
|
const invitorId = invitations[Math.floor(Math.random() * invitations.length)];
|
||||||
await this.redisClient.zrem(`reversi:matchSpecific:${me.id}`, invitorId);
|
await this.redisClient.zrem(`reversi:matchSpecific:${me.id}`, invitorId);
|
||||||
|
|
||||||
const game = await this.matched(invitorId, me.id);
|
const game = await this.matched(invitorId, me.id, {
|
||||||
|
noIrregularRules: false,
|
||||||
|
});
|
||||||
|
|
||||||
return game;
|
return game;
|
||||||
}
|
}
|
||||||
|
@ -214,10 +218,7 @@ export class ReversiService implements OnApplicationShutdown, OnModuleInit {
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public async matchAnyUserCancel(user: MiUser) {
|
public async matchAnyUserCancel(user: MiUser) {
|
||||||
const redisPipeline = this.redisClient.pipeline();
|
await this.redisClient.zrem('reversi:matchAny', user.id, user.id + ':noIrregularRules');
|
||||||
redisPipeline.zrem('reversi:matchAny', user.id);
|
|
||||||
redisPipeline.zrem('reversi:matchAny', user.id + ':noIrregularRules');
|
|
||||||
await redisPipeline.exec();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
|
|
Loading…
Reference in New Issue