From a3819bcba7b4ba3ec47d6d143c84c07f7fb46513 Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Thu, 30 Oct 2025 17:21:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A5=E8=B4=A6=E8=B5=84=E6=96=99=E9=99=84?= =?UTF-8?q?=E4=BB=B6=E6=A0=BC=E5=BC=8F=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/controller/FinPaymentApplyController.php | 9 +++++++-- app/common/model/FinReceiptHis.php | 2 +- app/common/service/FinPaymentApplyService.php | 11 ++++++----- app/process/Task.php | 9 ++------- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/app/common/controller/FinPaymentApplyController.php b/app/common/controller/FinPaymentApplyController.php index 6f29595..1db09d3 100644 --- a/app/common/controller/FinPaymentApplyController.php +++ b/app/common/controller/FinPaymentApplyController.php @@ -47,7 +47,7 @@ class FinPaymentApplyController extends BaseController if (isset($data['currency_id'])) //付款币种 $data['currency_name'] = SysCurrency::where('id', $data['currency_id'])->value('currency_name')??''; $OssService = new OssService(); - if (isset($data['submit_files'])){ + if (!empty($data['submit_files'])){ $data['submit_files'] = json_decode($data['submit_files'], true); foreach ($data['submit_files'] as $key => $value) { $data['submit_files'][$key] = [ @@ -56,6 +56,8 @@ class FinPaymentApplyController extends BaseController 'file_name' => $value['file_name'], ]; } + }else{ + $data['submit_files'] = []; } if (!empty($data['voucher_file'])) { $data['voucher_file_full'] = $OssService->generatePrivateUrl($data['voucher_file']); @@ -106,7 +108,7 @@ class FinPaymentApplyController extends BaseController if (isset($data['currency_id'])) //付款币种 $data['currency_name'] = SysCurrency::where('id', $data['currency_id'])->value('currency_name')??''; $OssService = new OssService(); - if (isset($data['submit_files'])){ + if (!empty($data['submit_files'])){ $data['submit_files'] = json_decode($data['submit_files'], true); foreach ($data['submit_files'] as $key => $value) { $data['submit_files'][$key] = [ @@ -115,7 +117,10 @@ class FinPaymentApplyController extends BaseController 'file_name' => $value['file_name'], ]; } + }else{ + $data['submit_files'] = []; } + if (!empty($data['voucher_file'])) { $data['voucher_file_full'] = $OssService->generatePrivateUrl($data['voucher_file']); } elseif (isset($data['voucher_file'])) { diff --git a/app/common/model/FinReceiptHis.php b/app/common/model/FinReceiptHis.php index 814b87f..8a036b3 100644 --- a/app/common/model/FinReceiptHis.php +++ b/app/common/model/FinReceiptHis.php @@ -40,7 +40,7 @@ class FinReceiptHis extends Model /** * 允许自动填充模型字段 */ - protected $fillable = ['id', 'receipt_id', 'receipt_no', 'payment_apply_id', 'country_id', 'remitter', 'account_id', 'currency_id', 'amount', 'discount_amount', 'total_amount_cny', 'exchange_rate', 'arrived_at', 'received_at', 'voucher_no', 'fx_receipt_file', 'is_domestic_return', 'created_by', 'updated_by', 'created_at', 'updated_at']; + protected $fillable = ['id', 'receipt_id', 'receipt_no', 'payment_apply_id', 'country_id', 'remitter', 'account_id', 'currency_id', 'amount', 'discount_amount', 'total_amount_cny', 'exchange_rate', 'arrived_at', 'received_at', 'voucher_no', 'fx_receipt_file', 'is_domestic_return', 'created_by', 'updated_by', 'claimed_by', 'created_at', 'updated_at']; /** * 不允许自动填充模型字段 diff --git a/app/common/service/FinPaymentApplyService.php b/app/common/service/FinPaymentApplyService.php index ce2bbfd..f5f9ed3 100644 --- a/app/common/service/FinPaymentApplyService.php +++ b/app/common/service/FinPaymentApplyService.php @@ -90,6 +90,8 @@ class FinPaymentApplyService $data['submit_files'] = json_encode($data['submit_files']); redis::set('stock_' . $data['doc_user_id'], json_encode($request->post('stock')), 'EX', 30); unset($data['stock']); + if($data['submit_files'] == '[]' || $data['submit_files'] == '{}' ) + $data['submit_files'] = ''; return $data; } @@ -113,6 +115,8 @@ class FinPaymentApplyService public function beforeServiceUpdate($data, Request $request) { $data['submit_files'] = json_encode($data['submit_files']); + if($data['submit_files'] == '[]' || $data['submit_files'] == '{}' ) + $data['submit_files'] = ''; return $data; } @@ -174,10 +178,9 @@ class FinPaymentApplyService // 入账资料超时 if (isset($param['scene']) && $param['scene'] == 'file_timeout') { + $where[] = ['submit_files', '']; $where[] = ['claimed_at', '<', time()-24*60*60]; $where[] = ['claimed_at', '>', 1]; - $orWhere[] = ['submit_files', '[]']; - $orWhere[] = ['submit_files', '']; } // 关键字 @@ -187,9 +190,7 @@ class FinPaymentApplyService } // 构建查询 - $query = $this->modelClass::where($where)->where(function($query) use ($orWhere) { - $query->orWhere($orWhere); - }); + $query = $this->modelClass::where($where); // 是否已关联收款记录的筛选 $correlation = $param['correlation']??''; diff --git a/app/process/Task.php b/app/process/Task.php index 7175244..cf526c6 100644 --- a/app/process/Task.php +++ b/app/process/Task.php @@ -46,18 +46,13 @@ class Task return; } Log::info('fin_payment_apply submit_files start', [time()]); - $orWhere = [ - ['submit_files', '=', '[]'], - ['submit_files', '=', ''], - ]; $where = [ + ['submit_files', '=', ''], ['warn', '<', 2], ['created_at', '>', time() - 60 * 60 * 48], ['created_at', '<', time() - 60 * 60 * 24], ]; - $payment = FinPaymentApply::where($where)->where(function($query) use ($orWhere) { - $query->orWhere($orWhere); - })->orderBy('id', 'desc')->get(); + $payment = FinPaymentApply::where($where)->orderBy('id', 'desc')->get(); foreach ($payment as $item) { Log::info('fin_payment_apply submit_files ', [$item->toArray()]); $notice = [