mirror of
https://github.com/AsgardEternal/SquadJSDocker.git
synced 2025-01-02 13:19:20 -06:00
Update db-log-addOn.js
This commit is contained in:
parent
8080df93b1
commit
9a6e18a691
@ -139,30 +139,33 @@ export default class DBLogPlayerTime extends DBLog {
|
|||||||
|
|
||||||
async onPlayerConnected(info) {
|
async onPlayerConnected(info) {
|
||||||
console.log(info);
|
console.log(info);
|
||||||
if(info.player){
|
if(info.player){
|
||||||
await this.models.SteamUser.upsert({
|
await this.models.SteamUser.upsert({
|
||||||
steamID: info.player.steamID,
|
steamID: info.player.steamID,
|
||||||
lastName: info.player.name
|
lastName: info.player.name
|
||||||
});
|
});
|
||||||
await this.models.PlayerTime.create({
|
await this.models.PlayerTime.create({
|
||||||
server: this.options.overrideServerID || this.server.id,
|
server: this.options.overrideServerID || this.server.id,
|
||||||
player: info.steamID,
|
player: info.steamID,
|
||||||
joinTime: info.time,
|
joinTime: info.time,
|
||||||
joinedSeeding: this.seeding
|
joinedSeeding: this.seeding
|
||||||
});}
|
});
|
||||||
else console.log('player is null');
|
console.log('player connect complete');
|
||||||
|
} else console.log('player is null');
|
||||||
}
|
}
|
||||||
|
|
||||||
async onPlayerDisconnected(info) {
|
async onPlayerDisconnected(info) {
|
||||||
console.log(info);
|
console.log(info);
|
||||||
if(info.player){
|
if(info.player){
|
||||||
await this.models.SteamUser.upsert({
|
await this.models.SteamUser.upsert({
|
||||||
steamID: info.player.steamID,
|
steamID: info.player.steamID,
|
||||||
lastName: info.player.name
|
lastName: info.player.name
|
||||||
});}
|
});
|
||||||
await this.models.PlayerTime.update(
|
}
|
||||||
{ leaveTime: info.time },
|
let rowAffect = await this.models.PlayerTime.update(
|
||||||
{ where: { player: info.steamID, leaveTime: null, server: this.options.overrideServerID || this.server.id } }
|
{ leaveTime: info.time },
|
||||||
);
|
{ where: { player: info.steamID, leaveTime: null, server: this.options.overrideServerID || this.server.id } }
|
||||||
|
);
|
||||||
|
console.log('player disconnect rows update: %i', rowAffect[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user