public function getChatUserList(OW_Event $event) { $params = $event->getParams(); $userId = $params['userId']; $list = $this->service->getChatUserList($userId); $event->setData($list); return $list; }
public function updateWithData($params) { if (!isset($params['lastRequestTimestamp'])) { return; } if ((int) $params['lastRequestTimestamp'] == 0) { $params['lastRequestTimestamp'] = time(); } /***************************************************************************************************************/ if (!empty($params['readMessageList'])) { $readMessageIdList = array(); foreach ($params['readMessageList'] as $message) { $readMessageIdList[] = $message["id"]; } $this->conversationService->markMessageIdListRead($readMessageIdList); } /***************************************************************************************************************/ $ignoreMessageList = array(); if (!empty($params['ignoreMessageList'])) { foreach ($params['ignoreMessageList'] as $message) { $ignoreMessageList[] = $message["id"]; } } $m = $this->conversationService->findUnreadMessagesForApi($this->userId, $ignoreMessageList, $params['lastRequestTimestamp']); $this->setObject('messageList', $m); /***************************************************************************************************************/ if (!isset($params['conversationListLength'])) { $params['conversationListLength'] = 0; } // $count = $this->conversationService->countConversationListByUserId($this->userId); // // if ((int)$params['conversationListLength'] != $count) // { // $list = $this->conversationService->getConversationListByUserId($this->userId); // $this->setObject('conversationList', $list); // } if (count($m) > 0) { $list = $this->conversationService->getChatUserList($this->userId, 0, 10); //TODO specify limits $this->setObject('conversationList', $list); } $this->setObject('lastRequestTimestamp', time()); }
public function getChatUserList(OW_Event $event) { $params = $event->getParams(); $userId = $params['userId']; $from = 0; $count = 10; if (isset($params['from'])) { $from = (int) $params['from']; } if (isset($params['count'])) { $count = (int) $params['count']; } $list = $this->service->getChatUserList($userId, $from, $count); $event->setData($list); return $list; }