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

+ 6 - 3
app/cxinv/controller/Payinv.php

@@ -13,7 +13,6 @@ use think\App;
 use think\facade\Validate;
 class Payinv extends Base{
     public function __construct(App $app) {
-
         parent::__construct($app);
         $this->model =new PayInvoice();
     }
@@ -188,7 +187,7 @@ class Payinv extends Base{
                     ->leftJoin('invoice b', 'a.payNo=b.InvCode')
                     ->where(['a.is_del' => 0])
                     ->whereIn('a.hpNo', $unique)
-                    ->column('a.id,a.payNo,a.hpNo,a.invoiceType,a.inv_fee as invoice_fee,a.status,b.companyNo,a.remark', 'a.hpNo');
+                    ->column('a.id,a.payNo,a.hpNo,a.invType,a.status,b.companyNo,a.remark', 'a.hpNo');
         if (empty($payArr)) return error("没有需要认证的发票");
         $this->model->startTrans();
         try {
@@ -202,7 +201,11 @@ class Payinv extends Base{
                 if ($payinfo['companyNo'] == '') throw new \Exception("{$value['hpNo']}发票业务公司信息有误");
                 if ($payinfo['companyNo'] != $companyNo) throw new \Exception("{$value['hpNo']}不属于当前业务公司发票");
                 if ($value['status'] != '3') throw new \Exception("{$value['hpNo']}状态有误");
-                $saveAll[]=["id"=> $value['id'],"payNo"=>$value['payNo'],"status"=>$val['status'],"remark"=>$val['status']==4?$value['remark']:$val['remark']];
+                $value['status'] = $val['status'];
+                if ($val['remark'] != '') {
+                    $value['remark'] =$val['remark'];
+                }
+                $saveAll[]=$value;
             }
             $this->model->saveAll($saveAll);
            $this->model->commit();

+ 2 - 0
app/cxinv/model/PayInvoice.php

@@ -70,9 +70,11 @@ class PayInvoice extends Base
     }
 
     public static function onAfterUpdate(Model $model) : void{
+        Log::info('PayInv回票状态变更onAfterUpdate:model'.json_encode($model->toArray()));
         if ($model->invType==4){
             $change = $model->getChangedData();
             if (isset($change['status'])){
+             Log::info("PayInv回票状态变更onAfterUpdate:change".json_encode($change));
              $invocie = Invoice::where("InvCode",$model->payNo)->findOrEmpty();
              if($change['status']==4){
                  if (!$invocie->isEmpty()){