afa преди 7 месеца
родител
ревизия
1b060e65c3
променени са 2 файла, в които са добавени 4 реда и са изтрити 7 реда
  1. 1 3
      application/api/controller/Pledge.php
  2. 3 4
      application/common/logic/PledgeLogic.php

+ 1 - 3
application/api/controller/Pledge.php

@@ -147,9 +147,7 @@ class Pledge extends Api
             Db::startTrans();
             try {
                   // 质抵押订单 
-                  $res = $pledgeLogic::setPledgeRemove($pledge_id,  $this->auth->id);
-
-                  //解冻
+                  $res = $pledgeLogic::setPledgeRemove($pledge_id,  1275);
                   
                   // 提交事务
                   Db::commit();

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

@@ -99,7 +99,9 @@ class PledgeLogic
         $total = bcmul($reta, $inter, 6) * $rows->num; //累计收益
         $rows->total_self= bcadd($total, $rows->total_self, 6);
 
-        $model->whereIn('order_no', $rows->order_no)->setField('status', $model::Paid);
+        //修改状态
+        $detail =json_decode($rows->details, true);
+        $model->whereIn('order_no', array_column($detail, 'order_no'))->setField('status', $model::Paid);
 
         $rows->status    = $model::Remove;
         $rows->last_time = $time;
@@ -111,14 +113,12 @@ 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) 
         {
             //解冻
@@ -126,7 +126,6 @@ class PledgeLogic
                 $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; //累计收益