|
|
@@ -68,7 +68,7 @@ class PledgeLogic
|
|
|
$list = $model::alias('a')
|
|
|
->join('product_pledge b', 'a.pledge_id = b.id', 'left')
|
|
|
->where('a.user_id', $user_id)
|
|
|
- ->where('a.status', $model::Ongoing)
|
|
|
+ ->where('a.status', '>', $model::Close)
|
|
|
->field('a.*,b.title')
|
|
|
->select();
|
|
|
if(empty($list)) throw new Exception('暂无质押订单');
|
|
|
@@ -77,10 +77,14 @@ class PledgeLogic
|
|
|
$growth= 0; //增长累计收益
|
|
|
$time = time();
|
|
|
foreach ($list as $item) {
|
|
|
- $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; //累计收益
|
|
|
- $growth += $reta* $item->num;
|
|
|
+ if($item->status == $model::Remove) {
|
|
|
+ $total += $item->total_self;
|
|
|
+ }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; //累计收益
|
|
|
+ $growth += $reta* $item->num; //增长收益
|
|
|
+ }
|
|
|
}
|
|
|
return ['total' => $total, 'growth' => $growth, 'list' => $list];
|
|
|
}
|
|
|
@@ -102,7 +106,6 @@ class PledgeLogic
|
|
|
//修改状态
|
|
|
$detail =json_decode($rows->details, true);
|
|
|
Loader::model('ProductOrder')::whereIn('order_no', array_column($detail, 'order_no'))->setField('status', ProductOrder::Paid);
|
|
|
-
|
|
|
$rows->status = $model::Remove;
|
|
|
$rows->last_time = $time;
|
|
|
return $rows->save();
|
|
|
@@ -117,7 +120,7 @@ class PledgeLogic
|
|
|
$list = $model::where('user_id', $user_id)->where('status', '>', $model::Close)->select();
|
|
|
if(empty($list)) throw new Exception('暂无质押订单');
|
|
|
$day = 86400;
|
|
|
- $total = 0; //总前累计收益
|
|
|
+ $total = 0; //当前累计收益
|
|
|
$time = time();
|
|
|
foreach ($list as $item)
|
|
|
{
|