0

我正在使用 CodeIgniter 运行社交网络 iPhone 应用程序。所有通知都正常工作,除了一个:当另一个用户评论他们的一个帖子时,用户应该收到通知,但目前,他们没有收到通知。这是代码:

function add_comment($postID, $postThumbURL, $postOwnerID, $userID, $username, $photoURL, $comment)
{
    $now = $this->getDate();
    $timestamp = time();
    $sql = "insert into comments values('', '$postID', '$userID', '$now', '$timestamp', '$comment')";
    $this->db->query($sql);
    $commentID = $this->db->insert_id();

    $sql = "update posts set commentCount=commentCount+1 where postID='$postID'";
    $this->db->query($sql);

    $sql = "select c.nID as commentID, c.created_timestamp as created_at, c.comment, c.userID, u.username, u.photoURL from comments c LEFT JOIN users u ON(c.userID=u.id) where c.nID='".$commentID."'";
    $query = $this->db->query($sql);
    $query = $query->result();

    $sql = "insert into notification values('', '$userID', '$postOwnerID', '$postID', '7', '".time()."')";
    $this->db->query($sql);

    return $query[0];
}

任何有关解决此问题的帮助或建议将不胜感激。如果您需要任何其他代码,请询问。提前致谢!

4

0 回答 0