Beispiel #1
0
 public function allocate($comment)
 {
     if ($this->f_status == 1) {
         throw new Exception("该借款已放", 10001);
     }
     $this->f_status = 1;
     $fund = Fund::find($this->f_id);
     if (empty($fund)) {
         throw new Exception("没有找到相关的基金信息", 10001);
     }
     // do transaction
     $userBankCard = UserProfileBankcard::find($fund->u_id);
     if (empty($userBankCard)) {
         throw new Exception("没有找到用户相关的银行卡信息", 10001);
     }
     $this->addAllocLog($comment);
     return $this->save();
 }
Beispiel #2
0
 public function postPaymentBank()
 {
     $token = Input::get('token', '');
     $u_id = Input::get('u_id', 0);
     $card_num = Input::get('card_num', '');
     $holder = Input::get('holder', '');
     $bank = Input::get('bank', 0);
     try {
         $user = User::chkUserByToken($token, $u_id);
         $card = UserProfileBankcard::where('b_card_number', '=', $card_num)->first();
         if (!empty($card) && $card->u_id != $u_id) {
             throw new Exception("该卡号不可用", 9007);
         }
         $card = UserProfileBankcard::find($u_id);
         if (empty($card)) {
             $card = new UserProfileBankcard();
             $card->u_id = $u_id;
         }
         $card->b_card_number = $card_num;
         $card->b_holder_name = $holder;
         $card->b_id = $bank;
         $card->save();
         $re = Tools::reTrue('绑定成功');
     } catch (Exception $e) {
         $re = Tools::reFalse($e->getCode(), '绑定失败:' . $e->getMessage());
     }
     return Response::json($re);
 }
 public function censorUserProfileBank($id)
 {
     $check = Input::get('check', 0);
     $remark = Input::get('remark', '');
     try {
         if ($check == 0) {
             if (!$remark) {
                 throw new Exception("备注不能为空", 10001);
             }
         }
         $tmp_bank = TmpUserProfileBankcard::find($id);
         if (empty($tmp_bank)) {
             throw new Exception("查找的用户信息不存在", 10001);
         }
         if ($tmp_bank->b_status == 1) {
             throw new Exception("审核已经通过了", 10002);
         }
         $bank = UserProfileBankcard::find($id);
         if (empty($bank)) {
             $bank = new UserProfileBankcard();
         }
         if ($check == 1) {
             $bank->u_id = $tmp_bank->u_id;
             $bank->b_id = $tmp_bank->b_id;
             $bank->b_card_number = $tmp_bank->b_card_number;
             $bank->b_holder_name = $tmp_bank->b_holder_name;
             $bank->b_holder_phone = $tmp_bank->b_holder_phone;
             $bank->b_holder_id_number = $tmp_bank->b_holder_id_number;
             $bank->save();
             $tmp_bank->b_status = 1;
             $tmp_bank->remark = '';
         } else {
             $tmp_bank->b_status = 2;
             $tmp_bank->remark = $remark;
         }
         $tmp_bank->censor();
         $re = Tools::reTrue('审核用户银行信息成功');
     } catch (Exception $e) {
         $re = Tools::reFalse($e->getCode(), '审核用户银行信息失败:' . $e->getMessage());
     }
     return Response::json($re);
 }