fix: 更改fund的有效期为50天

This commit is contained in:
chaosBreaking
2019-09-28 16:18:57 +08:00
parent 6f4c73ff35
commit 9b2fe61d84
3 changed files with 11 additions and 25 deletions

View File

@@ -251,7 +251,7 @@ module.exports = {
]);
// 计算昨日收益
let revenueLastday = calRevenueLastday(actions);
// 筛选有效矿晶
// 筛选有效矿晶
let activeFund = getActiveFund(fund.fundList);
return res.json({
code: 0,
@@ -259,9 +259,9 @@ module.exports = {
data: {
list: newFund.fundList,
basic: {
activeFund,
revenueLastday,
revenueAll: newFund.asset['vic']
activeFund, //有效矿晶
revenueLastday, // 昨日收益
revenueAll: newFund.asset['vic'] // 累计总收益
}
}
});

View File

@@ -14,30 +14,13 @@ class Fund {
this.blockNumber = blockNumber;
this.blockHash = hash;
const now = new Date();
const exp = calExpirePeriod(amount);
const exp = calExpirePeriod();
this.createdAt = now.toISOString();
this.expiresAt = new Date(now.getTime() + exp * DayLong);
this.releasedAmout = 0;
}
}
const calExpirePeriod = amount => {
switch (true) {
case (amount >= 200 && amount <= 1999):
return 300;
case amount >= 2000 && amount <= 3999:
return 310;
case amount >=4000 && amount <=5999:
return 320;
case amount >= 6000 && amount <= 7999:
return 330;
case amount >= 8000 && amount <= 9999:
return 340;
case amount >= 10000 && amount <= 11999:
return 350;
case amount >= 12000:
return 365;
default: return 0;
}
};
const calExpirePeriod = () => 50;
module.exports = {
createNewFund (txData) {
@@ -53,6 +36,7 @@ module.exports = {
return revenueLastday;
},
getActiveFund (fundList) {
// fund里面的项目status=1的就是正在挖的有效矿晶
let activeFund = 0;
for (let i = fundList.length; i >= 0; i--) {
const fundItem = fundList[i];

View File

@@ -31,7 +31,9 @@ const FundSchema = new mongoose.Schema({
type: Number,
default: 0
},
// asset表示用户的财产包括VIC/团队奖励的USDT
// asset表示用户的收益包括VIC团队奖励的USDT
// vic是挖矿得到的奖励
// usdt是社群奖励后面加上了糖果也代表糖果数量
asset: {
type: {},
default: {