浏览代码

获取质抵押订单列表

afa 4 月之前
父节点
当前提交
dc9e7eb477
共有 1 个文件被更改,包括 10 次插入9 次删除
  1. 10 9
      application/api/logic/PledgeLogic.php

+ 10 - 9
application/api/logic/PledgeLogic.php

@@ -76,7 +76,6 @@ class PledgeLogic
             ->join('product_pledge b', 'a.pledge_id = b.id', 'left')
             ->join('product_pledge b', 'a.pledge_id = b.id', 'left')
             ->where('a.user_id', $user_id)
             ->where('a.user_id', $user_id)
             ->where('a.status', '>', $model::Close)
             ->where('a.status', '>', $model::Close)
-            ->where('a.end_time', '>',  $time)
             ->field('a.*,b.title,b.type_id,b.day_num,b.token,b.teac,b.is_renew')
             ->field('a.*,b.title,b.type_id,b.day_num,b.token,b.teac,b.is_renew')
             ->select();
             ->select();
         if(empty($list)) throw new Exception('暂无存储订单');
         if(empty($list)) throw new Exception('暂无存储订单');
@@ -85,14 +84,16 @@ class PledgeLogic
         $growth= 0; //增长累计收益
         $growth= 0; //增长累计收益
         $result = [];
         $result = [];
         foreach ($list as $item) {
         foreach ($list as $item) {
-            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; //增长收益
-                $result[] = $item;
+            if($item->end_time >  $time){
+                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; //增长收益
+                    $result[] = $item;
+                }
             }
             }
         }
         }
         return ['total' => $total, 'growth' => $growth, 'list' => $result];   
         return ['total' => $total, 'growth' => $growth, 'list' => $result];