public function edit($id) { $withdraw = Withdraw::find($id); //帐户余额 $amount = UserFinance::findOrNew($withdraw->uid)->money; //查找当前用户冻结金额 $freeze_money = Bill::whereRaw("uid = ? and is_dealt = ? and created_at>='?' and event in( 'commission' , 'income')", array($withdraw->uid, 1, date("Y-m-d 00:00:00", strtotime('-7 days'))))->sum('value') ?: 0; //可取资金 $usable_money = intval(($amount - $freeze_money) / ($this->site['withdraw_counter_percent'] + 1)); $this->_user_money = compact('amount', 'freeze_money', 'usable_money'); $withdraw = Withdraw::with(['bankcards'])->find($id); if (empty($withdraw)) { return $this->failure_noexists(); } $keys = 'audit,note'; $this->_validates = $this->getScriptValidate('withdraw.audit', $keys); $this->_data = $withdraw; return $this->view('admin.withdraw.edit'); }