afa hace 7 meses
padre
commit
6a84da5543
Se han modificado 1 ficheros con 6 adiciones y 2 borrados
  1. 6 2
      application/common/logic/PledgeLogic.php

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

@@ -110,26 +110,30 @@ class PledgeLogic
     //收取质抵押订单列表
     //(60*60*24)*(当前时间-最后一次收取时间)
     public static function getPledgeCollect(int $user_id)
-    { 
+    {   
+        //$user_id = 1275;
         $model  = Loader::model('UserPledge');
         $list   = $model::where('user_id', $user_id)->where('status', '>', $model::Close)->select();
         if(empty($list))  throw new Exception('暂无质押订单');
         $day   = 86400;
         $total = 0; //当前累计收益
         $time  = time();
+       
         foreach ($list as $item) 
         {
             //解冻
-            if($item == $model::Remove) {
+            if($item->status == $model::Remove) {
                 $total = $item->total_self;
                 $item->status = $model::Close; //关闭
             }else{
+                dump(111);die;
                 $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; //累计收益
                 $item->last_time = $time; //收取时间
                 $item->total_self= bcadd($total, $item->total_self, 2); //累计收益
             }
+          
             Loader::model('LedgerWalletModel')->changeWalletAccount($user_id, Asset::TEAC, $item->total_self, LedgerTeacChangeModel::Pledge, 0);
             $item->save();
         }