|
@@ -7,6 +7,7 @@ use app\api\controller\Common;
|
|
|
use think\Db;
|
|
|
use think\Exception;
|
|
|
use think\Validate;
|
|
|
+use app\common\model\UserAlipay;
|
|
|
|
|
|
/**
|
|
|
*
|
|
@@ -175,46 +176,48 @@ class Withdraw extends Common
|
|
|
public function bindBank() {
|
|
|
$realname = $this->request->request('realname');// 真实姓名
|
|
|
$bank_no = $this->request->request('bank_no');// 银行账号
|
|
|
- $bank_name = $this->request->request('bank_name');// 银行名称
|
|
|
- $open_address = $this->request->request('open_address');// 开户地
|
|
|
+ /*$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');// 银行预留手机号
|
|
|
+ /*$bank_mobile = $this->request->request('bank_mobile');// 银行预留手机号
|
|
|
$captcha = $this->request->request('captcha'); // 验证码
|
|
|
- $mobile = $this->request->request('mobile'); // 手机号
|
|
|
- if(!$realname || !$bank_no || !$bank_name || !$open_address || !$open_bank || !$bank_mobile || !$captcha || !$mobile) {
|
|
|
+ $mobile = $this->request->request('mobile'); // 手机号*/
|
|
|
+ $userId = $this->auth->id;
|
|
|
+ //|| !$bank_name || !$open_address || !$bank_mobile || !$captcha || !$mobile
|
|
|
+ if(!$realname || !$bank_no || !$open_bank ) {
|
|
|
$this->error("请将信息填写完整");
|
|
|
}
|
|
|
|
|
|
// 获取用户信息
|
|
|
- $userInfo = \app\common\model\User::where(["id"=>$this->auth->id])->find();
|
|
|
+ //$userInfo = \app\common\model\User::where(["id"=>$this->auth->id])->find();
|
|
|
|
|
|
- if($userInfo->mobile !== $mobile) $this->error("请输入账号绑定的手机号码!");
|
|
|
+ /*if($userInfo->mobile !== $mobile) $this->error("请输入账号绑定的手机号码!");
|
|
|
|
|
|
if (!Sms::check($mobile, $captcha, 'binkBank')) {
|
|
|
$this->error(__('验证码不正确!'));
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
// 查询是否有过绑定
|
|
|
- $bankInfo = \app\common\model\UserBank::where(["user_id"=>$userInfo["id"]])->find();
|
|
|
+ $bankInfo = \app\common\model\UserBank::where(["user_id"=>$userId])->find();
|
|
|
$data = [];
|
|
|
$data["realname"] = $realname;
|
|
|
$data["bank_no"] = $bank_no;
|
|
|
- $data["bank_name"] = $bank_name;
|
|
|
- $data["open_address"] = $open_address;
|
|
|
$data["open_bank"] = $open_bank;
|
|
|
- $data["mobile"] = $bank_mobile;
|
|
|
+ /*$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"=>$userInfo["id"]]);
|
|
|
+ $res = \app\common\model\UserBank::update($data,["user_id"=>$userId]);
|
|
|
} else {
|
|
|
- $data["user_id"] = $userInfo["id"];
|
|
|
+ $data["user_id"] = $userId;
|
|
|
$data["createtime"] = time();
|
|
|
$res = \app\common\model\UserBank::insert($data);
|
|
|
}
|
|
|
|
|
|
if($res) {
|
|
|
- Sms::flush($mobile, 'binkBank');
|
|
|
- $this->success("银行卡信息更新/绑定成功!");
|
|
|
+ //Sms::flush($mobile, 'binkBank');
|
|
|
+ $this->success("银行卡绑定成功!");
|
|
|
} else {
|
|
|
$this->error("网络异常,请稍后重试!");
|
|
|
}
|
|
@@ -232,6 +235,57 @@ class Withdraw extends Common
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 绑定支付宝
|
|
|
+ */
|
|
|
+ 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;
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 获取用户账户信息
|
|
|
*/
|
|
|
public function getUserAccountInfo() {
|