/** * [sendMailAction 发送邮件] * @return [type] [description] */ public function sendMailAction() { if (!$this->validFlag) { echo json_encode(array('ret' => 0, 'msg' => $this->warnMsg)); } else { if (isset($this->_sanReq['mobile'])) { $email = $this->_sanReq['email']; } else { $user = new User(); $userinfo = $user->getUserInfo($this->session->get('uid')); $email = $userinfo['u_email']; } $Service = new Service($this->di); $Service->sendMails($this->session->get('uid'), $email); echo json_encode(array('ret' => 1)); } exit; }
/** * [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; }