/** * 搜索面试人员信息 * * @access public * @param string phoneNum * @return array * @example * */ public function seach() { $this->params = $this->require_params(array('phoneNum')); if (!FValidator::phone($this->params['phoneNum'])) { throw new Exception('无效的手机号码', 100); } $this->returnData = $this->auditionModel->seach($this->params['phoneNum']); if (empty($this->returnData)) { throw new Exception('相关信息未找到', 204); } F::rest()->show_result($this->returnData); }
/** * 更新账户信息 * * @param string phoneNum 登陆手机号 * @param string password 登陆密码md5 * @param string photo 头像地址 * @throws Exception 103 if 手机号格式不正确 * @throws Exception 112 if 尝试更新一个非公司人员的账户信息 * @todo 考虑一种特殊情况:输入的手机号是一个在数据库中已经存在的联系人的手机号码 */ public function updateProfile() { #参数检查 $this->checkAccessToken(); $this->params = $this->require_params(array('phoneNum', 'password')); $this->params['photo'] = F::request('photo', ''); if (!FValidator::phone($this->params['phoneNum'])) { throw new Exception('手机号格式不正确', 103); } #账户信息检查 $this->returnData = $this->userModel->getAccountType($GLOBALS['userId']); if ($this->returnData != self::ADMIN_ACCOUNT && $this->returnData != 3) { throw new Exception('该接口只可以更新内容人员账户信息', 112); } #更新账户信息 $this->userModel->updatePassword($GLOBALS['userId'], $this->params['password'], TRUE); if ($this->params['photo']) { $this->returnData = $this->userModel->get($GLOBALS['userId']); $this->params['username'] = $this->returnData[0]['nickname']; $this->userModel->updateUserProfile($GLOBALS['userId'], $this->params['username'], $this->params['photo']); } F::rest()->show_result(); }
/** * 根据完整的手机号,检测其对于联系人是否已经被创建 * * @access public * @param string phoneNum 待检测电话号码 * @return string */ public function checkContactExistByPhoneNum() { $this->checkAccessToken(); $this->params['phoneNum'] = $this->params['phoneNum']; $this->userLog($GLOBALS['userId'], __CLASS__ . '/' . __FUNCTION__, serialize($this->params)); if (FValidator::telNum($this->params['phoneNum']) || FValidator::phone($this->params['phoneNum'])) { $contactId = $this->contactModel->getContactIdByPhoneNum($this->params['phoneNum']); F::rest()->show_result($contactId); } else { throw new Exception('待检测电话不是一个有效的电话号码', 103); } }