本文整理汇总了PHP中Chat::getChatByID方法的典型用法代码示例。如果您正苦于以下问题:PHP Chat::getChatByID方法的具体用法?PHP Chat::getChatByID怎么用?PHP Chat::getChatByID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chat
的用法示例。
在下文中一共展示了Chat::getChatByID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: session_start
//require_once('classMessages.php');
require_once 'classUser.php';
require_once 'classChat.php';
session_start();
if (isset($_SESSION['userID'])) {
$usr = User::getUserByID($_SESSION['userID']);
if (!$usr) {
unset($_SESSION['userID']);
return;
}
if ($usr->isAvailable()) {
if (!$usr->isFB()) {
$usr->deleteUser();
}
} else {
$chat = Chat::getChatByID($usr->chatID());
if ($chat) {
$chat->deleteChat();
$chat->deleteHistory();
if (!$usr->isFB()) {
$usr->deleteUser();
} else {
$usr->setAvailability(true);
$usr->updateUser();
}
//echo "--" . $chat->user1() . "-" . $chat->user2() . "--";
if ($chat->user1() == $usr) {
$friend = User::getUserByID($chat->user2());
} else {
$friend = User::getUserByID($chat->user1());
}
示例2: Chat
if ($friend) {
$chat = new Chat();
$chat->setChatID(Chat::generateID());
$chat->setUser1($usr->userID());
$chat->setUser2($friend->userID());
$chat->setIsNewMessage(0);
$usr->setAvailability(false);
$friend->setAvailability(false);
$usr->setChatID($chat->chatID());
$friend->setChatID($chat->chatID());
$chat->storeChat();
$usr->updateUser();
$friend->updateUser();
$ret['chat'] = true;
} else {
$ret['chat'] = false;
}
} else {
// user is engaged
//echo 'assdfg';
if (!Chat::getChatByID($usr->chatID())) {
$ret['chat'] = false;
} else {
$ret['chat'] = true;
//if(Messages::checkForNewMessagesS($usr->chatID())){
$ret['messages'] = Messages::getNewMessagesS($usr->chatID(), $usr->userID(), $_SESSION['prevTime']);
$_SESSION['prevTime'] = date('Y-m-d H:i:s');
//}
}
}
echo json_encode($ret);