argument('user_id'); $amount = $this->argument('amount'); $user = User::find($user_id); $this->warn('扣除金额: ' . $amount . ' 元'); $this->warn('用户当前余额:' . $user->balance . ' 元'); $this->warn('剩余余额:' . $user->balance - $amount . ' 元'); $confirm = $this->confirm('确认扣除?'); $transaction = new Transaction(); if ($confirm) { $transaction->reduceAmount($user_id, $amount, '控制台扣除。'); $this->info('扣除成功。'); } else { $this->info('取消扣除。'); } } }