コード例 #1
0
 public function __construct()
 {
     parent::__construct();
     $this->contactModel = F::load_model('contact');
     $this->userModel = F::load_model('user');
     $this->tagModel = F::load_model('tag');
 }
コード例 #2
0
 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);
     }
 }
コード例 #3
0
 /**
  * 定时脚本,用于完成统计任务
  * 脚本每次执行只统计一组数据
  * @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();
 }
コード例 #4
0
 public function __construct()
 {
     parent::__construct();
     $this->auditionModel = F::load_model('audition');
 }
コード例 #5
0
 /**
  * 构造函数
  * 
  * @access protected
  * @return void
  */
 protected function __construct()
 {
     $this->model = F::load_model('base');
     #设定时区信息
     date_default_timezone_set('Asia/Shanghai');
 }
コード例 #6
0
 /**
  * 给联系人生成一则事件
  *
  * @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();
 }
コード例 #7
0
ファイル: audition_model.php プロジェクト: NASH-WORK/NASH-CRM
 public function __construct()
 {
     $this->userModel = F::load_model('user');
 }
コード例 #8
0
ファイル: group_model.php プロジェクト: NASH-WORK/NASH-CRM
 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;
 }
コード例 #9
0
ファイル: user_model.php プロジェクト: NASH-WORK/NASH-CRM
 /**
  * 获取自己创建的事件列表
  *
  * @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;
 }
コード例 #10
0
 public function __construct()
 {
     $this->tagModel = F::load_model('tag');
     $this->auditionModel = F::load_model('audition');
 }
コード例 #11
0
ファイル: contact_model.php プロジェクト: NASH-WORK/NASH-CRM
 function __construct()
 {
     $this->userModel = F::load_model('user');
     $this->tagModel = F::load_model('tag');
 }
コード例 #12
0
ファイル: tag_controller.php プロジェクト: NASH-WORK/NASH-CRM
 /**
  * 构造函数
  *
  * @access public
  * @return void
  */
 public function __construct()
 {
     parent::__construct();
     $this->tagModel = F::load_model('tag');
 }
コード例 #13
0
 public function __construct()
 {
     parent::__construct();
     $this->reportModel = F::load_model('reportForm');
 }
コード例 #14
0
 public function __construct()
 {
     parent::__construct();
     $this->groupModel = F::load_model('group', array());
     $this->userModel = F::load_model('user', array());
 }
コード例 #15
0
 public function __construct()
 {
     parent::__construct();
     $this->eventModel = F::load_model('event', array());
 }
コード例 #16
0
 public function __construct()
 {
     parent::__construct();
     $commentParam['eventId'] = F::request('eventId', 0);
     $this->commentModel = F::load_model('comment', $commentParam);
 }
コード例 #17
0
ファイル: base_model.php プロジェクト: NASH-WORK/NASH-CRM
 /**
  * 构造函数
  * 
  * @access public
  * @return void
  */
 public function __construct()
 {
     $this->tokenModel = F::load_model('token');
 }
コード例 #18
0
 public function __construct()
 {
     parent::__construct();
     $this->statisticsModel = F::load_model('statistics');
 }
コード例 #19
0
 public function __construct()
 {
     $this->userModel = F::load_model('user');
     //$this->tagModel = F::load_model('tag', array());
 }