Пример #1
0
        public IActionResult GetHouseInfo(string cityName, string source = "", int houseCount = 100,
                                          int intervalDay = 7, string keyword = "", bool refresh = false)
        {
            try
            {
                var houseList = CrawlerDataDapper.SearchHouseInfo(cityName, source, houseCount, intervalDay, keyword, refresh);
                var rooms     = houseList.Select(house =>
                {
                    var markBGType = string.Empty;
                    int housePrice = (int)house.HousePrice;
                    if (housePrice > 0)
                    {
                        markBGType = LocationMarkBGType.SelectColor(housePrice / 1000);
                    }

                    return(new HouseInfo
                    {
                        Money = house.DisPlayPrice,
                        HouseURL = house.HouseOnlineURL,
                        HouseLocation = house.HouseLocation,
                        HouseTime = house.PubTime.ToString(),
                        HousePrice = housePrice,
                        LocationMarkBG = markBGType,
                        DisplaySource = ConstConfigurationName.ConvertToDisPlayName(house.Source)
                    });
                });
                return(Json(new { IsSuccess = true, HouseInfos = rooms }));
            }
            catch (Exception ex)
            {
                return(Json(new { IsSuccess = false, error = ex.ToString() }));
            }
        }
Пример #2
0
        public IActionResult GetHouseInfo(string cityName, string source = "", int houseCount = 500,
                                          int withAnyDays = 7, string keyword = "")
        {
            var houses = CrawlerDataDapper.SearchHouseInfo(cityName, source, houseCount, withAnyDays, keyword);
            var rooms  = houses.Select(house =>
            {
                var markBGType = string.Empty;
                int housePrice = (int)house.HousePrice;
                if (housePrice > 0)
                {
                    markBGType = LocationMarkBGType.SelectColor(housePrice / 1000);
                }

                return(new HouseInfo
                {
                    Source = house.Source,
                    Money = house.DisPlayPrice,
                    HouseURL = house.HouseOnlineURL,
                    HouseLocation = house.HouseLocation,
                    HouseTime = house.PubTime.ToString(),
                    HouseTitle = house.HouseTitle,
                    HousePrice = housePrice,
                    LocationMarkBG = markBGType,
                    DisplaySource = ConstConfigurationName.ConvertToDisPlayName(house.Source)
                });
            });

            return(Json(new { IsSuccess = true, HouseInfos = rooms }));
        }