Browse Source

我的茶权

afa 7 months ago
parent
commit
d5f6475fe5
1 changed files with 6 additions and 4 deletions
  1. 6 4
      application/common/logic/PledgeLogic.php

+ 6 - 4
application/common/logic/PledgeLogic.php

@@ -10,6 +10,7 @@ use fast\Asset;
 use app\common\model\ProductOrder;
 use app\common\model\LedgerTeacChangeModel;
 use app\common\model\ProductPledges;
+use Google\Service\Storage\Resource\Objects;
 
 class PledgeLogic
 {
@@ -62,7 +63,7 @@ class PledgeLogic
 
     //获取质抵押订单列表
     //(60*60*24)*(当前时间-最后一次收取时间)
-    public static function getPledgeOrderList(int $user_id)
+    public static function getPledgeOrderList(int $user_id)//: array
     {
         $model  = Loader::model('UserPledge');
         $list   = $model::alias('a')
@@ -76,18 +77,19 @@ class PledgeLogic
         $total = 0; //当前累计收益
         $growth= 0; //增长累计收益
         $time  = time();
-        foreach ($list as $key=>$item) {
+        $result = [];
+        foreach ($list as $item) {
             if($item->status == $model::Remove) {
                 $total += $item->total_self;
-                unset($list[$key]);
             }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' => $list];   
+        return ['total' => $total, 'growth' => $growth, 'list' => $result];   
     }
 
     //解除质抵押订单