|
@@ -3,7 +3,7 @@ declare (strict_types = 1);
|
|
|
|
|
|
namespace app\admin\listener;
|
|
|
|
|
|
-use app\admin\model\InvoicePay;use app\admin\model\InvoicePool;use app\admin\model\InvoiceTicket;use app\admin\model\Pay;use app\admin\model\PayInfo;use app\admin\model\PayInvoice;use app\admin\model\QrdInfo;use app\admin\model\TagLog;use think\facade\Config;
|
|
|
+use app\admin\model\InvoiceInfo;use app\admin\model\InvoicePay;use app\admin\model\InvoicePool;use app\admin\model\InvoiceTicket;use app\admin\model\Pay;use app\admin\model\PayInfo;use app\admin\model\PayInvoice;use app\admin\model\QrdInfo;use app\admin\model\TagLog;use think\facade\Config;
|
|
|
class ComonQrd
|
|
|
{
|
|
|
/**
|
|
@@ -115,6 +115,47 @@ class ComonQrd
|
|
|
$this->CheckComonOrder($payinfo);
|
|
|
$payinfo->save();
|
|
|
PayInvoice::create($payinvoice);
|
|
|
+ PayInvoice::create($payinvoice);
|
|
|
+ if(!empty($ticket->item)){
|
|
|
+ $itemArr=[];
|
|
|
+ foreach ($ticket->item as $item){
|
|
|
+ $temp=[];
|
|
|
+ $temp['name']=$item['XMMC'];
|
|
|
+ $temp['unit']=$item['DW'];
|
|
|
+ $temp['quantity']=$item['SPSL'];
|
|
|
+ $temp['unit_price']=$item['DJ'];
|
|
|
+ $temp['amount']=$item['JE'];
|
|
|
+ $temp['tax_rate']=$item['SE'];
|
|
|
+ $temp['tax']=strval($item['SL']*100)."%";
|
|
|
+ $itemArr[]=$temp;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $info=[
|
|
|
+ 'payNo' =>$invpay['payNo'] ,
|
|
|
+ 'hpNo' =>$payinvoice['hpNo'] ,
|
|
|
+ 'type' =>$invinfo['inv_type'] ,
|
|
|
+ 'number' =>$ticket->inv_number ,
|
|
|
+ 'code' =>$ticket->inv_code ,
|
|
|
+ 'check_code' =>$ticket->check_code ,
|
|
|
+ 'issue_date' =>date('Ymd' ,strtotime($ticket->open_date)) ,
|
|
|
+ 'buyer_name' =>$ticket->buyer_title ,
|
|
|
+ 'buyer_id' =>$ticket->buyer_id ,
|
|
|
+ 'buyer_address' =>$ticket->buyer_addr . $ticket->buyer_mobile ,
|
|
|
+ 'buyer_bank' =>$ticket->buyer_bank . $ticket->buyer_bankNo ,
|
|
|
+ 'seller_name' =>$ticket->seller_title ,
|
|
|
+ 'seller_id' =>$ticket->seller_id ,
|
|
|
+ 'seller_address' =>$ticket->seller_addr . $ticket->seller_mobile ,
|
|
|
+ 'seller_bank' =>$ticket->seller_bank . $ticket->seller_bankNo ,
|
|
|
+ 'subtotal_amount'=>$ticket->inv_subtotal ,
|
|
|
+ 'subtotal_tax' =>$ticket->tax_fee ,
|
|
|
+ 'total' =>$ticket->inv_total ,
|
|
|
+ 'item_list' =>json_encode($itemArr,JSON_UNESCAPED_UNICODE) ,
|
|
|
+ 'receiver' =>$ticket->reciver ,
|
|
|
+ 'issuer' =>$ticket->issuer ,
|
|
|
+ 'reviewer' =>$ticket->reviewer ,
|
|
|
+ 'change_field' =>'' ,
|
|
|
+ ];
|
|
|
+ InvoiceInfo::create($info);
|
|
|
}
|
|
|
protected function checkPay($data){
|
|
|
$payinfo = Pay::where('payNo',$data['payNo'])->findOrEmpty();
|
|
@@ -125,16 +166,19 @@ class ComonQrd
|
|
|
}
|
|
|
public function CheckComonOrder($payinfo){
|
|
|
if($payinfo->status==3||$payinfo->status==4 ){
|
|
|
- PayInfo::alias('a')->leftJoin('ComonOrder b','a.cgdNo=b.cgdNo')
|
|
|
+ PayInfo::alias('a')
|
|
|
+ ->leftJoin('ComonOrder b','a.cgdNo=b.cgdNo')
|
|
|
->where(['payNo'=>$payinfo->payNo,'is_del'=>0,'a.status'=>0])
|
|
|
->update(['b.status'=>0]);
|
|
|
}else{
|
|
|
if($payinfo->inv_status==3 &&$payinfo->pay_status==3){
|
|
|
- PayInfo::alias('a')->leftJoin('ComonOrder b','a.cgdNo=b.cgdNo')
|
|
|
+ PayInfo::alias('a')
|
|
|
+ ->leftJoin('ComonOrder b','a.cgdNo=b.cgdNo')
|
|
|
->where(['payNo'=>$payinfo->payNo,'is_del'=>0,'a.status'=>1])
|
|
|
->update(["b.status"=>2]);
|
|
|
}elseif($payinfo->inv_status!=3|| $payinfo->pay_status!=3){
|
|
|
- PayInfo::alias('a')->leftJoin('ComonOrder b','a.cgdNo=b.cgdNo')
|
|
|
+ PayInfo::alias('a')
|
|
|
+ ->leftJoin('ComonOrder b','a.cgdNo=b.cgdNo')
|
|
|
->where(['payNo'=>$payinfo->payNo,'is_del'=>0,'a.status'=>1])
|
|
|
->update(['b.status'=>1]);
|
|
|
}
|