* @version : HUOSDK 8.0 */ namespace h5wap\wap\controller; use h5wap\common\controller\V2BaseController; use huo\controller\member\Bind; use huo\controller\member\MemCache; use huolib\sms\SmsType; use huolib\tool\StrUtils; use think\Session; class BindController extends V2BaseController { public function _initialize() { parent::_initialize(); $this->checkLogin(); } /** * h5wap 绑定手机 * http://doc.1tsdk.com/138?page_id=3137 * * 【域名】/wap/user/bind/mobile * * @return mixed */ public function bindMobile() { $_bind_class = new Bind(); $_mobile = $_bind_class->getHasBindMobile($this->mem_id); $this->assign('CheckOk', $_bind_class->getCheckOk()); if (!empty($_mobile)) { /* 已绑定手机 */ $_mobile = StrUtils::encryptPhone($_mobile); /* 显示已绑定手机页面 */ $this->assign('mobile', $_mobile); if ($_bind_class->getCheckOk()) { /* 去绑定手机页面 */ return $this->fetch('bind/bind'); } else { return $this->fetch('bind/check'); } } else { /* 显示未绑定手机页面 */ return $this->fetch('bind/bind'); } } /** * H5WAP-发送短信 * http://doc.1tsdk.com/138?page_id=3230 * 【域名】/wap/sms/send */ public function smsSend() { $_sms_data = get_val($this->rq_data, 'sms', []); $_mobile = get_val($_sms_data, 'mobile', ''); $_type = get_val($_sms_data, 'type', SmsType::SMS_ID_VERIFY); $_bind_class = new Bind(); $_rdata = $_bind_class->smsSend($_mobile, $_type); return $this->returnData($_rdata); } /** * 校验原有手机 * http://doc.1tsdk.com/138?page_id=3231 * 【域名】/wap/sms/checkold * */ public function verifyOldMobile() { $_sms_data = get_val($this->rq_data, 'sms', []); $_mobile = get_val($_sms_data, 'mobile', ''); $_type = get_val($_sms_data, 'type', SmsType::SMS_ID_VERIFY); $_code = get_val($_sms_data, 'code', ''); $_bind_class = new Bind(); $_rdata = $_bind_class->checkOldMobile($_mobile, $_code, $_type); return $this->returnData($_rdata); } /** * 绑定手机 * http://doc.1tsdk.com/138?page_id=3232 * 【域名】/wap/mobile/bind */ public function bindPost() { $_sms_data = get_val($this->rq_data, 'sms', []); $_mobile = get_val($_sms_data, 'mobile', ''); $_type = get_val($_sms_data, 'type', SmsType::SMS_ID_VERIFY); $_code = get_val($_sms_data, 'code', ''); $_mem_rq = $this->setMemData(); $_bind_class = new Bind(); $_rdata = $_bind_class->bindPost($this->mem_id, $_mobile, $_code, $_type, $_mem_rq->getPassword()); return $this->returnData($_rdata); } }