opt(announce): optimization announce data

This commit is contained in:
OldHawk
2017-12-24 08:57:17 +08:00
parent 67241fa552
commit 328a05e437
4 changed files with 63 additions and 43 deletions

View File

@@ -163,7 +163,7 @@ exports.list = function (req, res) {
];
}
mtDebug.debugBlue(condition);
mtDebug.debugBlue(condition, 'ADMIN_USERS_LIST');
var countQuery = function (callback) {
User.count(condition, function (err, count) {

View File

@@ -391,7 +391,7 @@ UserSchema.methods.globalUpdateMethod = function () {
/**
* updateSeedLeechNumbers
*/
UserSchema.methods.updateSeedLeechNumbers = function () {
UserSchema.methods.updateSeedLeechNumbers = function (callback) {
var user = this;
Peer.aggregate({
@@ -424,7 +424,15 @@ UserSchema.methods.updateSeedLeechNumbers = function () {
seeded: sc,
leeched: lc
}
}).exec();
}, function (err) {
if (callback) {
callback({seedCount: sc, leechCount: lc});
}
});
} else {
if (callback) {
callback(null);
}
}
});
};