mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-07-28 15:59:45 +02:00
feat(dataLogs): show user score change history
This commit is contained in:
29
config/env/torrents.js
vendored
29
config/env/torrents.js
vendored
@@ -371,8 +371,8 @@ module.exports = {
|
||||
accountIdleForTime: 60 * 60 * 1000 * 24 * 30, //30 days
|
||||
accountIdleForTime_str: '30d',
|
||||
activeIdleAccountBasicScore: 50000,
|
||||
activeMoreScorePerDay: 1000,
|
||||
activeMoreScorePerLevel: 10000,
|
||||
activeMoreScorePerDay: 100,
|
||||
activeMoreScorePerLevel: 1000,
|
||||
notIdleSafeLevel: 30
|
||||
}
|
||||
},
|
||||
@@ -472,18 +472,21 @@ module.exports = {
|
||||
transferScoreIntoInviterFrom: {name: 'transferScoreIntoInviterFrom', content: 'TRANSFER_SCORE_INTO_INVITER_FROM', value: 0, enable: true},
|
||||
transferScoreIntoInviterTo: {name: 'transferScoreIntoInviterTo', content: 'TRANSFER_SCORE_INTO_INVITER_TO', value: 0, enable: true},
|
||||
|
||||
uploadTorrent: {name: 'uploadTorrent', content: 'UPLOAD_TORRENT', value: 50, enable: true},
|
||||
uploadTorrentBeDeleted: {name: 'uploadTorrentBeDeleted', content: 'UPLOAD_TORRENT_BE_DELETED', value: -50, enable: true},
|
||||
uploadTorrentBeRecommend: {name: 'uploadTorrentBeRecommend', content: 'UPLOAD_TORRENT_BE_RECOMMEND', value: 10, enable: true},
|
||||
uploadSubtitle: {name: 'uploadSubtitle', content: 'UPLOAD_SUBTITLE', value: 20, enable: true},
|
||||
uploadSubtitleBeDeleted: {name: 'uploadSubtitleBeDeleted', content: 'UPLOAD_SUBTITLE_BE_DELETED', value: -20, enable: true},
|
||||
uploadTorrent: {name: 'uploadTorrent', content: 'UPLOAD_TORRENT', value: 20, enable: true},
|
||||
uploadTorrentBeDeleted: {name: 'uploadTorrentBeDeleted', content: 'UPLOAD_TORRENT_BE_DELETED', value: -20, enable: true},
|
||||
uploadTorrentBeRecommend: {name: 'uploadTorrentBeRecommend', content: 'UPLOAD_TORRENT_BE_RECOMMEND', value: 5, enable: true},
|
||||
uploadSubtitle: {name: 'uploadSubtitle', content: 'UPLOAD_SUBTITLE', value: 10, enable: true},
|
||||
uploadSubtitleBeDeleted: {name: 'uploadSubtitleBeDeleted', content: 'UPLOAD_SUBTITLE_BE_DELETED', value: -10, enable: true},
|
||||
|
||||
thumbsUpScoreOfTorrentFrom: {name: 'thumbsUpScoreOfTorrentFrom', content: 'THUMBS_UP_SCORE_OF_TORRENT_FROM', value: -10, enable: true},
|
||||
thumbsUpScoreOfTorrentTo: {name: 'thumbsUpScoreOfTorrentTo', content: 'THUMBS_UP_SCORE_OF_TORRENT_TO', value: 10, enable: true},
|
||||
thumbsUpScoreOfTopicFrom: {name: 'thumbsUpScoreOfTopicFrom', content: 'THUMBS_UP_SCORE_OF_TOPIC_FROM', value: -10, enable: true},
|
||||
thumbsUpScoreOfTopicTo: {name: 'thumbsUpScoreOfTopicTo', content: 'THUMBS_UP_SCORE_OF_TOPIC_TO', value: 10, enable: true},
|
||||
thumbsUpScoreOfTorrentFrom: {name: 'thumbsUpScoreOfTorrentFrom', content: 'THUMBS_UP_SCORE_OF_TORRENT_FROM', value: -5, enable: true},
|
||||
thumbsUpScoreOfTorrentTo: {name: 'thumbsUpScoreOfTorrentTo', content: 'THUMBS_UP_SCORE_OF_TORRENT_TO', value: 5, enable: true},
|
||||
thumbsUpScoreOfTopicFrom: {name: 'thumbsUpScoreOfTopicFrom', content: 'THUMBS_UP_SCORE_OF_TOPIC_FROM', value: -5, enable: true},
|
||||
thumbsUpScoreOfTopicTo: {name: 'thumbsUpScoreOfTopicTo', content: 'THUMBS_UP_SCORE_OF_TOPIC_TO', value: 5, enable: true},
|
||||
|
||||
requestPost: {name: 'requestPost', content: 'REQUEST_POST', value: 0, enable: true}, //value used requests.scoreForAddRequest
|
||||
requestAcceptFrom: {name: 'requestAcceptFrom', content: 'REQUEST_ACCEPT_FROM', value: 0, enable: true}, //value form user setting
|
||||
requestAcceptTo: {name: 'requestAcceptTo', content: 'REQUEST_ACCEPT_TO', value: 0, enable: true}, //value form user setting
|
||||
|
||||
postRequest: {name: 'postRequest', content: 'POST_REQUEST', value: 0, enable: true}, //value used requests.scoreForAddRequest
|
||||
scoreExchangeInvitation: {name: 'scoreExchangeInvitation', content: 'SCORE_EXCHANGE_INVITATION', value: 0, enable: true}, //value used invite.scoreExchange
|
||||
scoreToRemoveWarning: {name: 'scoreToRemoveWarning', content: 'SCORETO_REMOVE_WARNING', value: 0, enable: true}, //value used hitAndRun.scoreToRemoveWarning
|
||||
activeIdleAccount: {name: 'activeIdleAccount', content: 'ACTIVE_IDLE_ACCOUNT', value: 0, enable: true}, //value used sign.idle.activeIdleAccountBasicScore
|
||||
@@ -1425,6 +1428,7 @@ module.exports = {
|
||||
* @torrentPeersListPerPage: torrent detail seeder & leecher users list page settings
|
||||
* @officialInvitationsListPerPage: official invitations list page settings
|
||||
* @userInvitationsListPerPage: users invitations list page settings
|
||||
* @userDataLogsListPerPage: users data history logs list page settings
|
||||
*
|
||||
* @uploaderUserListPerPage: admin management uploader access list page settings
|
||||
* @messageBoxListPerPage: message box list page settings
|
||||
@@ -1461,6 +1465,7 @@ module.exports = {
|
||||
torrentPeersListPerPage: 20,
|
||||
officialInvitationsListPerPage: 20,
|
||||
userInvitationsListPerPage: 10,
|
||||
userDataLogsListPerPage: 20,
|
||||
|
||||
uploaderUserListPerPage: 20,
|
||||
messageBoxListPerPage: 10,
|
||||
|
||||
@@ -414,9 +414,20 @@ function transferUserScoreToInviter() {
|
||||
|
||||
if (transValue > 0) {
|
||||
if (scoreConfig.transferToInviter.deductFromUser) {
|
||||
scoreUpdate(undefined, l.user, scoreConfig.action.transferScoreIntoInviterFrom, -(transValue));
|
||||
var actFrom = scoreConfig.action.transferScoreIntoInviterFrom;
|
||||
actFrom.params = {
|
||||
uid: l.user.invited_by._id,
|
||||
uname: l.user.invited_by.displayName
|
||||
};
|
||||
scoreUpdate(undefined, l.user, actFrom, -(transValue));
|
||||
}
|
||||
scoreUpdate(undefined, l.user.invited_by, scoreConfig.action.transferScoreIntoInviterTo, transValue);
|
||||
|
||||
var actTo = scoreConfig.action.transferScoreIntoInviterTo;
|
||||
actTo.params = {
|
||||
uid: l.user._id,
|
||||
uname: l.user.displayName
|
||||
};
|
||||
scoreUpdate(undefined, l.user.invited_by, actTo, transValue);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -660,7 +660,7 @@ exports.announce = function (req, res) {
|
||||
totalScore = Math.round(totalScore * 100) / 100;
|
||||
|
||||
action.params = {
|
||||
torrent: req.torrent._id
|
||||
tid: req.torrent._id
|
||||
};
|
||||
scoreUpdate(req, req.passkeyuser, action, totalScore, false);
|
||||
mtDebug.debugRed('announce score: ' + totalScore, 'ANNOUNCE', true, req.passkeyuser);
|
||||
@@ -812,7 +812,7 @@ exports.announce = function (req, res) {
|
||||
seedScore = Math.round(seedScore * 100) / 100;
|
||||
|
||||
action.params = {
|
||||
torrent: req.torrent._id
|
||||
tid: req.torrent._id
|
||||
};
|
||||
scoreUpdate(req, req.passkeyuser, action, seedScore);
|
||||
mtDebug.debugRed('seed timed score: ' + seedScore, 'ANNOUNCE', true, req.passkeyuser);
|
||||
|
||||
@@ -1476,6 +1476,32 @@
|
||||
LEGEND_UNIT: ' (unit: GB)'
|
||||
},
|
||||
|
||||
//score log
|
||||
SCORE_LOG: {
|
||||
DEFAULT_ACTION: 'Undefined events increased score',
|
||||
ADMIN_MODIFY: 'Administrator <a href=/userinfo/{{uid}}>{{uname}}</a> modify score',
|
||||
TRANSFER_SCORE_INTO_INVITER_FROM: 'Transfer score of last month to your inviter <a href=/userinfo/{{uid}}>{{uname}}</a>',
|
||||
TRANSFER_SCORE_INTO_INVITER_TO: 'The system increased the score reward of last month by invited user <a href=/userinfo/{{uid}}>{{uname}}</a>',
|
||||
UPLOAD_TORRENT: 'Uploaded torrent was reviewed <a href=/torrents/{{tid}}>{{tid}}</a>',
|
||||
UPLOAD_TORRENT_BE_DELETED: 'Uploaded torrent was deleted <a href=/torrents/{{tid}}>{{tid}}</a>',
|
||||
UPLOAD_TORRENT_BE_RECOMMEND: 'Uploaded torrent was recommended <a href=/torrents/{{tid}}>{{tid}}</a>',
|
||||
UPLOAD_SUBTITLE: 'Upload subtitle file for torrent <a href=/torrents/{{tid}}>{{tid}}</a>',
|
||||
UPLOAD_SUBTITLE_BE_DELETED: 'Uploaded subtitle file was deleted <a href=/torrents/{{tid}}>{{tid}}</a>',
|
||||
THUMBS_UP_SCORE_OF_TORRENT_FROM: 'Thumbs up for torrent <a href=/torrents/{{tid}}>{{tid}}</a>',
|
||||
THUMBS_UP_SCORE_OF_TORRENT_TO: 'Uploaded torrent received a thumbs up <a href=/torrents/{{tid}}>{{tid}}</a>',
|
||||
THUMBS_UP_SCORE_OF_TOPIC_FROM: 'Thumbs up for forum topic or reply <a href=/forums/{{fid}}/{{tid}}>{{tid}}</a>',
|
||||
THUMBS_UP_SCORE_OF_TOPIC_TO: 'Posted forum topic or reply received a thumbs up <a href=/forums/{{fid}}/{{tid}}>{{tid}}</a>',
|
||||
REQUEST_POST: 'Posted a torrent request <a href=/requests/{{rid}}>{{rid}}',
|
||||
REQUEST_ACCEPT_FROM: 'Accept a response for request <a href=/requests/{{rid}}>{{rid}}',
|
||||
REQUEST_ACCEPT_TO: 'Your response of request was accepted <a href=/requests/{{rid}}>{{rid}}',
|
||||
SCORE_EXCHANGE_INVITATION: 'Exchange an invitation',
|
||||
SCORETO_REMOVE_WARNING: 'Remove a H&R warning <a href=/torrents/{{tid}}>{{tid}}</a>',
|
||||
ACTIVE_IDLE_ACCOUNT: 'Active account idle status',
|
||||
DAILY_CHECK_IN: 'Daily check in',
|
||||
SEED_TIMED: 'Torrent seeding timed increased score <a href=/torrents/{{tid}}>{{tid}}',
|
||||
SEED_UP_DOWNLOAD: 'Torrent seeding and leeching data transfer score <a href=/torrents/{{tid}}>{{tid}}'
|
||||
},
|
||||
|
||||
//status pages
|
||||
STATUS_PAGE: {
|
||||
BAD_REQUEST: 'Bad Request',
|
||||
|
||||
@@ -1476,6 +1476,32 @@
|
||||
LEGEND_UNIT: ' (單位: GB)'
|
||||
},
|
||||
|
||||
//score log
|
||||
SCORE_LOG: {
|
||||
DEFAULT_ACTION: '未知事件獲得的積分',
|
||||
ADMIN_MODIFY: '管理員 <a href=/userinfo/{{uid}}>{{uname}}</a> 修改積分',
|
||||
TRANSFER_SCORE_INTO_INVITER_FROM: '結算上個月的積分給您的邀請人 <a href=/userinfo/{{uid}}>{{uname}}</a>',
|
||||
TRANSFER_SCORE_INTO_INVITER_TO: '系統發放被邀請用戶 <a href=/userinfo/{{uid}}>{{uname}}</a> 上個月的積分獎勵',
|
||||
UPLOAD_TORRENT: '上傳的種子被審核通過 <a href=/torrents/{{tid}}>{{tid}}</a>',
|
||||
UPLOAD_TORRENT_BE_DELETED: '上傳的種子被刪除 <a href=/torrents/{{tid}}>{{tid}}</a>',
|
||||
UPLOAD_TORRENT_BE_RECOMMEND: '上傳的種子被推薦 <a href=/torrents/{{tid}}>{{tid}}</a>',
|
||||
UPLOAD_SUBTITLE: '為種子上傳字幕文件 <a href=/torrents/{{tid}}>{{tid}}</a>',
|
||||
UPLOAD_SUBTITLE_BE_DELETED: '上傳的字幕文件被刪除 <a href=/torrents/{{tid}}>{{tid}}</a>',
|
||||
THUMBS_UP_SCORE_OF_TORRENT_FROM: '為種子點贊 <a href=/torrents/{{tid}}>{{tid}}</a>',
|
||||
THUMBS_UP_SCORE_OF_TORRENT_TO: '上傳的種子收到一個贊 <a href=/torrents/{{tid}}>{{tid}}</a>',
|
||||
THUMBS_UP_SCORE_OF_TOPIC_FROM: '為論壇主題或回复點贊 <a href=/forums/{{fid}}/{{tid}}>{{tid}}</a>',
|
||||
THUMBS_UP_SCORE_OF_TOPIC_TO: '發表的論壇主題或回複收到一個贊 <a href=/forums/{{fid}}/{{tid}}>{{tid}}</a>',
|
||||
REQUEST_POST: '發布了一條求種請求 <a href=/requests/{{rid}}>{{rid}}',
|
||||
REQUEST_ACCEPT_FROM: '接受了求種響應 <a href=/requests/{{rid}}>{{rid}}',
|
||||
REQUEST_ACCEPT_TO: '您的響應被求種請求者接受 <a href=/requests/{{rid}}>{{rid}}',
|
||||
SCORE_EXCHANGE_INVITATION: '兌換了一張邀請函',
|
||||
SCORETO_REMOVE_WARNING: '移除了一個 H&R 警告 <a href=/torrents/{{tid}}>{{tid}}</a>',
|
||||
ACTIVE_IDLE_ACCOUNT: '重新激活帳戶狀態',
|
||||
DAILY_CHECK_IN: '每日簽到',
|
||||
SEED_TIMED: '做種時間獲得的積分 <a href=/torrents/{{tid}}>{{tid}}',
|
||||
SEED_UP_DOWNLOAD: '上傳或下載數據交換積分 <a href=/torrents/{{tid}}>{{tid}}'
|
||||
},
|
||||
|
||||
//status pages
|
||||
STATUS_PAGE: {
|
||||
BAD_REQUEST: '請求錯誤',
|
||||
|
||||
@@ -1476,6 +1476,32 @@
|
||||
LEGEND_UNIT: ' (单位: GB)'
|
||||
},
|
||||
|
||||
//score log
|
||||
SCORE_LOG: {
|
||||
DEFAULT_ACTION: '未知事件获得的积分',
|
||||
ADMIN_MODIFY: '管理员 <a href=/userinfo/{{uid}}>{{uname}}</a> 修改积分',
|
||||
TRANSFER_SCORE_INTO_INVITER_FROM: '结算上个月的积分给您的邀请人 <a href=/userinfo/{{uid}}>{{uname}}</a>',
|
||||
TRANSFER_SCORE_INTO_INVITER_TO: '系统发放被邀请用户 <a href=/userinfo/{{uid}}>{{uname}}</a> 上个月的积分奖励',
|
||||
UPLOAD_TORRENT: '上传的种子被审核通过 <a href=/torrents/{{tid}}>{{tid}}</a>',
|
||||
UPLOAD_TORRENT_BE_DELETED: '上传的种子被删除 <a href=/torrents/{{tid}}>{{tid}}</a>',
|
||||
UPLOAD_TORRENT_BE_RECOMMEND: '上传的种子被推荐 <a href=/torrents/{{tid}}>{{tid}}</a>',
|
||||
UPLOAD_SUBTITLE: '为种子上传字幕文件 <a href=/torrents/{{tid}}>{{tid}}</a>',
|
||||
UPLOAD_SUBTITLE_BE_DELETED: '上传的字幕文件被删除 <a href=/torrents/{{tid}}>{{tid}}</a>',
|
||||
THUMBS_UP_SCORE_OF_TORRENT_FROM: '为种子点赞 <a href=/torrents/{{tid}}>{{tid}}</a>',
|
||||
THUMBS_UP_SCORE_OF_TORRENT_TO: '上传的种子收到一个赞 <a href=/torrents/{{tid}}>{{tid}}</a>',
|
||||
THUMBS_UP_SCORE_OF_TOPIC_FROM: '为论坛主题或回复点赞 <a href=/forums/{{fid}}/{{tid}}>{{tid}}</a>',
|
||||
THUMBS_UP_SCORE_OF_TOPIC_TO: '发表的论坛主题或回复收到一个赞 <a href=/forums/{{fid}}/{{tid}}>{{tid}}</a>',
|
||||
REQUEST_POST: '发布了一条求种请求 <a href=/requests/{{rid}}>{{rid}}',
|
||||
REQUEST_ACCEPT_FROM: '接受了求种响应 <a href=/requests/{{rid}}>{{rid}}',
|
||||
REQUEST_ACCEPT_TO: '您的响应被求种请求者接受 <a href=/requests/{{rid}}>{{rid}}',
|
||||
SCORE_EXCHANGE_INVITATION: '兑换了一张邀请函',
|
||||
SCORETO_REMOVE_WARNING: '移除了一个 H&R 警告 <a href=/torrents/{{tid}}>{{tid}}</a>',
|
||||
ACTIVE_IDLE_ACCOUNT: '重新激活帐户状态',
|
||||
DAILY_CHECK_IN: '每日签到',
|
||||
SEED_TIMED: '做种时间获得的积分 <a href=/torrents/{{tid}}>{{tid}}',
|
||||
SEED_UP_DOWNLOAD: '上传或下载数据交换积分 <a href=/torrents/{{tid}}>{{tid}}'
|
||||
},
|
||||
|
||||
//status pages
|
||||
STATUS_PAGE: {
|
||||
BAD_REQUEST: '请求错误',
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
.controller('DataCenterController', DataCenterController);
|
||||
|
||||
DataCenterController.$inject = ['$scope', '$state', '$translate', '$timeout', 'Authentication', '$window', 'MeanTorrentConfig', 'NotifycationService',
|
||||
'UserDaysLogsService', 'UserMonthsLogsService', '$rootScope', 'moment', 'DebugConsoleService', '$filter'];
|
||||
'UserDaysLogsService', 'UserMonthsLogsService', '$rootScope', 'moment', 'DebugConsoleService', '$filter', 'UserScoreLogsService'];
|
||||
|
||||
function DataCenterController($scope, $state, $translate, $timeout, Authentication, $window, MeanTorrentConfig, NotifycationService,
|
||||
UserDaysLogsService, UserMonthsLogsService, $rootScope, moment, mtDebug, $filter) {
|
||||
UserDaysLogsService, UserMonthsLogsService, $rootScope, moment, mtDebug, $filter, UserScoreLogsService) {
|
||||
var vm = this;
|
||||
vm.user = Authentication.user;
|
||||
vm.itemsPerPageConfig = MeanTorrentConfig.meanTorrentConfig.itemsPerPage;
|
||||
@@ -69,7 +69,7 @@
|
||||
});
|
||||
},
|
||||
legend: {
|
||||
display: true,
|
||||
display: true
|
||||
},
|
||||
tooltips: {
|
||||
intersect: false
|
||||
@@ -162,7 +162,7 @@
|
||||
});
|
||||
},
|
||||
legend: {
|
||||
display: true,
|
||||
display: true
|
||||
},
|
||||
tooltips: {
|
||||
intersect: false
|
||||
@@ -213,7 +213,61 @@
|
||||
* getUserScoreHistory
|
||||
*/
|
||||
vm.getUserScoreHistory = function () {
|
||||
UserScoreLogsService.query({
|
||||
userId: vm.user._id
|
||||
}, function (items) {
|
||||
vm.userScoreLogsData = items;
|
||||
|
||||
vm.buildPager();
|
||||
}, function (res) {
|
||||
NotifycationService.showErrorNotify(res.data.message, 'DATA_CENTER.GET_USER_LOGS_ERROR');
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* buildLogsPager
|
||||
*/
|
||||
vm.buildPager = function () {
|
||||
vm.pagedItems = [];
|
||||
vm.itemsPerPage = vm.itemsPerPageConfig.userDataLogsListPerPage;
|
||||
vm.currentPage = 1;
|
||||
vm.figureOutItemsToDisplay();
|
||||
};
|
||||
|
||||
/**
|
||||
* figureOutItemsToDisplay
|
||||
*/
|
||||
vm.figureOutItemsToDisplay = function (callback) {
|
||||
vm.filteredItems = vm.userScoreLogsData;
|
||||
vm.filterLength = vm.filteredItems.length;
|
||||
var begin = ((vm.currentPage - 1) * vm.itemsPerPage);
|
||||
var end = begin + vm.itemsPerPage;
|
||||
vm.pagedItems = vm.filteredItems.slice(begin, end);
|
||||
|
||||
$('.use-logs-list-ol').prop('start', begin + 1);
|
||||
mtDebug.info(vm.pagedItems);
|
||||
|
||||
if (callback) callback();
|
||||
};
|
||||
|
||||
/**
|
||||
* pageChanged
|
||||
*/
|
||||
vm.pageChanged = function () {
|
||||
var element = angular.element('#top_of_logs_list');
|
||||
|
||||
$('.use-logs-list').fadeTo(100, 0.01, function () {
|
||||
vm.figureOutItemsToDisplay(function () {
|
||||
$timeout(function () {
|
||||
$('.use-logs-list').fadeTo(400, 1, function () {
|
||||
//window.scrollTo(0, element[0].offsetTop - 60);
|
||||
$('html,body').animate({scrollTop: element[0].offsetTop - 60}, 200);
|
||||
});
|
||||
}, 100);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
}
|
||||
}());
|
||||
|
||||
@@ -5,6 +5,44 @@
|
||||
font-size: 16px;
|
||||
}
|
||||
.chart-logs {
|
||||
padding: 16px;
|
||||
padding: 20px;
|
||||
}
|
||||
.use-logs-list {
|
||||
padding: 0 20px;
|
||||
.score-value {
|
||||
min-width: 80px;
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
color: @brand-success;
|
||||
&:before {
|
||||
content: '[';
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
color: #333;
|
||||
}
|
||||
&:after {
|
||||
content: ']';
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
color: #333;
|
||||
}
|
||||
&.subtract {
|
||||
color: @brand-danger;
|
||||
}
|
||||
}
|
||||
.use-logs-list-ol {
|
||||
line-height: 2.2;
|
||||
li {
|
||||
&:hover {
|
||||
background-color: #f7f7f7;
|
||||
}
|
||||
&:not(:last-child) {
|
||||
border-bottom: dotted 1px #dedede;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
// Users service used for communicating with the users REST endpoint
|
||||
angular
|
||||
.module('dataLogs.services')
|
||||
.factory('UserScoreLogsService', UserScoreLogsService);
|
||||
|
||||
UserScoreLogsService.$inject = ['$resource', 'CacheFactory'];
|
||||
|
||||
function UserScoreLogsService($resource, CacheFactory) {
|
||||
var userDataLogsCache = CacheFactory.get('userDataLogsCache') || CacheFactory.createCache('userDataLogsCache');
|
||||
var removeCache = function (res) {
|
||||
userDataLogsCache.removeAll();
|
||||
return res.resource;
|
||||
};
|
||||
|
||||
var logs = $resource('/api/userScoreLogs/:userId', {
|
||||
userId: '@userId'
|
||||
}, {
|
||||
get: {
|
||||
method: 'GET',
|
||||
cache: userDataLogsCache
|
||||
},
|
||||
query: {
|
||||
method: 'GET',
|
||||
isArray: true,
|
||||
cache: userDataLogsCache
|
||||
}
|
||||
});
|
||||
|
||||
return logs;
|
||||
}
|
||||
}());
|
||||
@@ -0,0 +1,15 @@
|
||||
<section class="data-center" ng-controller="DataCenterController as vm">
|
||||
<div class="panel panel-default" ng-init="vm.getUserScoreHistory()">
|
||||
<div class="panel-heading">
|
||||
<i class="fa fa-line-chart text-mt"></i> 
|
||||
<span translate="DATA_CENTER.LAST_DAYS_DATA_DOWNLOADED_HISTORY" translate-values="{days: vm.announceConfig.announceLogDays}"></span>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<!--<p>...</p>-->
|
||||
</div>
|
||||
|
||||
<div class="chart-logs">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@@ -0,0 +1,33 @@
|
||||
<section class="data-center" ng-controller="DataCenterController as vm">
|
||||
<div class="panel panel-default" ng-init="vm.getUserScoreHistory()">
|
||||
<div class="panel-heading">
|
||||
<i class="fa fa-line-chart text-mt"></i> 
|
||||
<span translate="DATA_CENTER.LAST_DAYS_DATA_SCORE_HISTORY" translate-values="{days: vm.scoreConfig.scoreLogDays}"></span>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<!--<p>...</p>-->
|
||||
</div>
|
||||
|
||||
<div class="use-logs-list" id="top_of_logs_list">
|
||||
<ol class="use-logs-list-ol">
|
||||
<li ng-repeat="l in vm.pagedItems">
|
||||
<span> {{l.createdAt | date: 'yyyy-MM-dd HH:mm:ss'}}</span>
|
||||
<span> - </span>
|
||||
<span class="score-value" ng-class="{'subtract': l.score<0}">{{l.score}}</span>
|
||||
<span> - </span>
|
||||
<span translate="SCORE_LOG.{{l.reason.event_str}}" translate-values="{{l.reason.params}}"></span>
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
<div class="pagination-div-bottom">
|
||||
<ul uib-pagination boundary-links="true" max-size="8" items-per-page="vm.itemsPerPage"
|
||||
total-items="vm.filterLength"
|
||||
ng-model="vm.currentPage"
|
||||
ng-change="vm.pageChanged()"
|
||||
first-text="{{ 'PAGE_TEXT_FIRST' | translate}}" previous-text="{{ 'PAGE_TEXT_PREVIOUS' | translate}}"
|
||||
next-text="{{ 'PAGE_TEXT_NEXT' | translate}}" last-text="{{ 'PAGE_TEXT_LAST' | translate}}">
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@@ -0,0 +1,15 @@
|
||||
<section class="data-center" ng-controller="DataCenterController as vm">
|
||||
<div class="panel panel-default" ng-init="vm.getUserScoreHistory()">
|
||||
<div class="panel-heading">
|
||||
<i class="fa fa-line-chart text-mt"></i> 
|
||||
<span translate="DATA_CENTER.LAST_DAYS_DATA_UPLOADED_HISTORY" translate-values="{days: vm.announceConfig.announceLogDays}"></span>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<!--<p>...</p>-->
|
||||
</div>
|
||||
|
||||
<div class="chart-logs">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@@ -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);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -18,7 +18,8 @@ exports.invokeRolesPolicies = function () {
|
||||
roles: ['user', 'admin', 'oper'],
|
||||
allows: [
|
||||
{resources: '/api/userDaysLogs/:userId', permissions: ['get']},
|
||||
{resources: '/api/userMonthsLogs/:userId', permissions: ['get']}
|
||||
{resources: '/api/userMonthsLogs/:userId', permissions: ['get']},
|
||||
{resources: '/api/userScoreLogs/:userId', permissions: ['get']}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
@@ -13,4 +13,7 @@ module.exports = function (app) {
|
||||
|
||||
app.route('/api/userMonthsLogs/:userId').all(dataLogsPolicy.isAllowed)
|
||||
.get(dataLogs.getUserMonthsLogs);
|
||||
|
||||
app.route('/api/userScoreLogs/:userId').all(dataLogsPolicy.isAllowed)
|
||||
.get(dataLogs.getUserScoreLogs);
|
||||
};
|
||||
|
||||
@@ -732,9 +732,17 @@ exports.thumbsUp = function (req, res) {
|
||||
} else {
|
||||
if (req.user.score >= thumb.score) {
|
||||
r._thumbs.push(thumb);
|
||||
scoreUpdate(req, r.user, scoreConfig.action.thumbsUpScoreOfTopicTo);
|
||||
save();
|
||||
|
||||
//score update
|
||||
//score update
|
||||
var act = scoreConfig.action.thumbsUpScoreOfTopicTo;
|
||||
act.params = {
|
||||
fid: topic.forum,
|
||||
tid: topic._id
|
||||
};
|
||||
scoreUpdate(req, r.user, act);
|
||||
|
||||
//add server message
|
||||
if (serverNoticeConfig.action.forumReplyThumbsUp.enable) {
|
||||
serverMessage.addMessage(replyUid, serverNoticeConfig.action.forumReplyThumbsUp.title, serverNoticeConfig.action.forumReplyThumbsUp.content, {
|
||||
@@ -769,9 +777,16 @@ exports.thumbsUp = function (req, res) {
|
||||
} else {
|
||||
if (req.user.score >= thumb.score) {
|
||||
topic._thumbs.push(thumb);
|
||||
scoreUpdate(req, topic.user, scoreConfig.action.thumbsUpScoreOfTopicTo);
|
||||
save();
|
||||
|
||||
//score update
|
||||
var act = scoreConfig.action.thumbsUpScoreOfTopicTo;
|
||||
act.params = {
|
||||
fid: topic.forum,
|
||||
tid: topic._id
|
||||
};
|
||||
scoreUpdate(req, topic.user, act);
|
||||
|
||||
//add server message
|
||||
if (serverNoticeConfig.action.forumTopicThumbsUp.enable) {
|
||||
serverMessage.addMessage(topic.user._id, serverNoticeConfig.action.forumTopicThumbsUp.title, serverNoticeConfig.action.forumTopicThumbsUp.content, {
|
||||
@@ -801,7 +816,13 @@ exports.thumbsUp = function (req, res) {
|
||||
}
|
||||
});
|
||||
|
||||
scoreUpdate(req, user, scoreConfig.action.thumbsUpScoreOfTopicFrom);
|
||||
//score update
|
||||
var act = scoreConfig.action.thumbsUpScoreOfTopicFrom;
|
||||
act.params = {
|
||||
fid: topic.forum,
|
||||
tid: topic._id
|
||||
};
|
||||
scoreUpdate(req, user, act);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@
|
||||
*/
|
||||
vm.pageChanged = function () {
|
||||
var element = angular.element('#top_of_invitations_list');
|
||||
console.log(element);
|
||||
|
||||
$('.tb-official').fadeTo(100, 0.01, function () {
|
||||
vm.figureOutItemsToDisplay(function () {
|
||||
$timeout(function () {
|
||||
|
||||
@@ -53,10 +53,11 @@ exports.create = function (req, res) {
|
||||
|
||||
if (user.score >= inviteConfig.scoreExchange) {
|
||||
user.score -= inviteConfig.scoreExchange;
|
||||
scoreUpdate(req, user, scoreConfig.action.scoreExchangeInvitation, -(inviteConfig.scoreExchange));
|
||||
|
||||
res.json(user);
|
||||
|
||||
//score update
|
||||
scoreUpdate(req, user, scoreConfig.action.scoreExchangeInvitation, -(inviteConfig.scoreExchange));
|
||||
|
||||
//create trace log
|
||||
traceLogCreate(req, traceConfig.action.userInvitationExchange, {
|
||||
user: req.user._id,
|
||||
|
||||
@@ -42,7 +42,12 @@ exports.create = function (req, res) {
|
||||
} else {
|
||||
res.json(request);
|
||||
|
||||
scoreUpdate(req, user, scoreConfig.action.postRequest, -requestsConfig.scoreForAddRequest);
|
||||
//score update
|
||||
var act = scoreConfig.action.requestPost;
|
||||
act.params = {
|
||||
rid: request._id
|
||||
};
|
||||
scoreUpdate(req, user, act, -requestsConfig.scoreForAddRequest);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@@ -166,12 +171,17 @@ exports.accept = function (req, res) {
|
||||
res.json(request);
|
||||
|
||||
//transfer reward score
|
||||
request.user.update({
|
||||
$inc: {score: -request.rewards}
|
||||
}).exec();
|
||||
torrent.user.update({
|
||||
$inc: {score: request.rewards}
|
||||
}).exec();
|
||||
var act = scoreConfig.action.requestAcceptFrom;
|
||||
act.params = {
|
||||
rid: request._id
|
||||
};
|
||||
scoreUpdate(req, request.user, act, -request.rewards);
|
||||
|
||||
act = scoreConfig.action.requestAcceptTo;
|
||||
act.params = {
|
||||
rid: request._id
|
||||
};
|
||||
scoreUpdate(req, torrent.user, act, request.rewards);
|
||||
|
||||
//add server message
|
||||
if (serverNoticeConfig.action.requestTorrentRespond.enable) {
|
||||
|
||||
@@ -943,7 +943,7 @@
|
||||
</div>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="row margin-top-50">
|
||||
<div class="row margin-top-30">
|
||||
<div class="col-md-10 col-md-offset-1">
|
||||
<ol class="subtitle-list">
|
||||
<li class="h-line" ng-repeat="s in vm.torrentLocalInfo._subtitles">
|
||||
@@ -956,7 +956,7 @@
|
||||
</span>
|
||||
<span class="glyphicon glyphicon-remove-circle delete-button"
|
||||
title="{{ 'SUBTITLE_DELETE_ICON_TITLE' | translate}}"
|
||||
ng-if="s.user._id.toString()==vm.user._id || vm.user.roles[0] == 'admin'"
|
||||
ng-if="s.user._id.toString()==vm.user._id || vm.isOwner(vm.torrentLocalInfo) || vm.user.isOper"
|
||||
ng-click="vm.deleteSubtitle(s);">
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -71,8 +71,12 @@ exports.removeWarning = function (req, res) {
|
||||
message: 'SERVER.SCORE_NOT_ENOUGH'
|
||||
});
|
||||
} else {
|
||||
//update score
|
||||
scoreUpdate(req, req.user, scoreConfig.action.scoreToRemoveWarning, -(hnrConfig.scoreToRemoveWarning));
|
||||
//score update
|
||||
var act = scoreConfig.action.scoreToRemoveWarning;
|
||||
act.params = {
|
||||
tid: comp.torrent
|
||||
};
|
||||
scoreUpdate(req, req.user, act, -(hnrConfig.scoreToRemoveWarning));
|
||||
|
||||
comp.hnr_warning = false;
|
||||
comp.remove_warning_at = Date.now();
|
||||
|
||||
@@ -71,7 +71,7 @@ exports.create = function (req, res) {
|
||||
} else {
|
||||
Torrent.populate(torrent._subtitles, {
|
||||
path: 'user',
|
||||
select: 'displayName profileImageURL uploaded downloaded'
|
||||
select: 'username displayName profileImageURL isVip score uploaded downloaded'
|
||||
}, function (err, t) {
|
||||
if (err) {
|
||||
return res.status(422).send({
|
||||
@@ -80,7 +80,12 @@ exports.create = function (req, res) {
|
||||
} else {
|
||||
res.status(200).send(torrent);
|
||||
|
||||
scoreUpdate(req, req.user, scoreConfig.action.uploadSubtitle);
|
||||
//score update
|
||||
var act = scoreConfig.action.uploadSubtitle;
|
||||
act.params = {
|
||||
tid: torrent._id
|
||||
};
|
||||
scoreUpdate(req, req.user, act);
|
||||
|
||||
//add server message
|
||||
if (serverNoticeConfig.action.torrentSubtitleNew.enable && !torrent.user._id.equals(req.user._id)) {
|
||||
@@ -158,7 +163,12 @@ exports.delete = function (req, res) {
|
||||
|
||||
res.json(torrent);
|
||||
|
||||
scoreUpdate(req, torrent.user, scoreConfig.action.uploadSubtitleBeDeleted);
|
||||
//score update
|
||||
var act = scoreConfig.action.uploadSubtitleBeDeleted;
|
||||
act.params = {
|
||||
tid: torrent._id
|
||||
};
|
||||
scoreUpdate(req, r.user, act);
|
||||
|
||||
//add server message
|
||||
if (serverNoticeConfig.action.torrentSubtitleDeleted.enable) {
|
||||
|
||||
@@ -749,6 +749,11 @@ exports.create = function (req, res) {
|
||||
$inc: {uptotal: 1}
|
||||
}).exec();
|
||||
//update maker torrent count
|
||||
var act = scoreConfig.action.uploadTorrent;
|
||||
act.params = {
|
||||
tid: torrent._id
|
||||
};
|
||||
|
||||
if (torrent.maker) {
|
||||
Maker.update({_id: torrent.maker}, {
|
||||
$inc: {torrent_count: 1}
|
||||
@@ -762,7 +767,7 @@ exports.create = function (req, res) {
|
||||
if (!err && m) {
|
||||
torrent.update({torrent_status: 'reviewed'}).exec();
|
||||
announceTorrentToIRC(torrent, req);
|
||||
scoreUpdate(req, req.user, scoreConfig.action.uploadTorrent);
|
||||
scoreUpdate(req, req.user, act);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@@ -770,7 +775,7 @@ exports.create = function (req, res) {
|
||||
if (req.user.upload_access === 'pass') {
|
||||
torrent.update({torrent_status: 'reviewed'}).exec();
|
||||
announceTorrentToIRC(torrent, req);
|
||||
scoreUpdate(req, req.user, scoreConfig.action.uploadTorrent);
|
||||
scoreUpdate(req, req.user, act);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1151,9 +1156,15 @@ exports.thumbsUp = function (req, res) {
|
||||
} else {
|
||||
if (req.user.score >= thumb.score) {
|
||||
torrent._thumbs.push(thumb);
|
||||
scoreUpdate(req, torrent.user, scoreConfig.action.thumbsUpScoreOfTorrentTo);
|
||||
save();
|
||||
|
||||
//score update
|
||||
var act = scoreConfig.action.thumbsUpScoreOfTorrentTo;
|
||||
act.params = {
|
||||
tid: torrent._id
|
||||
};
|
||||
scoreUpdate(req, torrent.user, act);
|
||||
|
||||
//add server message
|
||||
if (serverNoticeConfig.action.torrentThumbsUp.enable) {
|
||||
serverMessage.addMessage(torrent.user._id, serverNoticeConfig.action.torrentThumbsUp.title, serverNoticeConfig.action.torrentThumbsUp.content, {
|
||||
@@ -1181,7 +1192,12 @@ exports.thumbsUp = function (req, res) {
|
||||
}
|
||||
});
|
||||
|
||||
scoreUpdate(req, user, scoreConfig.action.thumbsUpScoreOfTorrentFrom);
|
||||
//score update
|
||||
var act = scoreConfig.action.thumbsUpScoreOfTorrentFrom;
|
||||
act.params = {
|
||||
tid: torrent._id
|
||||
};
|
||||
scoreUpdate(req, user, act);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1299,7 +1315,13 @@ exports.setRecommendLevel = function (req, res) {
|
||||
} else {
|
||||
res.json(torrent);
|
||||
|
||||
scoreUpdate(req, torrent.user, scoreConfig.action.uploadTorrentBeRecommend);
|
||||
if (torrent.torrent_recommended !== 'level0') {
|
||||
var act = scoreConfig.action.uploadTorrentBeRecommend;
|
||||
act.params = {
|
||||
tid: torrent._id
|
||||
};
|
||||
scoreUpdate(req, torrent.user, act);
|
||||
}
|
||||
|
||||
//create trace log
|
||||
traceLogCreate(req, traceConfig.action.adminTorrentSetRecommendLevel, {
|
||||
@@ -1362,7 +1384,11 @@ exports.setReviewedStatus = function (req, res) {
|
||||
res.json(torrent);
|
||||
|
||||
announceTorrentToIRC(torrent, req);
|
||||
scoreUpdate(req, torrent.user, scoreConfig.action.uploadTorrent);
|
||||
var act = scoreConfig.action.uploadTorrent;
|
||||
act.params = {
|
||||
tid: torrent._id
|
||||
};
|
||||
scoreUpdate(req, torrent.user, act);
|
||||
|
||||
//add server message
|
||||
if (serverNoticeConfig.action.torrentReviewed.enable) {
|
||||
@@ -1496,7 +1522,11 @@ exports.delete = function (req, res) {
|
||||
|
||||
//only update score when torrent status is reviewed
|
||||
if (torrent.torrent_status === 'reviewed') {
|
||||
scoreUpdate(req, torrent.user, scoreConfig.action.uploadTorrentBeDeleted);
|
||||
var act = scoreConfig.action.uploadTorrentBeDeleted;
|
||||
act.params = {
|
||||
tid: torrent._id
|
||||
};
|
||||
scoreUpdate(req, torrent.user, act);
|
||||
}
|
||||
|
||||
//create trace log
|
||||
|
||||
@@ -327,7 +327,11 @@ exports.updateUserScore = function (req, res) {
|
||||
score: sv,
|
||||
reason: {
|
||||
event: scoreConfig.action.adminModify.name,
|
||||
params: undefined
|
||||
event_str: scoreConfig.action.adminModify.content,
|
||||
params: {
|
||||
uid: req.user._id,
|
||||
uname: req.user.displayName
|
||||
}
|
||||
}
|
||||
});
|
||||
sl.save(function (err) {
|
||||
|
||||
Reference in New Issue
Block a user