public function __construct() { parent::__construct(); $this->contactModel = F::load_model('contact'); $this->userModel = F::load_model('user'); $this->tagModel = F::load_model('tag'); }
public function __construct() { parent::__construct(); $this->syncModel = F::load_model('sync', array()); #请求权限检查 $this->params = $this->require_params(array('token')); if ($this->params['token'] != self::TOKEN) { throw new Exception('无效的授权信息', 100); } }
/** * 定时脚本,用于完成统计任务 * 脚本每次执行只统计一组数据 * @return void * @throws 100 If 无效的授权信息 */ public function countTask() { #参数检查 $this->params = $this->require_params(array('token')); if ($this->params['token'] != self::COUNT_TASK_TOKEN) { throw new Exception('无效的授权信息', 100); } #获取待统计数据 $this->statisticsModel = F::load_model('statistics', array()); $countDataAll = $this->statisticsModel->getCountTaskData(); if (empty($countDataAll)) { F::rest()->show_result(); } foreach ($countDataAll as $countData) { #执行统计 $this->returnData = $this->statisticsModel->count($countData); #通知脚本执行完毕 $this->userModel = F::load_model('user', array()); $this->userModel->sendCountTaskEmail($countData['email']); } F::rest()->show_result(); }
public function __construct() { parent::__construct(); $this->auditionModel = F::load_model('audition'); }
/** * 构造函数 * * @access protected * @return void */ protected function __construct() { $this->model = F::load_model('base'); #设定时区信息 date_default_timezone_set('Asia/Shanghai'); }
/** * 给联系人生成一则事件 * * @access public * @param string evnet * @param int id * @return void */ public function createEventForContact() { $this->checkAccessToken(); $this->params = $this->require_params(array('id', 'event')); $this->params['photo'] = F::request('photo', ''); $this->params['systemEvent'] = F::request('systemEvent', 0); if ($this->params['photo']) { $this->params['event'] .= ' #图片 '; } $userId = $this->params['id']; $this->params['event'] = str_replace('#', '#', $this->params['event']); $this->params['event'] = str_replace('#r', '#R', $this->params['event']); $this->params['event'] = str_replace('@', '@', $this->params['event']); #书写对应事件 preg_match_all('/#([^#^\\s^:]{1,})([\\s\\:\\,\\;]{0,1})/', $this->params['event'], $result); #针对来访,需要追加相应房间的事件 $hadVisterTag = FALSE; $projectTag = ''; $roomTagArray = array(); foreach ($result[1] as $value) { $this->userModel->bindTag($userId, $value); if ($value == '来访') { $hadVisterTag = TRUE; } if (preg_match('/^R\\d{1,}/', $value)) { $roomTagArray[] = $value; } if ($this->isProjectTag($value)) { $projectTag = $value; } } if ($hadVisterTag && $projectTag) { #存在来访标签 $this->groupModel = F::load_model('group', array()); #获取当前操作联系人姓名 $contactInfo = $this->userModel->get($this->params['id']); $contactName = $contactInfo[0]['nickname']; foreach ($roomTagArray as $roomTagArrayIndex) { $groupName = $projectTag . ' ' . str_replace('R', '', $roomTagArrayIndex); $groupId = $this->groupModel->getGroupIdByName($groupName); if ($groupId) { #创建来访事件 $event = '#来访 ' . $contactName . '来访看房'; $this->groupModel->setGroupId($groupId)->createEvent($GLOBALS['userId'], $event); } else { #todo 房间不存在 } } } $eventContent = $this->params['event']; $eventType = $this->params['systemEvent'] ? self::SYSTEM_EVENT : self::USER_EVENT; $this->userModel->createEvent($GLOBALS['userId'], $userId, $eventContent, $this->params['photo'], $eventType); $this->userLog($GLOBALS['userId'], __CLASS__ . '/' . __FUNCTION__, serialize($this->params)); F::rest()->show_result(); }
public function __construct() { $this->userModel = F::load_model('user'); }
private function getUserProjectId($userId) { $this->userModel = F::load_model('user', array()); $allUserTag = $this->userModel->getUserTagList($userId); $retuanData = array(); foreach ($allUserTag as $value) { if ($value['type'] == 2) { $retuanData[] = $value['tagId']; } } unset($allUserTag); return $retuanData; }
/** * 获取自己创建的事件列表 * * @access public * @param int $userId 用户id * @param number $page 页数 * @param number $num 每页信息数目 * @return array */ public function getLikeEventUserList($userId, $page, $num) { $likeEventList = F::db()->query('select distinct event_id from user_event where type = 1')->fetch_column_all('event_id'); if (empty($likeEventList)) { return array(); } $eventListTmp = F::db()->fetch_all('select event.id as eventId, user_id as userId, event.content as eventContent, create_time as createTime, create_user_id as createUserId, to_user_id as noticeUserId, photo, type from event left join notice on event.id = param where create_user_id = ? and event.status = 1 and event.id in (' . implode(',', $likeEventList) . ') order by event.id desc limit ?,?', array($userId, ($page - 1) * $num, $num)); $eventList = array(); foreach ($eventListTmp as $value) { if ($value['type'] == 3) { $groupModel = F::load_model('group', array('groupId' => $value['userId'])); $groupInfo = $groupModel->setGroupId($value['userId'])->get(); $ownInfo[0]['nickname'] = $groupInfo['name']; foreach ($groupInfo['tagList'] as $tagListIndex) { $ownTagInfo[] = array('tagId' => $tagListIndex['id'], 'tagName' => $tagListIndex['name'], 'coler' => $tagListIndex['tagClass']); } $relation = $groupInfo['relation']; } else { $ownInfo = $this->_get($value['userId']); $ownTagInfo = $this->_getUserTagList($value['userId']); $relation = array(); } $createUserInfo = $this->_get($value['createUserId']); $noticeUserInfo = $this->_get($value['noticeUserId']); $praiseList = $this->_getPraiseList($value['eventId']); $praiseListArray = array(); foreach ($praiseList as $praiseListIndex) { $praiseUserInfo = $this->_get($praiseListIndex['userId']); $praiseListArray[] = $praiseUserInfo[0]['nickname']; } $eventList[] = array('createUserId' => $value['userId'], 'eventCreateUserNickname' => $ownInfo[0]['nickname'], 'photo' => $value['photo'], 'createUserPhoto' => $createUserInfo[0]['photo'], 'createUser' => $createUserInfo[0]['nickname'], 'eventContent' => $value['eventContent'], 'noticeUser' => $noticeUserInfo[0]['nickname'] ? '@' . $noticeUserInfo[0]['nickname'] : '', 'eventOwnInfo' => $ownTagInfo, 'createTime' => $this->_translateTime(strtotime($value['createTime'])), 'praiseList' => $praiseListArray, 'eventType' => $value['type'] == 3 ? 'group' : 'contact', 'relation' => $relation, 'enable_open' => $this->isEnableOpen($userId, $value['userId'], $value['type'])); } #设置所有事件已读 F::db()->execute('update event set unread_num = 0 where create_user_id = ? and status = 1', array($userId)); return $eventList; }
public function __construct() { $this->tagModel = F::load_model('tag'); $this->auditionModel = F::load_model('audition'); }
function __construct() { $this->userModel = F::load_model('user'); $this->tagModel = F::load_model('tag'); }
/** * 构造函数 * * @access public * @return void */ public function __construct() { parent::__construct(); $this->tagModel = F::load_model('tag'); }
public function __construct() { parent::__construct(); $this->reportModel = F::load_model('reportForm'); }
public function __construct() { parent::__construct(); $this->groupModel = F::load_model('group', array()); $this->userModel = F::load_model('user', array()); }
public function __construct() { parent::__construct(); $this->eventModel = F::load_model('event', array()); }
public function __construct() { parent::__construct(); $commentParam['eventId'] = F::request('eventId', 0); $this->commentModel = F::load_model('comment', $commentParam); }
/** * 构造函数 * * @access public * @return void */ public function __construct() { $this->tokenModel = F::load_model('token'); }
public function __construct() { parent::__construct(); $this->statisticsModel = F::load_model('statistics'); }
public function __construct() { $this->userModel = F::load_model('user'); //$this->tagModel = F::load_model('tag', array()); }