can('dcat.admin.wallet_to_bank_logs.verify'); } /** * Handle the form request. * * @param array $input * * @return mixed */ public function handle(array $input) { $id = $this->payload['id'] ?? 0; $log = WalletToBankLog::findOrFail($id); try { DB::beginTransaction(); $log->update($input); //如果拒绝,重新添加对应可提金额 if ($log->status == 2) { $walletService = new WalletService(); $walletService->changeBalance($log->user, $log->amount, WalletLog::ACTION_WITHDRAW_FAILED, '提现-失败', $log); } DB::commit(); } catch (Throwable $th) { DB::rollBack(); report($th); return $this->response()->error('操作失败:'.$th->getMessage()); } return $this->response() ->success(__('admin.update_succeeded')) ->refresh(); } /** * Build a form here. */ public function form() { $id = $this->payload['id'] ?? 0; $log = WalletToBankLog::findOrFail($id); $this->text('bank_name')->value($log->bank_name)->disable(); $this->text('bank_number')->value($log->bank_number)->disable(); $this->text('username')->value($log->username)->disable(); $this->text('bank_description')->value($log->bank_description)->disable(); $this->currency('amount')->symbol('¥')->value(bcdiv($log->amount, 100, 2))->disable(); $this->rate('rate')->value($log->rate)->disable(); $this->currency('service_amount')->symbol('¥')->value(bcdiv($log->service_amount, 100, 2))->disable(); $this->currency('account_amount')->symbol('¥')->value(bcdiv($log->account_amount, 100, 2))->disable(); $this->radio('status')->options([ 1 => '成功', 2 => '拒绝', ])->default(1); $this->text('remarks')->rules('required_if:status,2', ['required_if'=>'拒绝时需要填写备注']); } }