From abc1142e88e1707d4e1aeaf0070ff691fb8c3897 Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Wed, 24 Sep 2025 10:16:34 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=91=E5=AE=9A=E4=BB=98=E6=AC=BE=E8=AE=B0?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/service/FinReceiptService.php | 9 ++-- app/common/validate/FinReceiptValidate.php | 62 +++++++++++----------- config/route.php | 1 + 3 files changed, 38 insertions(+), 34 deletions(-) diff --git a/app/common/service/FinReceiptService.php b/app/common/service/FinReceiptService.php index e50bc7d..bf83f38 100644 --- a/app/common/service/FinReceiptService.php +++ b/app/common/service/FinReceiptService.php @@ -54,6 +54,8 @@ class FinReceiptService // 没有付款记录的收款记录 if (isset($p['payment_apply']) && $p['payment_apply'] == 'not') { + $config['where']['payment_apply_id'] = ['null']; + } elseif (isset($p['payment_apply']) && $p['payment_apply'] == 'already') { $config['where']['payment_apply_id'] = ['not null']; } @@ -110,7 +112,8 @@ class FinReceiptService public function beforeServiceUpdate($data, Request $request) { $data['updated_by'] = $request->user->uid; - $data['arrived_at'] = strtotime($data['arrived_at']); + if(isset($data['arrived_at'])) + $data['arrived_at'] = strtotime($data['arrived_at']); if(isset($data['received_at'])) $data['received_at'] = strtotime($data['received_at']); @@ -118,8 +121,8 @@ class FinReceiptService } public function afterServiceUpdate($res) { - $receipt = FinReceipt::where('id',$res->id)->first()->toArray(); - $receipt = array_merge($receipt,['receipt_id' => $res->id]); + $receipt = FinReceipt::where('id',$res['id'])->first()->toArray(); + $receipt = array_merge($receipt,['receipt_id' => $res['id']]); unset($receipt['id']); FinReceiptHis::create($receipt); } diff --git a/app/common/validate/FinReceiptValidate.php b/app/common/validate/FinReceiptValidate.php index c006dee..237b03e 100644 --- a/app/common/validate/FinReceiptValidate.php +++ b/app/common/validate/FinReceiptValidate.php @@ -8,49 +8,49 @@ class FinReceiptValidate extends Validate { // 规则 protected $rule = [ - 'payment_apply_id' => 'integer|gt:0', - 'country_id' => 'require|integer|gt:0', - 'remitter' => 'require', - 'account_id' => 'require|integer|gt:0', - 'currency_id' => 'require|integer|gt:0', - 'amount' => 'require|gt:0', - 'exchange_rate' => 'require|gt:0', - 'arrived_at' => 'require', - 'is_domestic_return' => 'require|integer', +// 'payment_apply_id' => 'integer|gt:0', +// 'country_id' => 'require|integer|gt:0', +// 'remitter' => 'require', +// 'account_id' => 'require|integer|gt:0', +// 'currency_id' => 'require|integer|gt:0', +// 'amount' => 'require|gt:0', +// 'exchange_rate' => 'require|gt:0', +// 'arrived_at' => 'require', +// 'is_domestic_return' => 'require|integer', ]; // 提示 protected $message = [ - 'payment_apply_id.integer' => '付款申请ID必须是整数', - 'payment_apply_id.gt' => '付款申请ID必须大于0', - 'country_id.require' => '付款来源国家ID不能为空', - 'country_id.integer' => '付款来源国家ID必须是整数', - 'country_id.gt' => '付款来源国家ID必须大于0', - 'remitter.require' => '汇款人不能为空', - 'account_id.require' => '收款账号ID不能为空', - 'account_id.integer' => '收款账号ID必须是整数', - 'account_id.gt' => '收款账号ID必须大于0', - 'currency_id.require' => '收款币种ID不能为空', - 'currency_id.integer' => '收款币种ID必须是整数', - 'currency_id.gt' => '收款币种ID必须大于0', - 'amount.require' => '收款金额不能为空', - 'amount.gt' => '收款金额必须大于0', - 'exchange_rate.require' => '实际汇率不能为空', - 'exchange_rate.gt' => '实际汇率必须大于0', - 'arrived_at.require' => '到账时间不能为空', - 'arrived_at.gt' => '到账时间必须大于0', - 'is_domestic_return.require' => '是否回转内地不能为空', - 'is_domestic_return.integer' => '是否回转内地必须是整数', +// 'payment_apply_id.integer' => '付款申请ID必须是整数', +// 'payment_apply_id.gt' => '付款申请ID必须大于0', +// 'country_id.require' => '付款来源国家ID不能为空', +// 'country_id.integer' => '付款来源国家ID必须是整数', +// 'country_id.gt' => '付款来源国家ID必须大于0', +// 'remitter.require' => '汇款人不能为空', +// 'account_id.require' => '收款账号ID不能为空', +// 'account_id.integer' => '收款账号ID必须是整数', +// 'account_id.gt' => '收款账号ID必须大于0', +// 'currency_id.require' => '收款币种ID不能为空', +// 'currency_id.integer' => '收款币种ID必须是整数', +// 'currency_id.gt' => '收款币种ID必须大于0', +// 'amount.require' => '收款金额不能为空', +// 'amount.gt' => '收款金额必须大于0', +// 'exchange_rate.require' => '实际汇率不能为空', +// 'exchange_rate.gt' => '实际汇率必须大于0', +// 'arrived_at.require' => '到账时间不能为空', +// 'arrived_at.gt' => '到账时间必须大于0', +// 'is_domestic_return.require' => '是否回转内地不能为空', +// 'is_domestic_return.integer' => '是否回转内地必须是整数', ]; // 场景 protected $scene = [ 'store' => [ - 'payment_apply_id', 'country_id', 'remitter', 'account_id', 'currency_id', 'amount', 'exchange_rate', 'arrived_at' +// 'payment_apply_id', 'country_id', 'remitter', 'account_id', 'currency_id', 'amount', 'exchange_rate', 'arrived_at' ], 'update' => [ - +// 'payment_apply_id' ] ]; } \ No newline at end of file diff --git a/config/route.php b/config/route.php index f2c9cb7..be37a5b 100644 --- a/config/route.php +++ b/config/route.php @@ -358,6 +358,7 @@ Route::group('/admin', function () { Route::any('/show', [app\common\controller\FinReceiptController::class, 'show']); Route::any('/store', [app\common\controller\FinReceiptController::class, 'store']); Route::any('/update', [app\common\controller\FinReceiptController::class, 'update']); + Route::any('/payment', [app\common\controller\FinReceiptController::class, 'update']); Route::any('/destroy', [app\common\controller\FinReceiptController::class, 'destroy']); });