Пример #1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store()
 {
     if (!Request::has('_id', 'type')) {
         return failure('参数错误');
     }
     $type = Request::input('type', 1);
     $id = Request::input('_id');
     $withdraw = UserWithdraw::find($id);
     if (!$withdraw) {
         return failure('该条数据不存在');
     }
     $user = User::find($withdraw->user_id);
     if (!$user) {
         return failure('该用户不存在');
     }
     if ($type) {
         $r = $withdraw->setSuccess($user);
     } else {
         $r = $withdraw->setFailure($user);
     }
     if ($r) {
         return success('提现成功');
     }
     return failure('提现失败');
 }
Пример #2
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('申请失败,请联系客服');
 }