绑定付款记录

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
+6 -3
View File
@@ -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);
}
+31 -31
View File
@@ -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'
]
];
}