uawdijnntqw1x1x1
IP : 3.16.15.52
Hostname : axolotl
Kernel : Linux axolotl 4.9.0-13-amd64 #1 SMP Debian 4.9.228-1 (2020-07-05) x86_64
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
OS : Linux
PATH:
/
var
/
www
/
axolotl
/
data
/
www
/
kirov.axolotls.ru
/
bitrix
/
modules
/
imopenlines
/
lib
/
queue
/
all.php
/
/
<?php namespace Bitrix\ImOpenLines\Queue; use \Bitrix\Main\Type\DateTime; use \Bitrix\Im; use \Bitrix\ImOpenLines, \Bitrix\ImOpenLines\Chat, \Bitrix\ImOpenLines\Config, \Bitrix\ImOpenLines\Session, \Bitrix\ImOpenLines\Model\SessionTable, \Bitrix\ImOpenLines\Model\SessionCheckTable; /** * Class All * @package Bitrix\ImOpenLines\Queue */ class All extends Queue { /** * Check the ability to send a dialog to the operator. * * @param $userId * @param int $currentOperator * @return bool * @throws \Bitrix\Main\LoaderException * @throws \Bitrix\Main\ObjectPropertyException * @throws \Bitrix\Main\SystemException */ public function isOperatorAvailable($userId, $currentOperator = 0) { $result = false; if($this->isOperatorActive($userId)) { if($userId != $currentOperator) { $freeCountChatOperator = ImOpenLines\Queue::getCountFreeSlotOperator($userId, $this->config['ID']); if($freeCountChatOperator > 0) { $result = true; } } else { $result = true; } } return $result; } /** * Returns the default queue time * * @return int */ public function getQueueTime() { $queueTime = ImOpenLines\Queue::UNDISTRIBUTED_QUEUE_TIME; return $queueTime; } /** * @param int $currentOperator * * @return array * @throws \Bitrix\Main\ArgumentException * @throws \Bitrix\Main\LoaderException * @throws \Bitrix\Main\ObjectPropertyException * @throws \Bitrix\Main\SystemException */ public function getOperatorsQueue($currentOperator = 0) { $queueTime = $this->getQueueTime(); $result = [ 'RESULT' => false, 'OPERATOR_ID' => 0, 'OPERATOR_LIST' => [], 'DATE_QUEUE' => (new DateTime())->add($queueTime . ' SECONDS'), 'QUEUE_HISTORY' => [], ]; $operatorList = []; $queueHistory = []; $res = ImOpenLines\Queue::getList([ 'select' => [ 'ID', 'USER_ID' ], 'filter' => [ '=CONFIG_ID' => $this->config['ID'] ] ]); while($queueUser = $res->fetch()) { if($this->isOperatorAvailable($queueUser['USER_ID'], $currentOperator)) { $operatorList[] = $queueUser['USER_ID']; $queueHistory[$queueUser['USER_ID']] = true; } } if(!empty($operatorList)) { $result = [ 'RESULT' => true, 'OPERATOR_ID' => 0, 'OPERATOR_LIST' => $operatorList, 'DATE_QUEUE' => (new DateTime())->add($queueTime . ' SECONDS'), 'QUEUE_HISTORY' => $queueHistory, ]; } return $result; } /** * Transfer the dialog to the next operator. * * @param bool $manual * @return bool * @throws \Bitrix\Main\ArgumentException * @throws \Bitrix\Main\LoaderException * @throws \Bitrix\Main\ObjectException * @throws \Bitrix\Main\ObjectPropertyException * @throws \Bitrix\Main\SystemException */ public function transferToNext($manual = true) { $result = false; ImOpenLines\Debug::addQueue($this->config['ID'], $this->session['ID'], 'start' . __METHOD__, ['manual' => $manual]); if($this->startLock()) { if($manual) { self::sendMessageSkipAlone($this->session['CHAT_ID']); } else { $updateSessionCheck = [ 'REASON_RETURN' => ImOpenLines\Queue::REASON_DEFAULT ]; $resultOperatorQueue = $this->getOperatorsQueue(); if($resultOperatorQueue['RESULT'] == true) { $this->chat->setOperators($resultOperatorQueue['OPERATOR_LIST']); $this->chat->update(['AUTHOR_ID' => 0]); $updateSessionCheck['UNDISTRIBUTED'] = 'N'; $result = true; } else { $this->chat->setOperators(); $this->chat->update(['AUTHOR_ID' => 0]); $updateSessionCheck['UNDISTRIBUTED'] = 'Y'; } $updateSessionCheck['DATE_QUEUE'] = $resultOperatorQueue['DATE_QUEUE']; $reasonReturn = SessionCheckTable::getById($this->session['ID'])->fetch()['REASON_RETURN']; SessionCheckTable::update($this->session['ID'], $updateSessionCheck); $updateSession = [ 'OPERATOR_ID' => $resultOperatorQueue['OPERATOR_ID'], 'QUEUE_HISTORY' => $resultOperatorQueue['QUEUE_HISTORY'], //TODO: Fix. You need to rework the status bar. Not optimal. Called in several other places. 'OPERATOR_FROM_CRM' => 'N', //TODO: Fix. Hard-wired status. Potentially bad decision. 'STATUS' => Session::STATUS_SKIP ]; $this->sessionManager->update($updateSession); ImOpenLines\Debug::addQueue($this->config['ID'], $this->session['ID'],__METHOD__, ['resultOperatorQueue' => $resultOperatorQueue, 'reasonReturn' => $reasonReturn]); } $this->stopLock(); } ImOpenLines\Debug::addQueue($this->config['ID'], $this->session['ID'], 'stop' . __METHOD__); return $result; } }
/var/www/axolotl/data/www/kirov.axolotls.ru/bitrix/modules/imopenlines/lib/queue/all.php