public function registerAction() { $this->view->setVar('pageTitle', '注册'); if ($this->request->isPost() == true) { if (!$this->validFlag) { echo json_encode(array('ret' => 0, 'msg' => $this->warnMsg)); exit; } else { $user = new Users(); if ($mobiRes = $user->existTel($this->_sanReq['mobile'])) { if ($mobiRes == 1) { echo json_encode(array('ret' => 0, 'msg' => array('mobile' => array('msg' => $this->di['sysconfig']['flagMsg']['10002'])))); $this->view->disable(); return; } } $res = $user->isEmailExist($this->_sanReq['email']); if ($res['u_email']) { echo json_encode(array('ret' => 0, 'msg' => array('email' => array('msg' => $this->di['sysconfig']['flagMsg']['10015'])))); $this->view->disable(); return; } $objCaptcha = new Captcha(); $key = 'reg:' . $this->_sanReq['mobile']; $data = $objCaptcha->checkAllCaptcha($this->_sanReq['mobile'], $this->_sanReq['codeImg'], $key, $this->_sanReq['regtype'], $this->_sanReq['captcha']); if ($data == 1) { $res = $user->register($this->_sanReq['passwd'], $this->_sanReq['mobile'], $this->_sanReq['email']); if ($res == 1) { $objCaptcha->delCaptchaRedisKey($key); echo json_encode(array('ret' => 1)); } elseif ($res == 10002) { echo json_encode(array('ret' => 0, 'msg' => array('mobile' => array('msg' => $this->di['sysconfig']['flagMsg']['10002'])))); } else { echo json_encode(array('ret' => 0, 'msg' => array('service' => array('msg' => $this->di['sysconfig']['flagMsg']['10000'])))); } $this->view->disable(); return; } else { echo json_encode(array('ret' => 0, 'msg' => $data)); $this->view->disable(); return; } } } }
/** * [resetEmailAction 重置邮箱] * @return [type] [1 修改成功,10015 该邮件已存在,10031 非法操作] */ public function resetEmailAction() { if (empty($this->session->get('emailToken'))) { echo json_encode(array('ret' => 0, 'msg' => array('email' => array('msg' => $this->di['sysconfig']['flagMsg']['10031'])))); } if (!$this->validFlag) { echo json_encode(array('ret' => 0, 'msg' => $this->warnMsg)); } else { $user = new User(); $res = $user->isEmailExist($this->_sanReq['email']); if ($res['u_email']) { echo json_encode(array('ret' => 0, 'msg' => array('email' => array('msg' => $this->di['sysconfig']['flagMsg']['10015'])))); } else { $res = $user->resetEmail($this->session->get('uid'), $this->_sanReq['email']); if ($res) { $Service = new Service($this->di); $Service->sendMails($this->session->get('uid'), $this->_sanReq['email']); $this->session->remove('emailToken'); echo json_encode(array('ret' => 1)); } } } exit; }
public function editEmailAction() { if (!$this->validFlag) { echo json_encode(array('ret' => 0, 'msg' => $this->warnMsg)); } else { $users = new Users(); $res = $users->isEmailExist($this->_sanReq['email']); if ($res['u_email']) { echo json_encode(array('ret' => 0, 'msg' => array('email' => array('msg' => $this->di['sysconfig']['flagMsg']['10015'])))); $this->view->disable(); return; } $users->setEmail($this->session->get('uid'), $this->_sanReq['email']); $Service = new Service(); $Service->sendMails($this->session->get('uid'), $this->_sanReq['email']); echo json_encode(array('ret' => 1)); } $this->view->disable(); return; }