Пример #1
0
 /**
  * 申请提现
  *  
  * @date   2015-10-07
  * @return [type]     [description]
  */
 public function applyWithdraw()
 {
     if (!Request::has('money', 'pay_pass')) {
         return failure('参数错误');
     }
     $user = Auth::user();
     $userBank = UserBank::userId($user->id)->where('is_lock', 1)->first();
     if (!$userBank) {
         return failure('您还没有锁定银行卡');
     }
     if ($user->payment_password == '') {
         return failure('您还没有设置资金密码!', 1001);
     }
     if (!Hash::check(Request::input('pay_pass'), $user->payment_password)) {
         return failure('资金密码错误');
     }
     $money = Request::input('money');
     if (UserWithdraw::apply($user, $userBank, (double) $money)) {
         return success('申请成功');
     }
     return failure('申请失败,请联系客服');
 }