|
@@ -0,0 +1,192 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace app\api\controller\doctor;
|
|
|
+
|
|
|
+use app\common\controller\Apic;
|
|
|
+use think\Db;
|
|
|
+
|
|
|
+/**
|
|
|
+ *
|
|
|
+ */
|
|
|
+class Userbank extends Apic
|
|
|
+{
|
|
|
+ protected $noNeedLogin = [];
|
|
|
+ protected $noNeedRight = ['*'];
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 绑定银行卡
|
|
|
+ */
|
|
|
+ public function bindBank() {
|
|
|
+
|
|
|
+ /*$captcha = input('captcha');
|
|
|
+ if (!$captcha) {
|
|
|
+ $this->error(__('Invalid parameters'));
|
|
|
+ }
|
|
|
+ $result = Sms::check($this->auth->mobile, $captcha, 'changemobile');
|
|
|
+ if (!$result) {
|
|
|
+ $this->error(__('Captcha is incorrect'));
|
|
|
+ }*/
|
|
|
+
|
|
|
+ //
|
|
|
+ $bank_no = input('bank_no');// 银行账号
|
|
|
+ $open_bank = input('open_bank');// 开户行
|
|
|
+ if(!$bank_no || !$open_bank ) {
|
|
|
+ $this->error("请将信息填写完整");
|
|
|
+ }
|
|
|
+
|
|
|
+ $userId = $this->auth->id;
|
|
|
+
|
|
|
+ //检测实名认证
|
|
|
+ if ($this->auth->idcard_status != 1) {
|
|
|
+ $this->error('请先完成实名认证');
|
|
|
+ }
|
|
|
+ $realname = $this->auth->realname;
|
|
|
+
|
|
|
+
|
|
|
+ // 查询是否有过绑定
|
|
|
+ $bankInfo = Db::name('doctor_bank')->where(["doctor_id"=>$userId])->find();
|
|
|
+ $data = [];
|
|
|
+ $data["realname"] = $realname;
|
|
|
+ $data["bank_no"] = $bank_no;
|
|
|
+ $data["open_bank"] = $open_bank;
|
|
|
+
|
|
|
+ if($bankInfo) {
|
|
|
+ $res = Db::name('doctor_bank')->where(["doctor_id"=>$userId])->update($data);
|
|
|
+ } else {
|
|
|
+ $data["doctor_id"] = $userId;
|
|
|
+ $res = Db::name('doctor_bank')->insertGetId($data);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ $this->success("银行卡绑定成功!");
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取绑定银行卡信息
|
|
|
+ */
|
|
|
+ public function getBankInfo() {
|
|
|
+ // 查询是否有过绑定
|
|
|
+ $bankInfo = Db::name('doctor_bank')->where(["doctor_id"=>$this->auth->id])->find();
|
|
|
+
|
|
|
+ $this->success("获取成功!",$bankInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 绑定支付宝
|
|
|
+ */
|
|
|
+ public function bindAlipay() {
|
|
|
+
|
|
|
+ /*$captcha = input('captcha');
|
|
|
+ if (!$captcha) {
|
|
|
+ $this->error(__('Invalid parameters'));
|
|
|
+ }
|
|
|
+ $result = Sms::check($this->auth->mobile, $captcha, 'changemobile');
|
|
|
+ if (!$result) {
|
|
|
+ $this->error(__('Captcha is incorrect'));
|
|
|
+ }*/
|
|
|
+
|
|
|
+ //
|
|
|
+ $payNo = input('pay_no');//支付宝账号
|
|
|
+ if(!$payNo) {
|
|
|
+ $this->error("请将信息填写完整");
|
|
|
+ }
|
|
|
+
|
|
|
+ $userId = $this->auth->id;
|
|
|
+
|
|
|
+ //检测实名认证
|
|
|
+ if ($this->auth->idcard_status != 1) {
|
|
|
+ $this->error('请先完成实名认证');
|
|
|
+ }
|
|
|
+ $realname = $this->auth->realname;
|
|
|
+
|
|
|
+
|
|
|
+ // 查询是否有过绑定
|
|
|
+ $bankInfo = Db::name('doctor_alipay')->where(["doctor_id"=>$userId])->find();
|
|
|
+ $data = [];
|
|
|
+ $data["realname"] = $realname;
|
|
|
+ $data["pay_no"] = $payNo;
|
|
|
+ if($bankInfo) {
|
|
|
+ $res = Db::name('doctor_alipay')->where(["doctor_id"=>$userId])->update($data);
|
|
|
+ } else {
|
|
|
+ $data["doctor_id"] = $userId;
|
|
|
+ $res = Db::name('doctor_alipay')->insertGetId($data);
|
|
|
+ }
|
|
|
+ if($res) {
|
|
|
+ $this->success("支付宝绑定成功!");
|
|
|
+ } else {
|
|
|
+ $this->error("网络异常,请稍后重试!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取绑定银行卡信息
|
|
|
+ */
|
|
|
+ public function getAlipayInfo() {
|
|
|
+ // 查询是否有过绑定
|
|
|
+ $alipayInfo = Db::name('doctor_alipay')->where(["doctor_id"=>$this->auth->id])->find();
|
|
|
+ $this->success("获取成功!",$alipayInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 绑定微信
|
|
|
+ */
|
|
|
+ public function bindWechat() {
|
|
|
+
|
|
|
+ /*$captcha = input('captcha');
|
|
|
+ if (!$captcha) {
|
|
|
+ $this->error(__('Invalid parameters'));
|
|
|
+ }
|
|
|
+ $result = Sms::check($this->auth->mobile, $captcha, 'changemobile');
|
|
|
+ if (!$result) {
|
|
|
+ $this->error(__('Captcha is incorrect'));
|
|
|
+ }*/
|
|
|
+
|
|
|
+ //
|
|
|
+ $payNo = input('pay_no');//支付宝账号
|
|
|
+ if(!$payNo) {
|
|
|
+ $this->error("请将信息填写完整");
|
|
|
+ }
|
|
|
+
|
|
|
+ $userId = $this->auth->id;
|
|
|
+
|
|
|
+ //检测实名认证
|
|
|
+ if ($this->auth->idcard_status != 1) {
|
|
|
+ $this->error('请先完成实名认证');
|
|
|
+ }
|
|
|
+ $realname = $this->auth->realname;
|
|
|
+
|
|
|
+
|
|
|
+ // 查询是否有过绑定
|
|
|
+ $bankInfo = Db::name('doctor_wechat')->where(["doctor_id"=>$userId])->find();
|
|
|
+ $data = [];
|
|
|
+ $data["realname"] = $realname;
|
|
|
+ $data["pay_no"] = $payNo;
|
|
|
+ if($bankInfo) {
|
|
|
+ $res = Db::name('doctor_wechat')->where(["doctor_id"=>$userId])->update($data);
|
|
|
+ } else {
|
|
|
+ $data["doctor_id"] = $userId;
|
|
|
+ $res = Db::name('doctor_wechat')->insertGetId($data);
|
|
|
+ }
|
|
|
+ if($res) {
|
|
|
+ $this->success("绑定成功!");
|
|
|
+ } else {
|
|
|
+ $this->error("网络异常,请稍后重试!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取绑定银行卡信息
|
|
|
+ */
|
|
|
+ public function getWechatInfo() {
|
|
|
+ // 查询是否有过绑定
|
|
|
+ $alipayInfo = Db::name('doctor_wechat')->where(["doctor_id"=>$this->auth->id])->find();
|
|
|
+ $this->success("获取成功!",$alipayInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|