Example #1
0
        public void RefreshHouse()
        {
            LogHelper.Info("开始RefreshHouse...");
            var sw = new System.Diagnostics.Stopwatch();

            sw.Start();

            var cityDashboards = _configService.LoadCitySources();

            foreach (var item in cityDashboards)
            {
                //聚合房源的缓存,前600条数据
                var search = new HouseCondition()
                {
                    CityName = item.Key, HouseCount = 600, IntervalDay = 14, Refresh = true
                };
                Search(search);
                foreach (var dashboard in item.Value)
                {
                    //每类房源的默认缓存,前600条数据
                    search.HouseCount = 600;
                    search.Source     = dashboard.Source;
                    this.Search(search);

                    // 为小程序做的缓存,每次拉10条,一共20页
                    for (var page = 0; page <= 30; page++)
                    {
                        search.HouseCount = 20;
                        search.Source     = dashboard.Source;
                        search.Page       = page;
                        this.Search(search);
                    }
                }
                //为移动端做的缓存,每次拉180条,一共10页
                for (var page = 0; page <= 10; page++)
                {
                    search.Source     = "";
                    search.HouseCount = 180;
                    search.Page       = page;
                    this.Search(search);
                }

                //为小程序做的缓存,每次拉20条,一共30页
                for (var page = 0; page <= 30; page++)
                {
                    search.Source     = "";
                    search.HouseCount = 20;
                    search.Page       = page;
                    this.Search(search);
                }
            }

            sw.Stop();
            string copyTime = sw.Elapsed.TotalSeconds.ToString(CultureInfo.InvariantCulture);

            LogHelper.Info("RefreshHouse结束,花费时间:" + copyTime);
        }
Example #2
0
        public void RefreshHouseV2()
        {
            Console.WriteLine("开始RefreshHouseV2...");
            var sw = new System.Diagnostics.Stopwatch();

            sw.Start();

            var cityDashboards = _configService.LoadCitySources();

            foreach (var item in cityDashboards)
            {
                var condition = new DBHouseQuery()
                {
                    City = item.Key, Refresh = true
                };
                foreach (var dashboard in item.Value)
                {
                    //指定来源,每次拉600条,一般用于地图页
                    for (var page = 0; page <= 3; page++)
                    {
                        condition.Size   = 600;
                        condition.Page   = page;
                        condition.Source = dashboard.Source;
                        Console.WriteLine($"正在刷新[{condition.RedisKey}]缓存");
                        Search(condition);
                    }

                    for (var page = 0; page <= 3; page++)
                    {
                        condition.Size   = 1200;
                        condition.Page   = page;
                        condition.Source = dashboard.Source;
                        Console.WriteLine($"正在刷新[{condition.RedisKey}]缓存");
                        Search(condition);
                    }

                    // 指定来源,每次拉20条,前30页,一般用于小程序/移动端列表页
                    for (var page = 0; page <= 30; page++)
                    {
                        condition.Size   = 20;
                        condition.Source = dashboard.Source;
                        condition.Page   = page;
                        Console.WriteLine($"正在刷新[{condition.RedisKey}]缓存");
                        this.Search(condition);
                    }
                }
            }
            sw.Stop();
            string copyTime = sw.Elapsed.TotalSeconds.ToString(CultureInfo.InvariantCulture);

            Console.WriteLine("RefreshHouseV2结束,花费时间:" + copyTime);
        }
Example #3
0
        public void RefreshHouseV2()
        {
            LogHelper.Info("开始RefreshHouseV2...");
            var sw = new System.Diagnostics.Stopwatch();

            sw.Start();

            var cityDashboards = _configService.LoadCitySources();

            foreach (var item in cityDashboards)
            {
                var search = new HouseCondition()
                {
                    City = item.Key, Size = 600, IntervalDay = 14, Refresh = true
                };
                foreach (var dashboard in item.Value)
                {
                    //指定来源,每次拉600条,一般用于地图页
                    for (var page = 0; page <= 3; page++)
                    {
                        search.Size   = 600;
                        search.Page   = page;
                        search.Source = dashboard.Source;
                        NewSearch(search);
                    }

                    // 指定来源,每次拉20条,前30页,一般用于小程序/移动端列表页
                    for (var page = 0; page <= 30; page++)
                    {
                        search.Size   = 20;
                        search.Source = dashboard.Source;
                        search.Page   = page;
                        this.NewSearch(search);
                    }
                }
            }
            sw.Stop();
            string copyTime = sw.Elapsed.TotalSeconds.ToString(CultureInfo.InvariantCulture);

            LogHelper.Info("RefreshHouseV2结束,花费时间:" + copyTime);
        }