From d4d22e57fcb9fe573d10c6c12d4f7a7a4c1c7077 Mon Sep 17 00:00:00 2001 From: weigang Date: Tue, 20 Oct 2020 10:22:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=E6=B5=81=E6=B0=B4?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E5=BD=93=E5=89=8D=E4=BD=99=E9=A2=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Service/v3/Implementations/FinancialRecordService.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/Service/v3/Implementations/FinancialRecordService.php b/app/Service/v3/Implementations/FinancialRecordService.php index c055aaf..ea57d38 100644 --- a/app/Service/v3/Implementations/FinancialRecordService.php +++ b/app/Service/v3/Implementations/FinancialRecordService.php @@ -39,6 +39,12 @@ class FinancialRecordService implements FinancialRecordServiceInterface $financialRecord->suffix($mod); } + // 获取当前用户的流水前余额 + $balance = UserBalance::query()->firstOrNew([ + 'user_type' => $record['user_type'], + 'source_id' => $user_id + ])->value('balance'); + return $financialRecord->fill( [ 'user_id' => $user_id, @@ -50,6 +56,7 @@ class FinancialRecordService implements FinancialRecordServiceInterface 'desc' => $record['desc'], 'comment' => $record['comment'], 'status' => $record['status'], + 'current_balance' => $balance ] )->save();