feat(core): add table users and torrents global update method

for some fields update with time limit
This commit is contained in:
OldHawk
2017-11-03 21:42:14 +08:00
parent 571c2a953d
commit 9835f536ad
8 changed files with 40 additions and 1 deletions

View File

@@ -124,6 +124,9 @@
<dt class="h-line">{{ 'STATUS_FIELD.LATEST_SIGNED_TIME' | translate}}</dt>
<dd class="h-line">{{ vm.user.last_signed | date: 'yyyy-MM-dd HH:mm:ss' }}</dd>
<dt class="h-line">{{ 'STATUS_FIELD.LATEST_REFRESH_TIME' | translate}}</dt>
<dd class="h-line">{{ vm.user.refreshat | date: 'yyyy-MM-dd HH:mm:ss' }}</dd>
<dt class="h-line">{{ 'STATUS_FIELD.SIGNED_IP' | translate}}</dt>
<dd class="h-line">
<div class="list-all-ips">

View File

@@ -96,6 +96,9 @@
<dt class="h-line">{{ 'STATUS_FIELD.LATEST_SIGNED_TIME' | translate}}</dt>
<dd class="h-line">{{ vm.user.last_signed | date: 'yyyy-MM-dd HH:mm:ss' }}</dd>
<dt class="h-line">{{ 'STATUS_FIELD.LATEST_REFRESH_TIME' | translate}}</dt>
<dd class="h-line">{{ vm.user.refreshat | date: 'yyyy-MM-dd HH:mm:ss' }}</dd>
<dt class="h-line">{{ 'STATUS_FIELD.SIGNED_IP' | translate}}</dt>
<dd class="h-line">
<div class="list-all-ips">

View File

@@ -209,6 +209,10 @@ var UserSchema = new Schema({
type: Date,
default: Date.now
},
refreshat: {
type: Date,
default: Date.now
},
/* For reset password */
resetPasswordToken: {
type: String
@@ -357,6 +361,15 @@ UserSchema.methods.addLeechedIp = function (ip) {
}).exec();
};
/**
* globalUpdateMethod
*/
UserSchema.methods.globalUpdateMethod = function () {
this.update({
$set: {refreshat: Date.now()}
}).exec();
};
/**
* update user last client_agent
* @param ip