Skip to content

Commit

Permalink
fix(core): fixed score issue
Browse files Browse the repository at this point in the history
  • Loading branch information
taobataoma committed Jun 28, 2018
1 parent fd51a8b commit a4553bb
Show file tree
Hide file tree
Showing 11 changed files with 0 additions and 106 deletions.
12 changes: 0 additions & 12 deletions config/env/torrents.js
Original file line number Diff line number Diff line change
Expand Up @@ -601,10 +601,6 @@ module.exports = {
*
* @levelStep: value of each level step, default 500
* @scoreLogDays: setting of days to write score detail log to db, because the data is too more too big, do not to set a big value
* @transfer: setting of transfer score to inviter per month
* @enable: setting whether to enable transfer
* @deductFromUser: setting whether deduct the score from user
* @transRatio: setting transfer ratio, the user`s score of this ratio will be subtract and add into the inviter`s account if the @deductFromUser is true
* @action: score change action list
* @name: action name
* @value: action score value
Expand All @@ -614,18 +610,10 @@ module.exports = {
score: {
levelStep: 1000,
scoreLogDays: 10,
transferToInviter: {
enable: true,
deductFromUser: false,
transRatio: 0.001
},
action: {
defaultAction: {name: 'defaultAction', content: 'DEFAULT_ACTION', value: 0, enable: true},
adminModify: {name: 'adminModify', content: 'ADMIN_MODIFY', value: 0, enable: true},

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: 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},
Expand Down
64 changes: 0 additions & 64 deletions config/lib/cron-job.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,6 @@ module.exports = function (app) {
cronJobs.push(countUsersHnrWarning());
}

if (scoreConfig.transferToInviter.enable) {
cronJobs.push(transferUserScoreToInviter());
}

if (supportConfig.mailTicketSupportService) {
cronJobs.push(listenServiceEmail());
}
Expand Down Expand Up @@ -385,66 +381,6 @@ function countUsersHnrWarning() {
return cronJob;
}

/**
* transferUserScoreToInviter
*/
function transferUserScoreToInviter() {
var cronJob = new CronJob({
cronTime: '00 00 2 1 * *',
onTick: function () {
logger.info(chalk.green('transferUserScoreToInviter: process!'));

var mom = moment().utcOffset(appConfig.dbTimeZone);
var y = mom.get('year');
var m = mom.get('month') + 1;

UserMonthsLog.find({
year: y,
month: m - 1
}).populate({
path: 'user',
select: 'username displayName profileImageURL isVip score uploaded downloaded invited_by',
populate: {
path: 'invited_by',
select: 'username displayName profileImageURL isVip score uploaded downloaded'
}
}).exec(function (err, logs) {
if (logs) {
logs.forEach(function (l) {
if (l.score > 0 && l.user.invited_by) {
var transValue = Math.round(l.score * scoreConfig.transferToInviter.transRatio * 100) / 100;

if (transValue > 0) {
if (scoreConfig.transferToInviter.deductFromUser) {
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));
}

var actTo = scoreConfig.action.transferScoreIntoInviterTo;
actTo.params = {
uid: l.user._id,
uname: l.user.displayName
};
scoreUpdate(undefined, l.user.invited_by, actTo, transValue);
}
}
});
}
});
},
start: false,
timeZone: appConfig.cronTimeZone
});

cronJob.start();

return cronJob;
}

/**
* listenServiceEmail
*/
Expand Down
4 changes: 0 additions & 4 deletions modules/about/client/templates/invitations-rules-en.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@
invite.banUserInviter = %(inviteConfig.banUserInviter)s
```
1. If you have made outstanding contributions to the site, the site will occasionally send you a limited number of invitations to reward you for your contribution.
1. At the end of each month, the system will award scores to users who have successfully sent invitations. the score number limit is the percentage `%(scoreConfig.transferToInviter.transRatio)f` of the monthly got of the invited users, the current award function enable status is:
```javascript
scoreConfig.transferToInviter.enable = %(scoreConfig.transferToInviter.enable)s
```

 

Expand Down
4 changes: 0 additions & 4 deletions modules/about/client/templates/invitations-rules-zh-tw.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@
invite.banUserInviter = %(inviteConfig.banUserInviter)s
```
1. 如果您對站點做出了突出貢獻,站內會不定期根據您的貢獻向您贈送一定數量的邀請以做為獎勵。
1. 系統在每個月底會對成功發送過邀請函的用戶進行積分獎勵,獎勵額度為受邀請用戶當月的進帳積分的 `%(scoreConfig.transferToInviter.transRatio)f` 倍,目前該獎勵功能開關狀態為:
```javascript
scoreConfig.transferToInviter.enable = %(scoreConfig.transferToInviter.enable)s
```

 

Expand Down
4 changes: 0 additions & 4 deletions modules/about/client/templates/invitations-rules-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@
invite.banUserInviter = %(inviteConfig.banUserInviter)s
```
1. 如果您对站点做出了突出贡献,站内会不定期根据您的贡献向您赠送一定数量的邀请以做为奖励。
1. 系统在每个月底会对成功发送过邀请函的用户进行积分奖励,奖励额度为受邀请用户当月的进帐积分的 `%(scoreConfig.transferToInviter.transRatio)f` 倍,目前该奖励功能开关状态为:
```javascript
scoreConfig.transferToInviter.enable = %(scoreConfig.transferToInviter.enable)s
```

 

Expand Down
4 changes: 0 additions & 4 deletions modules/about/client/templates/score-rules-en.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@
The basic ratio is %(scoreConfig.action.seedSeederAndLife.lifeBasicRatio).2f, increase %(scoreConfig.action.seedSeederAndLife.lifeCoefficientOfDay).3f every day.
For 10 days life ratio is 1.01, [100 days is 1.1], [200 days is 1.2] etc, the max ratio is %(scoreConfig.action.seedSeederAndLife.lifeMaxRatio).2f.
```
* At the end of each month, the system will award scores to users who have successfully sent invitations. the score number limit is the percentage `%(scoreConfig.transferToInviter.transRatio)f` of the monthly got of the invited users, the current award function enable status is:
```javascript
scoreConfig.transferToInviter.enable = %(scoreConfig.transferToInviter.enable)s
```

 

Expand Down
4 changes: 0 additions & 4 deletions modules/about/client/templates/score-rules-zh-tw.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@
加成基礎係數為 %(scoreConfig.action.seedSeederAndLife.lifeBasicRatio).2f, 根據種子生命每天增加 %(scoreConfig.action.seedSeederAndLife.lifeCoefficientOfDay).3f
如果種子生命(釋出時間)為 10 天,則加成係數為 1.01, [100 天是 1.1], [200 天是 1.2], 以此類推,最大加成係數為 %(scoreConfig.action.seedSeederAndLife.lifeMaxRatio).2f
```
* 系統在每個月底會對成功發送過邀請函的用戶進行積分獎勵,獎勵額度為受邀請用戶當月的進帳積分的 `%(scoreConfig.transferToInviter.transRatio)f` 倍,目前該獎勵功能開關狀態為:
```javascript
scoreConfig.transferToInviter.enable = %(scoreConfig.transferToInviter.enable)s
```

 

Expand Down
4 changes: 0 additions & 4 deletions modules/about/client/templates/score-rules-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@
加成基础系数为 %(scoreConfig.action.seedSeederAndLife.lifeBasicRatio).2f, 根据种子生命每天增加 %(scoreConfig.action.seedSeederAndLife.lifeCoefficientOfDay).3f
如果种子生命(发布时间)为 10 天,则加成系数为 1.01, [100 天是 1.1], [200 天是 1.2], 以此类推,最大加成系数为 %(scoreConfig.action.seedSeederAndLife.lifeMaxRatio).2f
```
* 系统在每个月底会对成功发送过邀请函的用户进行积分奖励,奖励额度为受邀请用户当月的进帐积分的 `%(scoreConfig.transferToInviter.transRatio)f` 倍,目前该奖励功能开关状态为:
```javascript
scoreConfig.transferToInviter.enable = %(scoreConfig.transferToInviter.enable)s
```

 

Expand Down
2 changes: 0 additions & 2 deletions modules/core/client/app/trans-string-en.js
Original file line number Diff line number Diff line change
Expand Up @@ -1649,8 +1649,6 @@
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>',
Expand Down
2 changes: 0 additions & 2 deletions modules/core/client/app/trans-string-zh-tw.js
Original file line number Diff line number Diff line change
Expand Up @@ -1649,8 +1649,6 @@
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>',
Expand Down
2 changes: 0 additions & 2 deletions modules/core/client/app/trans-string-zh.js
Original file line number Diff line number Diff line change
Expand Up @@ -1649,8 +1649,6 @@
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>',
Expand Down

0 comments on commit a4553bb

Please sign in to comment.