wugg 5 months ago
parent
commit
7ac3e47ade
2 changed files with 8 additions and 2 deletions
  1. 1 1
      app/cxinv/controller/Payinv.php
  2. 7 1
      app/cxinv/model/PayInvoice.php

+ 1 - 1
app/cxinv/controller/Payinv.php

@@ -44,7 +44,7 @@ class Payinv extends Base{
                 'invStatus'=>1,
                 'invoiceNumber'=>$invoice->invoice_number,
                 'invoiceCode'=>$invoice->invoice_code,
-                'status'=>14,//待关联订单
+                'status'=>11,//待关联订单
                 'checkNumber'=>$invoice->check_code,
                 'open_time'=>$invoice->open_date,
                 'addtime'=>date('Y-m-d H:i:s'),

+ 7 - 1
app/cxinv/model/PayInvoice.php

@@ -46,7 +46,9 @@ class PayInvoice extends Base
         if ($model->invType==4){
             $ticket= InvoiceInfo::where("payNo",$model->payNo)->findOrEmpty();
             if (!$ticket->isEmpty() && !empty($ticket->item_list)){
-                 (new  InvoiceItem)->saveAll(array_map(function ($item)use($model) {
+                $bool = true;
+                 (new  InvoiceItem)->saveAll(array_map(function ($item)use($model,&$bool) {
+                     if($item['amount']<0) $bool=false;
                               return [
                                   'invoiceCode'=>$model->hpNo,
                                   'order_type'=>2,
@@ -65,6 +67,10 @@ class PayInvoice extends Base
 
                  $ticket->hpNo= $model->hpNo;
                  $ticket->save();
+                 if($bool==false){
+                     $model->status=14;
+                     $model->save();
+                 }
             }
         }
     }