本文整理汇总了PHP中erLhcoreClassChat::getRandomOnlineUserID方法的典型用法代码示例。如果您正苦于以下问题:PHP erLhcoreClassChat::getRandomOnlineUserID方法的具体用法?PHP erLhcoreClassChat::getRandomOnlineUserID怎么用?PHP erLhcoreClassChat::getRandomOnlineUserID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类erLhcoreClassChat
的用法示例。
在下文中一共展示了erLhcoreClassChat::getRandomOnlineUserID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processProActiveInvitation
public static function processProActiveInvitation(erLhcoreClassModelChatOnlineUser &$item, $params = array())
{
$referrer = self::getHost($item->referrer);
$session = erLhcoreClassAbstract::getSession();
$appendTag = '';
$q = $session->createFindQuery('erLhAbstractModelProactiveChatInvitation');
if (isset($params['tag']) && $params['tag'] != '') {
$appendTag = 'AND (' . $q->expr->eq('tag', $q->bindValue($params['tag'])) . ' OR tag = \'\')';
} else {
$appendTag = 'AND (tag = \'\')';
}
$q->where($q->expr->lte('time_on_site', $q->bindValue($item->time_on_site)) . ' AND ' . $q->expr->lte('pageviews', $q->bindValue($item->pages_count)) . '
AND (' . $q->expr->eq('siteaccess', $q->bindValue(erLhcoreClassSystem::instance()->SiteAccess)) . ' OR siteaccess = \'\')
AND (' . $q->expr->eq('identifier', $q->bindValue($item->identifier)) . ' OR identifier = \'\')
' . $appendTag . '
AND (' . $q->expr->eq('dep_id', $q->bindValue($item->dep_id)) . ' OR dep_id = 0)
AND (' . $q->expr->like($session->database->quote(trim($referrer)), 'concat(referrer,\'%\')') . ' OR referrer = \'\')')->orderBy('position ASC')->limit(1);
$messagesToUser = $session->find($q);
if (!empty($messagesToUser)) {
$message = array_shift($messagesToUser);
// Use default message if first time visit or returning message is empty
if ($item->total_visits == 1 || $message->message_returning == '') {
$item->operator_message = $message->message;
} else {
if ($item->chat !== false && $item->chat->nick != '') {
$nick = $item->chat->nick;
} elseif ($message->message_returning_nick != '') {
$nick = $message->message_returning_nick;
} else {
$nick = '';
}
$item->operator_message = str_replace('{nick}', $nick, $message->message_returning);
}
$item->operator_user_proactive = $message->operator_name;
$item->invitation_id = $message->id;
$item->invitation_seen_count = 0;
$item->requires_email = $message->requires_email;
$item->requires_username = $message->requires_username;
$item->requires_phone = $message->requires_phone;
$item->invitation_count++;
$item->store_chat = true;
$item->invitation_assigned = true;
$item->last_visit = time();
if ($message->show_random_operator == 1) {
$item->operator_user_id = erLhcoreClassChat::getRandomOnlineUserID(array('operators' => explode(',', trim($message->operator_ids))));
}
$message->executed_times += 1;
$message->updateThis();
erLhcoreClassChatEventDispatcher::getInstance()->dispatch('onlineuser.proactive_triggered', array('message' => &$message, 'ou' => &$item));
}
}
示例2: processProActiveInvitation
public static function processProActiveInvitation(erLhcoreClassModelChatOnlineUser &$item)
{
$referrer = self::getHost($item->referrer);
$session = erLhcoreClassAbstract::getSession();
$q = $session->createFindQuery('erLhAbstractModelProactiveChatInvitation');
$q->where($q->expr->lte('time_on_site', $q->bindValue($item->time_on_site)) . ' AND ' . $q->expr->lte('pageviews', $q->bindValue($item->pages_count)) . '
AND (' . $q->expr->eq('siteaccess', $q->bindValue(erLhcoreClassSystem::instance()->SiteAccess)) . ' OR siteaccess = \'\')
AND (' . $q->expr->eq('identifier', $q->bindValue($item->identifier)) . ' OR identifier = \'\')
AND (' . $q->expr->eq('dep_id', $q->bindValue($item->dep_id)) . ' OR dep_id = 0)
AND (' . $q->expr->like($session->database->quote(trim($referrer)), 'concat(referrer,\'%\')') . ' OR referrer = \'\')')->orderBy('position ASC')->limit(1);
$messagesToUser = $session->find($q);
if (!empty($messagesToUser)) {
$message = array_shift($messagesToUser);
$item->operator_message = $message->message;
$item->operator_user_proactive = $message->operator_name;
$item->invitation_id = $message->id;
$item->invitation_seen_count = 0;
$item->requires_email = $message->requires_email;
$item->requires_username = $message->requires_username;
$item->requires_phone = $message->requires_phone;
$item->invitation_count++;
$item->store_chat = true;
$item->invitation_assigned = true;
$item->last_visit = time();
if ($message->show_random_operator == 1) {
$item->operator_user_id = erLhcoreClassChat::getRandomOnlineUserID(array('operators' => explode(',', trim($message->operator_ids))));
}
$message->executed_times += 1;
$message->updateThis();
}
}