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


PHP messages::getNewMessagesCount方法代码示例

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


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

示例1: get

 public function get()
 {
     $result = array("error" => true, "error_code" => ERROR_ACCOUNT_ID);
     $stmt = $this->db->prepare("SELECT * FROM users WHERE id = (:id) LIMIT 1");
     $stmt->bindParam(":id", $this->id, PDO::PARAM_INT);
     if ($stmt->execute()) {
         if ($stmt->rowCount() > 0) {
             $row = $stmt->fetch();
             $notifications_count = 0;
             $messages_count = 0;
             $guests_count = 0;
             $friends_count = 0;
             // Get new messages count
             $msg = new messages($this->db);
             $msg->setRequestFrom($this->id);
             $messages_count = $msg->getNewMessagesCount();
             unset($msg);
             // Get new notifications count
             $notifications = new notify($this->db);
             $notifications->setRequestFrom($this->id);
             $notifications_count = $notifications->getNewCount($row['last_notify_view']);
             unset($notifications);
             // Get new guests count
             $guests = new guests($this->db, $this->id);
             $guests->setRequestFrom($this->id);
             $guests_count = $guests->getNewCount($row['last_guests_view']);
             unset($guests);
             // Get new friends count
             $friends = new friends($this->db, $this->id);
             $friends->setRequestFrom($this->id);
             $friends_count = $friends->getNewCount($row['last_friends_view']);
             unset($friends);
             $profile = new profile($this->db, $row['id']);
             $online = false;
             $current_time = time();
             if ($row['last_authorize'] != 0 && $row['last_authorize'] > $current_time - 15 * 60) {
                 $online = true;
             }
             $time = new language($this->db);
             $result = array("error" => false, "error_code" => ERROR_SUCCESS, "id" => $row['id'], "gcm_regid" => $row['gcm_regid'], "admob" => $row['admob'], "ghost" => $row['ghost'], "vip" => $row['vip'], "gcm" => $row['gcm'], "balance" => $row['balance'], "fb_id" => $row['fb_id'], "rating" => $row['rating'], "state" => $row['state'], "regtime" => $row['regtime'], "ip_addr" => $row['ip_addr'], "username" => $row['login'], "fullname" => stripcslashes($row['fullname']), "location" => stripcslashes($row['country']), "status" => stripcslashes($row['status']), "fb_page" => stripcslashes($row['fb_page']), "instagram_page" => stripcslashes($row['my_page']), "verify" => $row['verify'], "email" => $row['email'], "emailVerify" => $row['emailVerify'], "sex" => $row['sex'], "year" => $row['bYear'], "month" => $row['bMonth'], "day" => $row['bDay'], "lat" => $row['lat'], "lng" => $row['lng'], "language" => $row['language'], "lowPhotoUrl" => $row['lowPhotoUrl'], "normalPhotoUrl" => $row['normalPhotoUrl'], "bigPhotoUrl" => $row['normalPhotoUrl'], "coverUrl" => $row['normalCoverUrl'], "originCoverUrl" => $row['originCoverUrl'], "iStatus" => $row['iStatus'], "iPoliticalViews" => $row['iPoliticalViews'], "iWorldView" => $row['iWorldView'], "iPersonalPriority" => $row['iPersonalPriority'], "iImportantInOthers" => $row['iImportantInOthers'], "iSmokingViews" => $row['iSmokingViews'], "iAlcoholViews" => $row['iAlcoholViews'], "iLooking" => $row['iLooking'], "iInterested" => $row['iInterested'], "allowComments" => $row['allowComments'], "allowMessages" => $row['allowMessages'], "allowLikesGCM" => $row['allowLikesGCM'], "allowGiftsGCM" => $row['allowGiftsGCM'], "allowCommentsGCM" => $row['allowCommentsGCM'], "allowFollowersGCM" => $row['allowFollowersGCM'], "allowMessagesGCM" => $row['allowMessagesGCM'], "allowCommentReplyGCM" => $row['allowCommentReplyGCM'], "lastAuthorize" => $row['last_authorize'], "lastAuthorizeDate" => date("Y-m-d H:i:s", $row['last_authorize']), "lastAuthorizeTimeAgo" => $time->timeAgo($row['last_authorize']), "online" => $online, "friendsCount" => $row['friends_count'], "photosCount" => $row['photos_count'], "likesCount" => $row['likes_count'], "giftsCount" => $row['gifts_count'], "notificationsCount" => $notifications_count, "guestsCount" => $guests_count, "newFriendsCount" => $friends_count, "messagesCount" => $messages_count);
             unset($profile);
             unset($time);
         }
     }
     return $result;
 }
开发者ID:JohnWilliamsMSU,项目名称:Steady,代码行数:46,代码来源:class.account.inc.php

示例2: get

 public function get($chatId, $msgId = 0)
 {
     if ($msgId == 0) {
         $msgId = $this->getMaxMessageId();
         $msgId++;
     }
     $messages = array("error" => false, "error_code" => ERROR_SUCCESS, "chatId" => $chatId, "messagesCount" => $this->messagesCountByChat($chatId), "msgId" => $msgId, "newMessagesCount" => 0, "messages" => array());
     $stmt = $this->db->prepare("SELECT id FROM messages WHERE chatId = (:chatId) AND id < (:msgId) AND removeAt = 0 ORDER BY id DESC LIMIT 20");
     $stmt->bindParam(':chatId', $chatId, PDO::PARAM_INT);
     $stmt->bindParam(':msgId', $msgId, PDO::PARAM_INT);
     if ($stmt->execute()) {
         while ($row = $stmt->fetch()) {
             $msgInfo = $this->info($row['id']);
             array_push($messages['messages'], $msgInfo);
             $messages['msgId'] = $msgInfo['id'];
             unset($msgInfo);
         }
         $chatInfo = $this->chatInfo($chatId);
         $profileId = $chatInfo['fromUserId'];
         if ($profileId == $this->getRequestFrom()) {
             $this->setChatLastView_FromId($chatId);
         } else {
             $this->setChatLastView_ToId($chatId);
         }
     }
     $messages_count = 0;
     $msg = new messages($this->db);
     $msg->setRequestFrom($this->getRequestFrom());
     $messages_count = $msg->getNewMessagesCount();
     unset($msg);
     $messages['newMessagesCount'] = $messages_count;
     return $messages;
 }
开发者ID:JohnWilliamsMSU,项目名称:Steady,代码行数:33,代码来源:class.messages.inc.php


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