Jelajahi Sumber

获取质抵押订单列表

afa 4 bulan lalu
induk
melakukan
2eeab9c1ca
1 mengubah file dengan 4 tambahan dan 6 penghapusan
  1. 4 6
      application/api/logic/PledgeLogic.php

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

@@ -71,7 +71,7 @@ class PledgeLogic
     public static function getPledgeOrderList(int $user_id)//: array
     {
         $model  = Loader::model('UserPledge');
-        $time  = time();
+        $time   = time();
         $list   = $model::alias('a')
             ->join('product_pledge b', 'a.pledge_id = b.id', 'left')
             ->where('a.user_id', $user_id)
@@ -90,7 +90,7 @@ class PledgeLogic
                     $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; //增长收益
+                    $growth = bcadd($growth, bcmul($reta, $item->num, 6), 6); //增长收益
                 }
             }
         }
@@ -129,12 +129,10 @@ class PledgeLogic
         }
 
         $day   = 86400;
-        $total = 0; //当前累计收益
         $reta  = bcdiv($rows->day_num, $day, 6); //天数
         $inter = ($rows->last_time == 0) ? $time - $rows->create_time: $time - $rows->last_time; //最后收取时间
-        $total = bcmul($reta, $inter, 6) * $num; //累计收益
-        $rows->total_self= bcadd($total, $rows->total_self, 6);
-
+        $rows->total_self= bcmul($reta, $inter, 6) * $num; //累计收益
+   
         //修改状态
         Loader::model('ProductOrder')::where('user_id', $user_id)->whereIn('id', $orderId)->setField('status', ProductOrder::Paid);