当前位置: 首页>>代码示例>>PHP>>正文


PHP erLhcoreClassChat::getPendingChatsCountPublic方法代码示例

本文整理汇总了PHP中erLhcoreClassChat::getPendingChatsCountPublic方法的典型用法代码示例。如果您正苦于以下问题:PHP erLhcoreClassChat::getPendingChatsCountPublic方法的具体用法?PHP erLhcoreClassChat::getPendingChatsCountPublic怎么用?PHP erLhcoreClassChat::getPendingChatsCountPublic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在erLhcoreClassChat的用法示例。


在下文中一共展示了erLhcoreClassChat::getPendingChatsCountPublic方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: time

/**
 * php cron.php -s site_admin -c cron/workflow
 *
 * Run every 10 minits or so. On this cron depends automatic chat transfer and unaswered chats callback.
 *
 * */
echo "Starting chat/workflow\n";
if (erLhcoreClassModelChatConfig::fetch('run_departments_workflow')->current_value == 1) {
    echo "Starting departments workflow\n";
    $ts = time();
    foreach (erLhcoreClassChat::getList(array('limit' => 500, 'customfilter' => array('transfer_timeout_ts < (' . $ts . '-transfer_timeout_ac)'), 'filter' => array('status' => erLhcoreClassModelChat::STATUS_PENDING_CHAT, 'transfer_if_na' => 1))) as $chat) {
        $canExecuteWorkflow = true;
        if (erLhcoreClassModelChatConfig::fetch('pro_active_limitation')->current_value >= 0) {
            if ($chat->department !== false && $chat->department->department_transfer_id > 0) {
                $canExecuteWorkflow = erLhcoreClassChat::getPendingChatsCountPublic($chat->department->department_transfer_id) <= erLhcoreClassModelChatConfig::fetch('pro_active_limitation')->current_value;
            }
        }
        if ($canExecuteWorkflow == true) {
            erLhcoreClassChatWorkflow::transferWorkflow($chat);
            echo "executing department transfer workflow for - ", $chat->id, "\n";
        } else {
            echo "Skipping transfer because dedicated department queue is full\n";
        }
    }
    echo "Ended departments workflow\n";
}
// Unanswered chats callback
echo erLhcoreClassChatWorkflow::mainUnansweredChatWorkflow();
echo "Closed chats - ", erLhcoreClassChatWorkflow::automaticChatClosing(), "\n";
echo "Purged chats - ", erLhcoreClassChatWorkflow::automaticChatPurge(), "\n";
开发者ID:Adeelgill,项目名称:livehelperchat,代码行数:30,代码来源:workflow.php

示例2: handleRequest

 public static function handleRequest($paramsHandle = array())
 {
     if (isset($_SERVER['HTTP_USER_AGENT']) && !self::isBot($_SERVER['HTTP_USER_AGENT'])) {
         $newVisitor = false;
         if (isset($paramsHandle['vid']) && !empty($paramsHandle['vid'])) {
             $items = erLhcoreClassModelChatOnlineUser::getList(array('filter' => array('vid' => $paramsHandle['vid'])));
             if (!empty($items)) {
                 $item = array_shift($items);
                 // Visit duration les than 30m. Same as google analytics
                 // See: https://support.google.com/analytics/answer/2731565?hl=en
                 if (time() - $item->last_visit <= 30 * 60) {
                     $item->time_on_site += time() - $item->last_visit;
                     $item->tt_time_on_site += time() - $item->last_visit;
                 } else {
                     $item->time_on_site = 0;
                     $item->total_visits++;
                     $item->last_visit = time();
                     $item->pages_count = 0;
                     // Reset chat_id only if chat is not active or pending
                     if ($item->chat_id > 0) {
                         if ($item->chat === false || !in_array($item->chat->status, array(erLhcoreClassModelChat::STATUS_ACTIVE_CHAT, erLhcoreClassModelChat::STATUS_PENDING_CHAT))) {
                             $item->chat_id = 0;
                         }
                     }
                     if ($item->message_seen == 1 && $item->message_seen_ts < time() - (int) $paramsHandle['message_seen_timeout'] * 3600) {
                         $item->message_seen = 0;
                         $item->message_seen_ts = 0;
                         $item->operator_message = '';
                     }
                 }
                 $item->identifier = isset($paramsHandle['identifier']) && !empty($paramsHandle['identifier']) ? $paramsHandle['identifier'] : $item->identifier;
                 if (isset($paramsHandle['department']) && is_array($paramsHandle['department']) && count($paramsHandle['department']) == 1) {
                     $item->dep_id = array_shift($paramsHandle['department']);
                 } elseif (isset($paramsHandle['department']) && is_numeric($paramsHandle['department'])) {
                     $item->dep_id = (int) $paramsHandle['department'];
                 }
             } else {
                 $item = new erLhcoreClassModelChatOnlineUser();
                 $item->ip = erLhcoreClassIPDetect::getIP();
                 $item->vid = $paramsHandle['vid'];
                 $item->identifier = isset($paramsHandle['identifier']) && !empty($paramsHandle['identifier']) ? $paramsHandle['identifier'] : '';
                 $item->referrer = isset($_GET['r']) ? rawurldecode($_GET['r']) : '';
                 $item->total_visits = 1;
                 if (isset($paramsHandle['department']) && is_array($paramsHandle['department']) && count($paramsHandle['department']) == 1) {
                     $item->dep_id = array_shift($paramsHandle['department']);
                 } elseif (isset($paramsHandle['department']) && is_numeric($paramsHandle['department'])) {
                     $item->dep_id = (int) $paramsHandle['department'];
                 }
                 if (isset($paramsHandle['tz']) && is_numeric($paramsHandle['tz'])) {
                     $timezone_name = timezone_name_from_abbr(null, (int) $paramsHandle['tz'] * 3600, true);
                     if ($timezone_name !== false) {
                         $item->visitor_tz = $timezone_name;
                     }
                 }
                 self::detectLocation($item);
                 // Cleanup database then new user comes
                 self::cleanupOnlineUsers();
                 $item->store_chat = true;
                 $newVisitor = true;
             }
         } else {
             self::cleanupOnlineUsers();
             return false;
         }
         if (isset($paramsHandle['pages_count']) && $paramsHandle['pages_count'] == true) {
             $item->pages_count++;
             $item->tt_pages_count++;
             $item->store_chat = true;
             if (isset($_GET['onattr']) && is_array($_GET['onattr']) && !empty($_GET['onattr'])) {
                 $item->online_attr = json_encode($_GET['onattr']);
             }
             if ($item->has_message_from_operator == true) {
                 $item->invitation_seen_count++;
             }
             if (isset($paramsHandle['tz']) && is_numeric($paramsHandle['tz']) && $item->visitor_tz == '') {
                 $timezone_name = timezone_name_from_abbr(null, (int) $paramsHandle['tz'] * 3600, true);
                 if ($timezone_name !== false) {
                     $item->visitor_tz = $timezone_name;
                 }
             }
             // Hide invitation message after n times if required
             if ($item->has_message_from_operator == true && $item->invitation !== false && $item->invitation->hide_after_ntimes > 0 && $item->invitation_seen_count > $item->invitation->hide_after_ntimes) {
                 $item->message_seen = 1;
                 $item->message_seen_ts = time();
             }
         }
         $logPageView = false;
         // Update variables only if it's not JS to check for operator message
         if (!isset($paramsHandle['check_message_operator']) || isset($paramsHandle['pages_count']) && $paramsHandle['pages_count'] == true) {
             $item->user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
             $item->current_page = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
             $item->page_title = isset($_GET['dt']) ? (string) rawurldecode($_GET['dt']) : '';
             $item->last_visit = time();
             $item->store_chat = true;
             $logPageView = true;
         }
         if ((!isset($paramsHandle['wopen']) || $paramsHandle['wopen'] == 0) && $item->operator_message == '' && isset($paramsHandle['pro_active_invite']) && $paramsHandle['pro_active_invite'] == 1 && isset($paramsHandle['pro_active_limitation']) && ($paramsHandle['pro_active_limitation'] == -1 || erLhcoreClassChat::getPendingChatsCountPublic($item->dep_id > 0 ? $item->dep_id : false) <= $paramsHandle['pro_active_limitation'])) {
             //Process pro active chat invitation if this visitor matches any rules
             erLhAbstractModelProactiveChatInvitation::processProActiveInvitation($item);
         }
//.........这里部分代码省略.........
开发者ID:kenjiro7,项目名称:livehelperchat,代码行数:101,代码来源:erlhcoreclassmodelchatonlineuser.php


注:本文中的erLhcoreClassChat::getPendingChatsCountPublic方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。