|
|
@@ -115,9 +115,9 @@ class PledgeLogic
|
|
|
{
|
|
|
$model = Loader::model('UserPledge');
|
|
|
$list = $model::where('user_id', $user_id)->where('status', '>', $model::Close)->select();
|
|
|
- if(empty($list)) throw new Exception('暂无质押订单');
|
|
|
+ if(empty($list)) throw new Exception('暂无质押订单');
|
|
|
$day = 86400;
|
|
|
- $total = 0; //当前累计收益
|
|
|
+ $total = 0; //总前累计收益
|
|
|
$time = time();
|
|
|
foreach ($list as $item)
|
|
|
{
|
|
|
@@ -128,9 +128,10 @@ class PledgeLogic
|
|
|
}else{
|
|
|
$reta = bcdiv($item->day_num, $day, 6); //天数
|
|
|
$inter = ($item->last_time == 0) ? $time - $item->create_time: $time - $item->last_time; //最后收取时间
|
|
|
- $total += bcmul($reta, $inter, 6) * $item->num; //累计收益
|
|
|
+ $total_inco = bcmul($reta, $inter, 6) * $item->num; //累计收益
|
|
|
$item->last_time = $time; //收取时间
|
|
|
- $item->total_self= bcadd($total, $item->total_self, 2); //累计收益
|
|
|
+ $item->total_self= bcadd($total_inco, $item->total_self, 2); //累计收益
|
|
|
+ $total += $total_inco; //累计收益
|
|
|
}
|
|
|
//更新领取状态
|
|
|
$item->save();
|