Beispiel #1
0
 public function require_params($require_params, $params = array())
 {
     $check_params = FValidator::require_params($require_params, $params);
     if ($check_params) {
         F::rest()->show_error(100, array('requires' => $check_params));
     }
     return $params;
 }
 /**
  * 搜索面试人员信息
  * 
  * @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);
 }
Beispiel #3
0
 /**
  * 通知后,发送相关邮件
  * 发送成功返回true,失败返回false
  *
  * @access private
  * @param int $recivedUserId recive email user id
  * @param int $fromUserId send email user id
  * @param string $eventContent event content string
  * @return boolean
  * @todo 使用队列服务
  */
 private function _sendEmail($recivedUserId, $fromUserId, $eventContent)
 {
     #获取接受者邮箱信息
     $reciveEmail = $this->getEmailAddressByUserId($recivedUserId);
     $reciveUserInfo = $this->get($recivedUserId);
     if (!$reciveEmail || !FValidator::email($reciveEmail)) {
         return FALSE;
     }
     //         #测试环境下代码,上线前需要移除
     //         if ($reciveEmail != '*****@*****.**') $reciveEmail = '*****@*****.**';
     #发送邮件
     $this->emailObject = F::loadClass('email', $this->emailConfig);
     $sendResult = $this->emailObject->send($reciveEmail, $this->_getEmailSubject(), $this->_getEmailContent($fromUserId, $eventContent, $reciveUserInfo[0]['nickname']));
     return $sendResult['isSuccess'] ? TRUE : FALSE;
 }
Beispiel #4
0
 /**
  * 更新账户信息
  *
  * @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);
     }
 }