Changed redirecting for VIP ads.
This commit is contained in:
@@ -2,13 +2,14 @@
|
|||||||
const {
|
const {
|
||||||
findRealEstatesForSearchRequest
|
findRealEstatesForSearchRequest
|
||||||
} = require("../helpers/db/searchRequestMatch");
|
} = require("../helpers/db/searchRequestMatch");
|
||||||
|
const { AD_STATUS } = require("../common/enums");
|
||||||
|
|
||||||
const getRealEstates = async (req, res) => {
|
const getRealEstates = async (req, res) => {
|
||||||
const searchRequestId = req.params["searchRequestId"] || "";
|
const searchRequestId = req.params["searchRequestId"] || "";
|
||||||
const realEstates = await findRealEstatesForSearchRequest(searchRequestId);
|
const realEstates = await findRealEstatesForSearchRequest(searchRequestId);
|
||||||
|
|
||||||
const title = "Nekretnine koje odgovaraju Vašim uslovima pretrage";
|
const title = "Nekretnine koje odgovaraju Vašim uslovima pretrage";
|
||||||
res.render("realEstates", { realEstates, title });
|
res.render("realEstates", { realEstates, title, AD_STATUS });
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|||||||
@@ -184,14 +184,13 @@ class ProstorCrawler {
|
|||||||
const { lat, lng, property_name, price, size, link, status } = realEstate;
|
const { lat, lng, property_name, price, size, link, status } = realEstate;
|
||||||
|
|
||||||
//Status information is given already in realestate list
|
//Status information is given already in realestate list
|
||||||
//For VIP Ads status ='' canot be used, but also area='0' we will use that temporary
|
//For VIP Ads status ='' canot be used, but no VIP ads are crawled
|
||||||
|
//We will make "fake" vip ad for RE that have size=55
|
||||||
//It is weird because yesterday it said 'VIP ponuda' ???
|
//It is weird because yesterday it said 'VIP ponuda' ???
|
||||||
const adStatus =
|
const adStatus =
|
||||||
size === "0"
|
size === "55"
|
||||||
? ProstorCrawler.getStatusId("VIP ponuda")
|
? ProstorCrawler.getStatusId("VIP ponuda")
|
||||||
: ProstorCrawler.getStatusId(status);
|
: ProstorCrawler.getStatusId(status);
|
||||||
//
|
|
||||||
console.log("adStatus", adStatus);
|
|
||||||
|
|
||||||
const url = `https://prostor.ba${link}`;
|
const url = `https://prostor.ba${link}`;
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,18 @@
|
|||||||
<ul class="collection with-header">
|
<ul class="collection with-header">
|
||||||
<% for(const realEstate of realEstates) { %>
|
<% for(const realEstate of realEstates) { %>
|
||||||
<li class="collection-item">
|
<li class="collection-item">
|
||||||
|
<% if(realEstate.adStatus === AD_STATUS.STATUS_VIP) {%>
|
||||||
|
<div>
|
||||||
|
<% //This needs to do redirecting instead of direct link to realestate
|
||||||
|
%>
|
||||||
|
<a href="/redirect/<%= realEstate.id %>" class="estates-link">
|
||||||
|
<%= realEstate.title %>
|
||||||
|
<div class="kivi-color secondary-content">
|
||||||
|
<i class="material-icons">send</i>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<%} else { %>
|
||||||
<div>
|
<div>
|
||||||
<a href="<%= realEstate.url %>" class="estates-link">
|
<a href="<%= realEstate.url %>" class="estates-link">
|
||||||
<%= realEstate.title %>
|
<%= realEstate.title %>
|
||||||
@@ -10,6 +22,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
<% }%>
|
||||||
</li>
|
</li>
|
||||||
<% } %>
|
<% } %>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -18,7 +18,19 @@
|
|||||||
<br />
|
<br />
|
||||||
<% if(vipAd) { %>
|
<% if(vipAd) { %>
|
||||||
<div class="center">
|
<div class="center">
|
||||||
<h6>Work in progress....</h6>
|
<h6>
|
||||||
|
Ovaj oglas zahtijeva da budete član
|
||||||
|
<a href="https://prostor.ba/" rel="noreferrer">Prostor.ba</a>.
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<a href="https://prostor.ba/moj-prostor/prijava" rel="noreferrer"
|
||||||
|
>Ulogujte se</a
|
||||||
|
>
|
||||||
|
ili napravite
|
||||||
|
<a href="https://prostor.ba/moj-prostor/registracija" rel="noreferrer"
|
||||||
|
>novi račun</a
|
||||||
|
>, a potom otvorite <a href="<%= redirectUrl %>" rel="noreferrer">oglas</a>.
|
||||||
|
</h6>
|
||||||
</div>
|
</div>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<div class="center">
|
<div class="center">
|
||||||
@@ -32,6 +44,6 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
window.onload = function() {
|
window.onload = function() {
|
||||||
//document.getElementById("realEstateUrl").click();
|
document.getElementById("realEstateUrl").click();
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user