诸侯混战:防止多次发送奖励
This commit is contained in:
@@ -52,6 +52,23 @@ export class CityActivityObject {
|
||||
return Math.floor((Date.now() - this.startTime)/1000);
|
||||
}
|
||||
|
||||
public lockCity(serverId: number, cityId: number) {
|
||||
if(this.hasSent(serverId, cityId)) return false;
|
||||
this.unlockCity(serverId, cityId);
|
||||
return true;
|
||||
}
|
||||
|
||||
private unlockCity(serverId: number, cityId: number) {
|
||||
let key = this.getKey(serverId, cityId);
|
||||
// let guildCodes = this.cities.get(key)||[];
|
||||
// for(let guildCode of guildCodes) {
|
||||
// this.members.delete(guildCode);
|
||||
// this.guilds.delete(guildCode);
|
||||
// }
|
||||
// this.cities.delete(key);
|
||||
this.sentCity.push(key);
|
||||
}
|
||||
|
||||
public hasSent(serverId: number, cityId: number) {
|
||||
let key = this.getKey(serverId, cityId);
|
||||
return this.sentCity.indexOf(key) != -1;
|
||||
@@ -130,15 +147,4 @@ export class CityActivityObject {
|
||||
}
|
||||
this.guilds.set(guildCode, cityId);
|
||||
}
|
||||
|
||||
public delCityRecord(cityId: number, serverId: number) {
|
||||
let key = this.getKey(serverId, cityId);
|
||||
// let guildCodes = this.cities.get(key)||[];
|
||||
// for(let guildCode of guildCodes) {
|
||||
// this.members.delete(guildCode);
|
||||
// this.guilds.delete(guildCode);
|
||||
// }
|
||||
// this.cities.delete(key);
|
||||
this.sentCity.push(key);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user