feat(dataLogs): show user score change history

This commit is contained in:
OldHawk
2018-06-06 00:48:30 +08:00
parent 060a70c96c
commit e1d4537164
24 changed files with 430 additions and 50 deletions

View File

@@ -9,6 +9,7 @@ var path = require('path'),
errorHandler = require(path.resolve('./modules/core/server/controllers/errors.server.controller')),
UserDaysLog = mongoose.model('UserDaysLog'),
UserMonthsLog = mongoose.model('UserMonthsLog'),
ScoreLog = mongoose.model('ScoreLog'),
objectId = require('mongodb').ObjectId,
async = require('async');
@@ -36,3 +37,15 @@ exports.getUserMonthsLogs = function (req, res) {
res.json(logs);
});
};
/**
* List of getUserScoreLogs
*/
exports.getUserScoreLogs = function (req, res) {
ScoreLog.find({
user: objectId(req.params.userId)
}).sort('-createdAt')
.exec(function (err, logs) {
res.json(logs);
});
};