|
@@ -15,6 +15,7 @@ class ComonQrd
|
|
|
{
|
|
|
if($event['type']=="pay")$this->payComon($event);
|
|
|
if($event['type']=="inv")$this->invComon($event);
|
|
|
+ if($event['type']=="rinv")$this->returnInv($event);
|
|
|
if($event['type']=="check")$this->checkPay($event);
|
|
|
}
|
|
|
|
|
@@ -22,6 +23,7 @@ class ComonQrd
|
|
|
$payinfo = Pay::where("payNo",$data['payNo'])->findOrEmpty();
|
|
|
if($payinfo->isEmpty()) return;
|
|
|
if($payinfo->is_comon!=1)return;
|
|
|
+ if(!in_array($payinfo->status,[1,2]))return;
|
|
|
$qrdNo = PayInfo::alias("a")->leftJoin("ComonOrder b","a.cgdNo=b.cgdNo")->where(["payNo"=>$data['payNo'],"is_del"=>0,"a.status"=>1])->column("orderCode");
|
|
|
$qrdinfo = QrdInfo::where([["sequenceNo","in",$qrdNo],["wpay_fee",">",0]])->select();
|
|
|
if($qrdinfo->isEmpty())return;
|
|
@@ -79,6 +81,7 @@ class ComonQrd
|
|
|
$payinfo = Pay::where('payNo',$invpay['payNo'])->findOrEmpty();
|
|
|
if($payinfo->isEmpty()) return;
|
|
|
if($payinfo->is_comon!=1)return;
|
|
|
+ if(!in_array($payinfo->status,[1,2]))return;
|
|
|
$ticket =InvoiceTicket::where(["invNo"=>$data['invNo'],"type"=>0])->json(['item'])->findOrEmpty();
|
|
|
if($ticket->isEmpty())return;
|
|
|
$pay_fee=0;
|
|
@@ -154,6 +157,9 @@ class ComonQrd
|
|
|
'change_field' =>'' ,
|
|
|
];
|
|
|
InvoiceInfo::create($info);
|
|
|
+ $invpay->hpNo = $payinvoice['hpNo'];
|
|
|
+ $invpay->status =1;
|
|
|
+ $invpay->save();
|
|
|
}
|
|
|
protected function checkPay($data){
|
|
|
$payinfo = Pay::where('payNo',$data['payNo'])->findOrEmpty();
|
|
@@ -182,4 +188,27 @@ class ComonQrd
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ public function returnInv($data){
|
|
|
+ $invinfo =InvoicePool::where(['invNo'=>$data['invNo'],"status"=>[5,6,7,8,9]])->findOrEmpty();
|
|
|
+ if($invinfo->isEmpty())return;
|
|
|
+ if($invinfo->is_comon!=1 )return;
|
|
|
+ $invpay =InvoicePay::where(['invNo'=>$data['invNo']])->findOrEmpty();
|
|
|
+ if($invpay->isEmpty())return;
|
|
|
+ if($invpay->status!=1 )return;
|
|
|
+ $payinfo = Pay::where('payNo',$invpay['payNo'])->findOrEmpty();
|
|
|
+ if($payinfo->isEmpty()) return;
|
|
|
+ if($payinfo->is_comon!=1)return;
|
|
|
+ $payinvoice = PayInvoice::where(["hpNo"=>$invpay->hpNo,"status"=>4])->findOrEmpty();
|
|
|
+ if($payinvoice->isEmpty())return;
|
|
|
+ $payinvoice->status=10;
|
|
|
+ $payinvoice->save();
|
|
|
+ $payinfo->winv_fee = $payinfo->winv_fee+$payinvoice->inv_fee;
|
|
|
+ $payinfo->ainv_fee = $payinfo->ainv_fee-$payinvoice->inv_fee;
|
|
|
+ $payinfo->inv_status = ($payinfo->winv_fee==0 &&$payinfo->inv_fee==0)?3:($payinfo->ainv_fee==0?2:1);
|
|
|
+ $this->CheckComonOrder($payinfo);
|
|
|
+ $payinfo->save();
|
|
|
+ $invpay->status =2;
|
|
|
+ $invpay->save();
|
|
|
+ }
|
|
|
}
|