绑定付款记录

This commit is contained in:
2025-09-24 10:16:34 +08:00
parent 54f83679ea
commit abc1142e88
3 changed files with 38 additions and 34 deletions
+5 -2
View File
@@ -54,6 +54,8 @@ class FinReceiptService
// 没有付款记录的收款记录 // 没有付款记录的收款记录
if (isset($p['payment_apply']) && $p['payment_apply'] == 'not') { 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']; $config['where']['payment_apply_id'] = ['not null'];
} }
@@ -110,6 +112,7 @@ class FinReceiptService
public function beforeServiceUpdate($data, Request $request) public function beforeServiceUpdate($data, Request $request)
{ {
$data['updated_by'] = $request->user->uid; $data['updated_by'] = $request->user->uid;
if(isset($data['arrived_at']))
$data['arrived_at'] = strtotime($data['arrived_at']); $data['arrived_at'] = strtotime($data['arrived_at']);
if(isset($data['received_at'])) if(isset($data['received_at']))
$data['received_at'] = strtotime($data['received_at']); $data['received_at'] = strtotime($data['received_at']);
@@ -118,8 +121,8 @@ class FinReceiptService
} }
public function afterServiceUpdate($res) public function afterServiceUpdate($res)
{ {
$receipt = FinReceipt::where('id',$res->id)->first()->toArray(); $receipt = FinReceipt::where('id',$res['id'])->first()->toArray();
$receipt = array_merge($receipt,['receipt_id' => $res->id]); $receipt = array_merge($receipt,['receipt_id' => $res['id']]);
unset($receipt['id']); unset($receipt['id']);
FinReceiptHis::create($receipt); FinReceiptHis::create($receipt);
} }
+31 -31
View File
@@ -8,49 +8,49 @@ class FinReceiptValidate extends Validate
{ {
// 规则 // 规则
protected $rule = [ protected $rule = [
'payment_apply_id' => 'integer|gt:0', // 'payment_apply_id' => 'integer|gt:0',
'country_id' => 'require|integer|gt:0', // 'country_id' => 'require|integer|gt:0',
'remitter' => 'require', // 'remitter' => 'require',
'account_id' => 'require|integer|gt:0', // 'account_id' => 'require|integer|gt:0',
'currency_id' => 'require|integer|gt:0', // 'currency_id' => 'require|integer|gt:0',
'amount' => 'require|gt:0', // 'amount' => 'require|gt:0',
'exchange_rate' => 'require|gt:0', // 'exchange_rate' => 'require|gt:0',
'arrived_at' => 'require', // 'arrived_at' => 'require',
'is_domestic_return' => 'require|integer', // 'is_domestic_return' => 'require|integer',
]; ];
// 提示 // 提示
protected $message = [ protected $message = [
'payment_apply_id.integer' => '付款申请ID必须是整数', // 'payment_apply_id.integer' => '付款申请ID必须是整数',
'payment_apply_id.gt' => '付款申请ID必须大于0', // 'payment_apply_id.gt' => '付款申请ID必须大于0',
'country_id.require' => '付款来源国家ID不能为空', // 'country_id.require' => '付款来源国家ID不能为空',
'country_id.integer' => '付款来源国家ID必须是整数', // 'country_id.integer' => '付款来源国家ID必须是整数',
'country_id.gt' => '付款来源国家ID必须大于0', // 'country_id.gt' => '付款来源国家ID必须大于0',
'remitter.require' => '汇款人不能为空', // 'remitter.require' => '汇款人不能为空',
'account_id.require' => '收款账号ID不能为空', // 'account_id.require' => '收款账号ID不能为空',
'account_id.integer' => '收款账号ID必须是整数', // 'account_id.integer' => '收款账号ID必须是整数',
'account_id.gt' => '收款账号ID必须大于0', // 'account_id.gt' => '收款账号ID必须大于0',
'currency_id.require' => '收款币种ID不能为空', // 'currency_id.require' => '收款币种ID不能为空',
'currency_id.integer' => '收款币种ID必须是整数', // 'currency_id.integer' => '收款币种ID必须是整数',
'currency_id.gt' => '收款币种ID必须大于0', // 'currency_id.gt' => '收款币种ID必须大于0',
'amount.require' => '收款金额不能为空', // 'amount.require' => '收款金额不能为空',
'amount.gt' => '收款金额必须大于0', // 'amount.gt' => '收款金额必须大于0',
'exchange_rate.require' => '实际汇率不能为空', // 'exchange_rate.require' => '实际汇率不能为空',
'exchange_rate.gt' => '实际汇率必须大于0', // 'exchange_rate.gt' => '实际汇率必须大于0',
'arrived_at.require' => '到账时间不能为空', // 'arrived_at.require' => '到账时间不能为空',
'arrived_at.gt' => '到账时间必须大于0', // 'arrived_at.gt' => '到账时间必须大于0',
'is_domestic_return.require' => '是否回转内地不能为空', // 'is_domestic_return.require' => '是否回转内地不能为空',
'is_domestic_return.integer' => '是否回转内地必须是整数', // 'is_domestic_return.integer' => '是否回转内地必须是整数',
]; ];
// 场景 // 场景
protected $scene = [ protected $scene = [
'store' => [ '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' => [ 'update' => [
// 'payment_apply_id'
] ]
]; ];
} }
+1
View File
@@ -358,6 +358,7 @@ Route::group('/admin', function () {
Route::any('/show', [app\common\controller\FinReceiptController::class, 'show']); Route::any('/show', [app\common\controller\FinReceiptController::class, 'show']);
Route::any('/store', [app\common\controller\FinReceiptController::class, 'store']); Route::any('/store', [app\common\controller\FinReceiptController::class, 'store']);
Route::any('/update', [app\common\controller\FinReceiptController::class, 'update']); 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']); Route::any('/destroy', [app\common\controller\FinReceiptController::class, 'destroy']);
}); });