转账修改
This commit is contained in:
@@ -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", ['']));
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user