wugg 4 tháng trước cách đây
mục cha
commit
015709836c
1 tập tin đã thay đổi với 8 bổ sung8 xóa
  1. 8 8
      app/cxinv/model/TradePool.php

+ 8 - 8
app/cxinv/model/TradePool.php

@@ -77,13 +77,13 @@ class TradePool extends Base
         if($assoc->isEmpty()) throw new \Exception('数据不存在');
         $qrdArr = QrdInfo::where(['cxCode'=>array_column($assoc->toArray(),'cxCode'),'is_comon'=>0,'is_del'=>0])
         ->column('totalPrice,wpay_fee,apay_fee,platform_type,companyNo,customerNo,sequenceNo,id','cxCode');
-        $assoc=[];
+        $Asoc=[];
         $log=[];
         Log::info("订单数据".json_encode($qrdArr,JSON_UNESCAPED_UNICODE));
         foreach ($assoc->toArray() as $k=>$v){
-            $orderLv= bcdiv($v['cancel_fee'],$v['order_total'],6);
+            $orderLv= bcdiv($v['cancel_fee'],$v['order_total'],8);
             if(!isset($qrdArr[$v['cxCode']])) throw new \Exception("{$v['sequenceNo']}关联通用订单数据不存在");
-             $trade_fee= bcmul($qrdArr[$v['cxCode']]['totalPrice'],$orderLv,2);
+             $trade_fee=round(bcmul($qrdArr[$v['cxCode']]['totalPrice'],$orderLv,8),2);
              $temp=['logNo' => makeNo('TRC',str_pad($k+1,4,'0',STR_PAD_LEFT)),
                      'tradNo' => $info->tradNo,
                      'platform_type' => $qrdArr[$v['cxCode']]['platform_type'],
@@ -97,7 +97,7 @@ class TradePool extends Base
                      'relaNo' => $info->logNo,
                      'status' => 2,//2审核通过
                      ];
-             $Assoc[]=[
+             $Asoc[]=[
                 'assocNo' =>makeNo('AS',str_pad($k+1,4,'0',STR_PAD_LEFT)),
                 'apply_id' =>0,
                 'apply_name' =>'system',
@@ -120,14 +120,14 @@ class TradePool extends Base
            $qrdArr = array_values($qrdArr);
            $up= (new QrdInfo)->saveAll($qrdArr);
            if(!$up) throw new \Exception('通用订单数据修改失败');
-           $up= (new Assoc)->saveAll($Assoc);
+           $up= (new Assoc)->saveAll($Asoc);
            if(!$up) throw new \Exception('关联数据创建失败');
            $up= (new TradePool)->saveAll($log);
            if(!$up) throw new \Exception('衍生数据创建失败');
     }
 
     public static function returnTrade($info){
-        $return = TradeReturn::where(["logNo"=>$info->logNo,"status"=>2])->findOrEmpty();
+        $return = TradeReturn::where(["logNo"=>$info->logNo,"status"=>1])->findOrEmpty();
         if($return->isEmpty()) throw new \Exception("{$info->logNo}退款记录未找到");
         $trade = self::where(["relaNo"=>$info->logNo,"tag_type"=>1,"status"=>2,"tradNo"=>$info->tradNo,"is_del"=>0])->select();
         if($trade->isEmpty()) throw new \Exception("未找到关联资金数据");
@@ -148,7 +148,7 @@ class TradePool extends Base
         }
         $returns=[];
         foreach ($trade as $k=>$v){
-            $v->status = 3;
+            $v->status = 4;
            $up= $v->save();
            if(!$up) throw new \Exception('资金数据修改失败');
             $returns[]=[ 'returnCode'=>makeNo('RTA',str_pad($k+1,4,'0',STR_PAD_LEFT)),
@@ -161,7 +161,7 @@ class TradePool extends Base
             'apply_name'=>"system",
             'return_reason'=>$return->return_reason,
             'remark'=>$return->remark,
-            'status'=>2];
+            'status'=>1];
         }
 
         $up= (new TradeReturn)->saveAll($returns);