|
@@ -22,155 +22,6 @@ class Withdraw extends Common
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 绑定银行卡
|
|
|
|
- */
|
|
|
|
- public function bindBank() {
|
|
|
|
- try {
|
|
|
|
- //$realname = $this->request->request('realname');// 真实姓名
|
|
|
|
- $bank_no = $this->request->request('bank_no');// 银行账号
|
|
|
|
- //$idCard = $this->request->request('id_card');// 身份证号
|
|
|
|
- /*$bank_name = $this->request->request('bank_name');// 银行名称
|
|
|
|
- $open_address = $this->request->request('open_address');// 开户地*/
|
|
|
|
- $open_bank = $this->request->request('open_bank');// 开户行
|
|
|
|
- /*$bank_mobile = $this->request->request('bank_mobile');// 银行预留手机号
|
|
|
|
- $captcha = $this->request->request('captcha'); // 验证码
|
|
|
|
- $mobile = $this->request->request('mobile'); // 手机号*/
|
|
|
|
- $userId = $this->auth->id;
|
|
|
|
- //|| !$bank_name || !$open_address || !$bank_mobile || !$captcha || !$mobile
|
|
|
|
- if(!$bank_no || !$open_bank ) {
|
|
|
|
- throw new Exception("请将信息填写完整");
|
|
|
|
- }
|
|
|
|
- $userAuthWhere['user_id'] = $userId;
|
|
|
|
- $userAuth = model('UserAuth')->where($userAuthWhere)->find();
|
|
|
|
- if (empty($userAuth)) {
|
|
|
|
- throw new Exception('请先实名认证');
|
|
|
|
- }
|
|
|
|
- if ($userAuth['status'] != 1) {
|
|
|
|
- throw new Exception('请先实名认证通过');
|
|
|
|
- }
|
|
|
|
- $realname = $userAuth['realname'];
|
|
|
|
- $idCard = $userAuth['idcard'];
|
|
|
|
- $userService = new UserService();
|
|
|
|
- $aliParams = [
|
|
|
|
- 'bank_no' => $bank_no,
|
|
|
|
- 'id_card' => $idCard,
|
|
|
|
- 'real_name' => $realname,
|
|
|
|
- ];
|
|
|
|
- $aliBankCheckRes = $userService->bankCheck($aliParams);
|
|
|
|
- if (!$aliBankCheckRes['status']) {
|
|
|
|
- throw new Exception($aliBankCheckRes['msg']);
|
|
|
|
- }
|
|
|
|
- // 获取用户信息
|
|
|
|
- //$userInfo = \app\common\model\User::where(["id"=>$this->auth->id])->find();
|
|
|
|
-
|
|
|
|
- /*if($userInfo->mobile !== $mobile) $this->error("请输入账号绑定的手机号码!");
|
|
|
|
-
|
|
|
|
- if (!Sms::check($mobile, $captcha, 'binkBank')) {
|
|
|
|
- $this->error(__('验证码不正确!'));
|
|
|
|
- }*/
|
|
|
|
-
|
|
|
|
- // 查询是否有过绑定
|
|
|
|
- $bankInfo = \app\common\model\UserBank::where(["user_id"=>$userId])->find();
|
|
|
|
- $data = [];
|
|
|
|
- $data["realname"] = $realname;
|
|
|
|
- $data["bank_no"] = $bank_no;
|
|
|
|
- $data["open_bank"] = $open_bank;
|
|
|
|
- $data["id_card"] = $idCard;
|
|
|
|
- /*$data["bank_name"] = $bank_name;
|
|
|
|
- $data["open_address"] = $open_address;
|
|
|
|
- $data["mobile"] = $bank_mobile;*/
|
|
|
|
- if($bankInfo) {
|
|
|
|
- $data["updatetime"] = time();
|
|
|
|
- $res = \app\common\model\UserBank::update($data,["user_id"=>$userId]);
|
|
|
|
- } else {
|
|
|
|
- $data["user_id"] = $userId;
|
|
|
|
- $data["createtime"] = time();
|
|
|
|
- $res = \app\common\model\UserBank::insert($data);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if(!$res) {
|
|
|
|
- throw new Exception("网络异常,请稍后重试!");
|
|
|
|
- }
|
|
|
|
- $this->success("银行卡绑定成功!");
|
|
|
|
- } catch (Exception $e) {
|
|
|
|
- $this->error($e->getMessage());
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 获取绑定银行卡信息
|
|
|
|
- */
|
|
|
|
- public function getBankInfo() {
|
|
|
|
- // 查询是否有过绑定
|
|
|
|
- $bankInfo = \app\common\model\UserBank::where(["user_id"=>$this->auth->id])->find();
|
|
|
|
- //if(!$bankInfo) $this->error("银行卡信息获取失败!");
|
|
|
|
- $this->success("获取成功!",$bankInfo);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 绑定支付宝
|
|
|
|
- */
|
|
|
|
- public function bindAlipay() {
|
|
|
|
- //$realname = $this->request->request('realname');//真实姓名
|
|
|
|
- $payNo = $this->request->request('pay_no');//支付宝账号
|
|
|
|
- //$cardNo = $this->request->request('card_no');//身份证号
|
|
|
|
- //$mobile = $this->request->request('mobile'); //手机号
|
|
|
|
- //$captcha = $this->request->request('captcha'); //验证码
|
|
|
|
- $userId = $this->auth->id;
|
|
|
|
- //姓名和身份证号 取实名认证
|
|
|
|
- $userAuthWhere['user_id'] = $userId;
|
|
|
|
- $userAuth = model('UserAuth')->where($userAuthWhere)->find();
|
|
|
|
- if (empty($userAuth)) {
|
|
|
|
- $this->error('请先实名认证');
|
|
|
|
- }
|
|
|
|
- if ($userAuth['status'] != 1) {
|
|
|
|
- $this->error('请先实名认证通过');
|
|
|
|
- }
|
|
|
|
- $realname = $userAuth['realname'];
|
|
|
|
- $cardNo = $userAuth['idcard'];
|
|
|
|
- if(!$realname || !$payNo || !$cardNo) {
|
|
|
|
- $this->error("请将信息填写完整");
|
|
|
|
- }
|
|
|
|
- // 获取用户信息
|
|
|
|
- //$userInfo = \app\common\model\User::where(["id"=>$this->auth->id])->find();
|
|
|
|
- /*if (!Sms::check($mobile, $captcha, 'binkAli')) {
|
|
|
|
- $this->error(__('验证码不正确!'));
|
|
|
|
- }*/
|
|
|
|
- $userAlipayModel = new UserAlipay();
|
|
|
|
- // 查询是否有过绑定
|
|
|
|
- $bankInfo = $userAlipayModel->where(["user_id"=>$userId])->find();
|
|
|
|
- $data = [];
|
|
|
|
- $data["realname"] = $realname;
|
|
|
|
- $data["pay_no"] = $payNo;
|
|
|
|
- $data["card_no"] = $cardNo;
|
|
|
|
- if($bankInfo) {
|
|
|
|
- $data["updatetime"] = time();
|
|
|
|
- $res = $userAlipayModel->update($data,["user_id"=>$userId]);
|
|
|
|
- } else {
|
|
|
|
- $data["user_id"] = $userId;
|
|
|
|
- $data["createtime"] = time();
|
|
|
|
- $res = $userAlipayModel->insert($data);
|
|
|
|
- }
|
|
|
|
- if($res) {
|
|
|
|
- //Sms::flush($mobile, 'binkBank');
|
|
|
|
- $this->success("支付宝绑定成功!");
|
|
|
|
- } else {
|
|
|
|
- $this->error("网络异常,请稍后重试!");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 获取绑定银行卡信息
|
|
|
|
- */
|
|
|
|
- public function getAlipayInfo() {
|
|
|
|
- // 查询是否有过绑定
|
|
|
|
- $alipayInfo = UserAlipay::where(["user_id"=>$this->auth->id])->find();
|
|
|
|
- //if(!$alipayInfo) $this->error("支付宝信息获取失败!");
|
|
|
|
- $this->success("获取成功!",$alipayInfo);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* 获取用户账户信息
|
|
* 获取用户账户信息
|
|
*/
|
|
*/
|