application/models/mobile_api/Common_model.php
/* Get the comments of roomtype with unread comments count */
Get the comments of roomtype with unread comments count
Get the comments of roomtype with unread comments count
public function comments_roomType_list($post_data){
        $searchId = $post_data['searchId'];
        $shortlistedId = $post_data['shortlistedId'];
        $loginUserId = $post_data['loginUserId'];
        $sql = "SELECT c.searchId,c.shortlistedId,c.roomType,
                ((SELECT COUNT(*) FROM comments c1 where c1.shortlistedId = c.shortlistedId AND c1.searchId = c.searchId AND c1.deleteFlag !=1 AND c1.roomType = c.roomType) - (SELECT COUNT(*) FROM commentsread r where r.shortlistedId = c.shortlistedId AND r.userId = $loginUserId AND r.roomType = c.roomType)) as unread_comment_count,
				(SELECT COUNT(*) FROM comments c1 where c1.shortlistedId = c.shortlistedId AND c1.searchId = c.searchId AND c1.deleteFlag !=1 AND c1.roomType = c.roomType) as total_comment_count
                FROM comments c WHERE c.shortlistedId = $shortlistedId AND c.searchId =$searchId GROUP BY c.roomType";
        $record = $this->db->query($sql);
        if($record->num_rows()>0){
            return $record->result_array();
        }
    }
public function comments_roomType_list ( $ post_data ) { $ searchId = $ post_data [ 'searchId' ] ; $ shortlistedId = $ post_data [ 'shortlistedId' ] ; $ loginUserId = $ post_data [ 'loginUserId' ] ; $ sql = " SELECT c.searchId,c.shortlistedId,c.roomType,
                ((SELECT COUNT(*) FROM comments c1 where c1.shortlistedId = c.shortlistedId AND c1.searchId = c.searchId AND c1.deleteFlag !=1 AND c1.roomType = c.roomType) - (SELECT COUNT(*) FROM commentsread r where r.shortlistedId = c.shortlistedId AND r.userId =  $ loginUserId  AND r.roomType = c.roomType)) as unread_comment_count,
				(SELECT COUNT(*) FROM comments c1 where c1.shortlistedId = c.shortlistedId AND c1.searchId = c.searchId AND c1.deleteFlag !=1 AND c1.roomType = c.roomType) as total_comment_count
                FROM comments c WHERE c.shortlistedId =  $ shortlistedId  AND c.searchId = $ searchId  GROUP BY c.roomType " ; $ record = $ this -> db -> query ( $ sql ) ; if ( $ record -> num_rows ( ) > 0 ) { return $ record -> result_array ( ) ; } }
Get the comments of roomtype with unread comments count
Get the comments of roomtype with unread comments count