diff --git a/app/admin/controller/Dashboard.php b/app/admin/controller/Dashboard.php index 12a3ddb..ae5a91f 100644 --- a/app/admin/controller/Dashboard.php +++ b/app/admin/controller/Dashboard.php @@ -171,7 +171,7 @@ class Dashboard extends Backend $logFrom = new UserMoneyLog(); $logFrom->save([ 'user_id' => 0, - 'money' => -$money, + 'money' => $money, 'before' => $bankFrom->current_balance + $money, 'after' => $bankFrom->current_balance, 'type' => 4, @@ -224,9 +224,18 @@ class Dashboard extends Backend $result = false; $data = $this->excludeFields($data); - if ($data['type'] == 2) { - $data['money'] = -$data['money']; + $bank = Bank::where('id', $data['bank_id'])->where('status', 1)->lock(true)->find(); + if (!$bank) { + throw new ValidateException('银行账户不存在或已被禁用'); } + + if (in_array($data['type'], [2,4])) { + $bank->current_balance -= $data['money']; + } else { + $bank->current_balance += $data['money']; + } + $bank->save(); + $user_id = User::where('jk_username', $data['user_name'])->value('id'); if (!$user_id) { $this->error(__("The user can't find it", [''])); diff --git a/app/admin/controller/user/MoneyLog.php b/app/admin/controller/user/MoneyLog.php index 34e8204..3931116 100644 --- a/app/admin/controller/user/MoneyLog.php +++ b/app/admin/controller/user/MoneyLog.php @@ -78,6 +78,7 @@ class MoneyLog extends Backend */ public function add(int $userId = 0): void { + $this->error(__('No rows were added')); if ($this->request->isPost()) { $data = $this->request->post(); if (!$data) { diff --git a/web/src/lang/backend/en/user/moneyLog.ts b/web/src/lang/backend/en/user/moneyLog.ts index 7169e6a..24f1007 100644 --- a/web/src/lang/backend/en/user/moneyLog.ts +++ b/web/src/lang/backend/en/user/moneyLog.ts @@ -15,7 +15,7 @@ export default { User: 'User', 'Transaction id': 'Transaction id', 'Created by': 'Created by', - 'type': '类型', + 'type': 'Type', 'type_list': { 1 : 'Deposit', 2 : 'Withdraw',