fix(core): fixed site total Info issues, by 'ruhul'

This commit is contained in:
OldHawk
2017-10-13 18:56:20 +08:00
parent 42a38edf7c
commit c2809ba24d
2 changed files with 9 additions and 8 deletions

View File

@@ -6,10 +6,10 @@
.controller('HeaderController', HeaderController);
HeaderController.$inject = ['$scope', '$state', '$stateParams', '$translate', 'Authentication', 'menuService', 'MeanTorrentConfig', 'localStorageService',
'ScoreLevelService', 'InvitationsService', '$interval', 'MessagesService', 'TorrentsService', 'UsersService'];
'ScoreLevelService', 'InvitationsService', '$interval', 'MessagesService', 'TorrentsService', 'UsersService', 'DebugConsoleService'];
function HeaderController($scope, $state, $stateParams, $translate, Authentication, menuService, MeanTorrentConfig, localStorageService, ScoreLevelService,
InvitationsService, $interval, MessagesService, TorrentsService, UsersService) {
InvitationsService, $interval, MessagesService, TorrentsService, UsersService, mtDebug) {
var vm = this;
vm.user = Authentication.user;
vm.language = MeanTorrentConfig.meanTorrentConfig.language;
@@ -136,6 +136,7 @@
vm.getSiteInfo = function () {
TorrentsService.siteInfo(function (data) {
vm.siteInfo = data;
mtDebug.info(data);
});
};
}

View File

@@ -1296,13 +1296,13 @@ exports.siteInfo = function (req, res) {
res.json({
totalUsers: results[0],
totalTorrents: results[1],
totalTorrentsSize: results[2][0].size,
totalSeeders: results[2][0].seeders,
totalLeechers: results[2][0].leechers,
totalUploaded: results[3][0].uploaded,
totalDownloaded: results[3][0].downloaded,
totalTorrentsSize: results[2][0] ? results[2][0].size : 0,
totalSeeders: results[2][0] ? results[2][0].seeders : 0,
totalLeechers: results[2][0] ? results[2][0].leechers : 0,
totalUploaded: results[3][0] ? results[3][0].uploaded : 0,
totalDownloaded: results[3][0] ? results[3][0].downloaded : 0,
totalForumTopics: results[4],
totalForumReplies: results[5][0].replies,
totalForumReplies: results[5][0] ? results[5][0].replies : 0,
totalVipUsers: results[6]
});
}