예제 #1
0
 /**
  * Helpdesk join to the system
  * @param string $deskId
  * @param MongoId $accountId
  * @return array
  */
 public static function join($deskId, $accountId)
 {
     $cache = Yii::$app->cache;
     //add the help desk to the cache
     $conversations = $cache->get('conversations' . $accountId);
     //in case the helpDesk is already online
     if (empty($conversations[$deskId])) {
         $conversations[$deskId] = [];
         $cache->set('conversations' . $accountId, $conversations);
         // self::setLastPingTimeById($deskId, $accountId);
         //get the client from pending queue
         $maxClientLimit = HelpDeskSetting::getMaxClientCount($accountId);
         HelpDesk::connectPendingClient($deskId, $accountId, $maxClientLimit);
         LogUtil::info(['event' => 'deskJoined', 'deskId' => $deskId], 'helpdesk');
     }
     return ['status' => 'ok', 'channel' => ChatConversation::CHANNEL_GLOBAL . $accountId];
 }