本文整理汇总了PHP中Chat::Destroy方法的典型用法代码示例。如果您正苦于以下问题:PHP Chat::Destroy方法的具体用法?PHP Chat::Destroy怎么用?PHP Chat::Destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chat
的用法示例。
在下文中一共展示了Chat::Destroy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CreateAutoForward
function CreateAutoForward()
{
global $INTLIST, $CONFIG;
$this->LoadForward(false, false);
if (!($this->Forward != null && !$this->Forward->Processed)) {
$allForwards = $this->GetForwards();
$targets = array();
setOperator();
if (count($INTLIST) >= 2) {
$forwardedToCount = array();
foreach ($INTLIST as $opsysId => $ccount) {
$lastForwardToTime = $ccount;
foreach ($allForwards as $forward) {
if ($forward->TargetSessId == $opsysId) {
$lastForwardToTime = max($forward->Created, $lastForwardToTime);
if (!isset($forwardedToCount[$opsysId])) {
$forwardedToCount[$opsysId] = 0;
}
$forwardedToCount[$opsysId]++;
}
}
$targets[$opsysId] = $lastForwardToTime;
}
if (count($forwardedToCount) > 0) {
$forwardedToCount = min($forwardedToCount);
} else {
$forwardedToCount = 0;
}
if (!empty($CONFIG["gl_mcfc"]) && is_numeric($CONFIG["gl_mcfc"])) {
if ($CONFIG["gl_mcfc"] <= $forwardedToCount) {
return false;
}
}
if (!empty($targets)) {
asort($targets);
foreach ($targets as $targetsysid => $time) {
if ($targetsysid != $this->DesiredChatPartner) {
$forward = new Forward($this->ChatId, $this->DesiredChatPartner);
$forward->InitiatorSystemId = $this->DesiredChatPartner;
$forward->ReceiverUserId = $this->UserId;
$forward->ReceiverBrowserId = $this->BrowserId;
$forward->TargetSessId = $targetsysid;
$forward->TargetGroupId = $this->DesiredChatGroup;
$forward->Invite = false;
$forward->Auto = true;
$forward->Save();
Chat::Destroy($this->ChatId);
return true;
}
}
}
} else {
if (!empty($CONFIG["gl_mcfc"])) {
return false;
}
}
}
return true;
}
示例2: CreateAutoForward
function CreateAutoForward($_user)
{
$this->LoadForward(false, false);
if (!($this->Forward != null && !$this->Forward->Processed)) {
$allForwards = $this->GetForwards();
$targets = array();
$this->FindOperator(VisitorChat::$Router, $_user, false, false, array($this->DesiredChatPartner => $this->DesiredChatPartner), false);
$isTargetAvailable = count(VisitorChat::$Router->OperatorsAvailable) >= 2 || count(VisitorChat::$Router->OperatorsAvailable) == 1 && !empty($this->DesiredChatPartner) && !isset(VisitorChat::$Router->OperatorsAvailable[$this->DesiredChatPartner]);
if ($isTargetAvailable) {
$forwardedToCount = array();
foreach (VisitorChat::$Router->OperatorsAvailable as $opsysId => $ccount) {
$lastForwardToTime = $ccount;
foreach ($allForwards as $forward) {
if ($forward->TargetSessId == $opsysId) {
$lastForwardToTime = max($forward->Created, $lastForwardToTime);
if (!isset($forwardedToCount[$opsysId])) {
$forwardedToCount[$opsysId] = 0;
}
$forwardedToCount[$opsysId]++;
}
}
$targets[$opsysId] = $lastForwardToTime;
}
if (count($forwardedToCount) > 0) {
$forwardedToCount = min($forwardedToCount);
} else {
$forwardedToCount = 0;
}
if (!empty(Server::$Configuration->File["gl_mcfc"]) && is_numeric(Server::$Configuration->File["gl_mcfc"])) {
if (Server::$Configuration->File["gl_mcfc"] <= $forwardedToCount) {
return false;
}
}
if (!empty($targets)) {
asort($targets);
foreach ($targets as $targetsysid => $time) {
if ($targetsysid != $this->DesiredChatPartner) {
$forward = new Forward($this->ChatId, $this->DesiredChatPartner);
$forward->InitiatorSystemId = $this->DesiredChatPartner;
$forward->ReceiverUserId = $this->UserId;
$forward->ReceiverBrowserId = $this->BrowserId;
$forward->TargetSessId = $targetsysid;
$forward->TargetGroupId = $this->DesiredChatGroup;
$forward->Invite = false;
$forward->Auto = true;
$forward->Save();
$this->ArchiveCreated = 2;
Chat::Destroy($this->ChatId);
return true;
}
}
}
}
}
return true;
}