mirror of
https://github.com/maierfelix/POGOserver.git
synced 2026-04-02 07:15:06 -05:00
Fixed MySQL User loading
This commit is contained in:
parent
fdc2318023
commit
28805445c9
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1 +1,2 @@
|
|||
.idea
|
||||
node_modules/
|
||||
|
|
|
|||
|
|
@ -101,8 +101,11 @@ export function createTable(name) {
|
|||
export function getUserByEmail(email) {
|
||||
return new Promise((resolve) => {
|
||||
this.db.instance.query(`SELECT * FROM ${CFG.SERVER_MYSQL_TABLE} WHERE email=? LIMIT 1`, [email], (e, rows, fields) => {
|
||||
if (e) console.log(e);
|
||||
else resolve(rows);
|
||||
if (e) {
|
||||
console.log(e);
|
||||
} else {
|
||||
resolve(rows[0]);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,7 +77,11 @@ class Player {
|
|||
updateByObject(obj) {
|
||||
for (let key in obj) {
|
||||
if (this.hasOwnProperty(key)) {
|
||||
this[key] = obj[key];
|
||||
if (key == 'send_marketing_emails' || key == 'send_push_notifications') {
|
||||
this[key] = !!obj[key];
|
||||
} else {
|
||||
this[key] = obj[key];
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -283,6 +287,7 @@ export function loginPlayer() {
|
|||
|
||||
return new Promise((resolve) => {
|
||||
this.getUserByEmail(player.email).then((doc) => {
|
||||
console.log(doc);
|
||||
player.updateByObject(doc);
|
||||
buffer = GetPlayer(player).encode();
|
||||
resolve(buffer);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user