/** * 根据手机号,获取面试人员的详细信息 * * @access public * @param string $phoneNum * @return array */ public function seach($phoneNum) { $userId = $this->getUserIdByPhoneNum($phoneNum); if ($userId) { #获取相关人员的手机号, 姓名, 性别, 应聘职位信息 $userInfo = $this->userModel->get($userId); $returnData = array('phoneNum' => $phoneNum, 'sex' => $userInfo[0]['userProfile']['sex']['value'], 'occupation' => $userInfo[0]['userProfile']['occupation']['value'], 'nickname' => $userInfo[0]['nickname']); } else { $returnData = array(); } return $returnData; }
/** * 获取联系人的信息 * * @access public * @param int $userId * @return array */ public function getContactProfile($userId) { $userProfile = $this->userModel->get($userId); $userTagList = $this->userModel->getUserTagList($userId); foreach ($userTagList as &$value) { $value = '<span>#' . $value['tagName'] . '</span>'; } $acctionList = $this->userModel->getAcctionList($userId); foreach ($acctionList as &$acctionIndex) { $acctionIndex = '<a href="">' . $acctionIndex . '</a>'; } return array('id' => $userId, 'username' => $userProfile[0]['nickname'], 'phoneNum' => $userProfile[0]['phone_num'], 'userProfile' => $userProfile[0]['userProfile'], 'tagList' => implode(' ', $userTagList), 'acctionList' => implode(',', $acctionList)); }
/** * 统计现在所有的人曾经创建的标签 * * @return array */ public function sta() { $eventList = F::db()->fetch_all('select content, create_user_id from event where status = 1 order by event.id desc'); #整理标签信息 $returnData = array(); foreach ($eventList as $value) { $tagArray = $this->getTagFromEvent($value['content']); foreach ($tagArray as $index) { preg_match('/R\\w{1,}/', $index, $match); if (isset($match[0]) && $match[0]) { continue; } if (!in_array($index, $returnData[$value['create_user_id']])) { $returnData[$value['create_user_id']][] = $index; } } } #补充用户信息 foreach ($returnData as $key => $value) { $userInfo = $this->userModel->get($key); $returnData[$userInfo[0]['nickname']] = implode(',', $value); unset($returnData[$key]); } return $returnData; }
public function addRelation($createUserId, $addUserId, $remark) { #补充对应事件 $this->userModel = F::load_model('user', array()); $addUserInfo = $this->userModel->get($addUserId); $eventId = $this->createEvent($createUserId, '添加#' . $remark . ' ' . $addUserInfo[0]['nickname']); F::db()->execute('replace into group_list set group_id = ?, user_id = ?, add_user_id = ?, remark = ?, add_time = ?, event_id = ?', array($this->id, $addUserId, $createUserId, $remark, date(TIMESTYLE), $eventId)); }
/** * 获取创建事件统计信息 * * @return array */ public function event() { $statisticsResult = F::db()->fetch_all('select count(id) as num, create_user_id as userId from event where status = 1 and type != 1 group by create_user_id '); foreach ($statisticsResult as &$value) { #删除脚本倒入数据 if ($value['userId'] == 1) { $value['num'] = $value['num'] - 5260 > 0 ? $value['num'] - 5260 : $value['num']; } $userInfo = $this->userModel->get($value['userId']); $value['userInfo'] = $userInfo; $projectInfo = $this->userModel->getUserTagList($value['userId']); $value['projectInfo'] = array(); foreach ($projectInfo as $projectInfoIndex) { if ($projectInfoIndex['type'] == 2 || $projectInfoIndex['type'] == 3) { $value['projectInfo'][] = array('tagId' => $projectInfoIndex['tagId'], 'name' => $projectInfoIndex['tagName']); } } unset($projectInfo); $value['weekNum'] = $this->getEventNumByWeek($value['userId']); $value['createContentNumByWeek'] = $this->getCreateContentNumByWeek($value['userId']); $value['createGroupNumByWeek'] = $this->getCreateGroupByWeek($value['userId']); } return $this->multi_array_sort($statisticsResult, 'weekNum', SORT_DESC); }
/** * 更新账户信息 * * @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(); }