core: change regip to ip

This commit is contained in:
undefined committed 2021-09-13 21:08:31 +08:00
1 parent fae452cc94
commit 49a6165472
5 files changed
+24 -18

No files matched your search

+4 -3
View File
@@ -71,7 +71,7 @@ class User implements _User {
this._dudoc = dudoc;
this._salt = udoc.salt;
this._hash = udoc.hash;
this._regip = udoc.regip;
this._regip = udoc.ip[0];
this._loginip = udoc.loginip;
this._files = udoc._files || [];
@@ -147,7 +147,7 @@ class UserModel {
priv: 0,
regat: new Date('2000-01-01'),
loginat: new Date('2000-01-01'),
regip: '127.0.0.1',
ip: ['127.0.0.1'],
loginip: '127.0.0.1',
};
@@ -206,6 +206,7 @@ class UserModel {
const op: any = {};
if ($set && Object.keys($set).length) op.$set = $set;
if ($unset && Object.keys($unset).length) op.$unset = $unset;
if (op.$set?.loginIp) op.$addToSet = { ip: op.$set.loginIp };
const res = await coll.findOneAndUpdate({ _id: uid }, op, { returnDocument: 'after' });
deleteUserCache(res.value);
return res;
@@ -264,7 +265,7 @@ class UserModel {
salt,
hashType: 'hydro',
regat: new Date(),
regip,
ip: [regip],
loginat: new Date(),
loginip: regip,
priv,