|
@@ -71,16 +71,15 @@ class PledgeLogic
|
|
|
->where('a.status', $model::Ongoing)
|
|
->where('a.status', $model::Ongoing)
|
|
|
->field('a.*,b.title')
|
|
->field('a.*,b.title')
|
|
|
->select();
|
|
->select();
|
|
|
-
|
|
|
|
|
if(empty($list)) throw new Exception('暂无质押订单');
|
|
if(empty($list)) throw new Exception('暂无质押订单');
|
|
|
$day = 86400;
|
|
$day = 86400;
|
|
|
$total = 0; //当前累计收益
|
|
$total = 0; //当前累计收益
|
|
|
$growth= 0; //增长累计收益
|
|
$growth= 0; //增长累计收益
|
|
|
$time = time();
|
|
$time = time();
|
|
|
foreach ($list as $item) {
|
|
foreach ($list as $item) {
|
|
|
- $reta = bcdiv($item->day_num, $day, 2); //天数
|
|
|
|
|
|
|
+ $reta = bcdiv($item->day_num, $day, 6); //天
|
|
|
$inter = ($item->last_time == 0) ? $time - $item->create_time: $time - $item->last_time; //最后收取时间
|
|
$inter = ($item->last_time == 0) ? $time - $item->create_time: $time - $item->last_time; //最后收取时间
|
|
|
- $total += bcmul($reta, $inter, 2)* $item->num; //累计收益
|
|
|
|
|
|
|
+ $total += bcmul($reta, $inter)* $item->num; //累计收益
|
|
|
$growth += $reta* $item->num;
|
|
$growth += $reta* $item->num;
|
|
|
}
|
|
}
|
|
|
return ['total' => $total, 'growth' => $growth, 'list' => $list];
|
|
return ['total' => $total, 'growth' => $growth, 'list' => $list];
|
|
@@ -125,9 +124,9 @@ class PledgeLogic
|
|
|
$total = $item->total_self;
|
|
$total = $item->total_self;
|
|
|
$item->status = $model::Close; //关闭
|
|
$item->status = $model::Close; //关闭
|
|
|
}else{
|
|
}else{
|
|
|
- $reta = bcdiv($item->day_num, $day, 2); //天数
|
|
|
|
|
|
|
+ $reta = bcdiv($item->day_num, $day, 6); //天数
|
|
|
$inter = ($item->last_time == 0) ? $time - $item->create_time: $time - $item->last_time; //最后收取时间
|
|
$inter = ($item->last_time == 0) ? $time - $item->create_time: $time - $item->last_time; //最后收取时间
|
|
|
- $total = bcmul($reta, $inter, 2) * $item->num; //累计收益
|
|
|
|
|
|
|
+ $total = bcmul($reta, $inter, 6) * $item->num; //累计收益
|
|
|
$item->last_time = $time; //收取时间
|
|
$item->last_time = $time; //收取时间
|
|
|
$item->total_self= bcadd($total, $item->total_self, 2); //累计收益
|
|
$item->total_self= bcadd($total, $item->total_self, 2); //累计收益
|
|
|
}
|
|
}
|