예제 #1
0
        /// <summary>
        /// 任务执行的内容
        /// </summary>
        /// <param name="taskDetail">任务配置状态信息</param>
        public void Execute(TaskDetail taskDetail)
        {
            SystemDataService systemDataService = new SystemDataService();

            foreach (var perDayTenantTypeId in StageCountTypeManager.GetAllTenantTypeIds())
            {
                var stageCountTypeManager = StageCountTypeManager.Instance(perDayTenantTypeId);
                ConcurrentDictionary <string, List <int> > allStageCountTypes = stageCountTypeManager.GetAllStageCountTypes();

                foreach (var base2StageCountType in allStageCountTypes)
                {
                    //批量更新计数表中的阶段计数
                    Dictionary <string, int> countType2Days = base2StageCountType.Value.ToDictionary(n => stageCountTypeManager.GetStageCountType(base2StageCountType.Key, n), n => n);
                    new CountRepository().UpdateStageCountPerDay(perDayTenantTypeId, base2StageCountType.Key, countType2Days);
                    //删除每日计数表中的过期的历史计数记录
                    int maxValue = stageCountTypeManager.GetMaxDayCount(base2StageCountType.Key);
                    new CountRepository().DeleteTrashCountPerDays(perDayTenantTypeId, base2StageCountType.Key, maxValue);
                }
            }
        }
예제 #2
0
        /// <summary>
        /// 任务执行的内容
        /// </summary>
        /// <param name="taskDetail">任务配置状态信息</param>
        public void Execute(TaskDetail taskDetail)
        {
            SystemDataService systemDataService = new SystemDataService();

            foreach (var perDayTenantTypeId in StageCountTypeManager.GetAllTenantTypeIds())
            {
                var stageCountTypeManager = StageCountTypeManager.Instance(perDayTenantTypeId);
                ConcurrentDictionary<string, List<int>> allStageCountTypes = stageCountTypeManager.GetAllStageCountTypes();

                foreach (var base2StageCountType in allStageCountTypes)
                {
                    //批量更新计数表中的阶段计数
                    Dictionary<string, int> countType2Days = base2StageCountType.Value.ToDictionary(n => stageCountTypeManager.GetStageCountType(base2StageCountType.Key, n), n => n);
                    new CountRepository().UpdateStageCountPerDay(perDayTenantTypeId, base2StageCountType.Key, countType2Days);
                    //删除每日计数表中的过期的历史计数记录
                    int maxValue = stageCountTypeManager.GetMaxDayCount(base2StageCountType.Key);
                    new CountRepository().DeleteTrashCountPerDays(perDayTenantTypeId, base2StageCountType.Key, maxValue);
                }
            }
        }
        /// <summary>
        /// 删除用户记录(删除用户时使用)
        /// </summary>
        /// <param name="userId">被删除用户</param>
        /// <param name="takeOverUserName">接管用户名</param>
        /// <param name="takeOverAll">是否接管被删除用户的所有内容</param>
        public void DeleteUser(long userId, string takeOverUserName, bool takeOverAll)
        {
            //设计要点:
            //1.利用sql转移给接管用户、删除群组成员、群组成员申请;
            //2.删除群组成员时,维护群组的成员数;

            //如果没设置由谁接管群组,就把群组转给网站初始管理员
            long takeOverUserId = 0;
            if (string.IsNullOrEmpty(takeOverUserName))
            {
                takeOverUserId = new SystemDataService().GetLong("Founder");
            }
            else
            {
                takeOverUserId = UserIdToUserNameDictionary.GetUserId(takeOverUserName);
            }


            IUserService userService = DIContainer.Resolve<IUserService>();
            User takeOver = userService.GetFullUser(takeOverUserId);
            groupRepository.DeleteUser(userId, takeOver, takeOverAll);
        }
예제 #4
0
        /// <summary>
        /// 删除用户记录(删除用户时使用)
        /// </summary>
        /// <param name="userId">被删除用户</param>
        /// <param name="takeOverUserName">接管用户名</param>
        /// <param name="takeOverAll">是否接管被删除用户的所有内容</param>
        public void DeleteUser(long userId, string takeOverUserName, bool takeOverAll)
        {
            long takeOverUserId = UserIdToUserNameDictionary.GetUserId(takeOverUserName);
            IUserService userService = DIContainer.Resolve<IUserService>();
            User takeOver = userService.GetFullUser(takeOverUserId);
            BarSectionService barSectionService = new BarSectionService();
            BarThreadService barThreadService = new BarThreadService();
            BarPostService barPostService = new BarPostService();

            //删除用户时,不删除贴吧,把贴吧转让,如果没有指定转让人,那就转给网站初始管理员
            if (takeOver == null)
            {
                takeOverUserId = new SystemDataService().GetLong("Founder");
                takeOver = userService.GetFullUser(takeOverUserId);
            }

            barThreadRepository.DeleteUser(userId, takeOver, takeOverAll);
            if (takeOver != null)
            {
                if (!takeOverAll)
                {
                    barThreadService.DeletesByUserId(userId);
                    barPostService.DeletesByUserId(userId);
                }
            }
            //else
            //{
            //    barSectionService.DeletesByUserId(userId);
            //    barThreadService.DeletesByUserId(userId);
            //    barPostService.DeletesByUserId(userId);
            //}
        }
예제 #5
0
        /// <summary>
        /// 变更系统积分总额
        /// </summary>
        /// <param name="number">变更的积分值<remarks>减积分用负数</remarks></param>
        private void ChangeSystemTradePoints(long number)
        {
            SystemDataService systemDataService = DIContainer.Resolve <SystemDataService>();

            systemDataService.Change(SystemDataKeys.Instance().TradePoints(), number);
        }
예제 #6
0
        /// <summary>
        /// 保存统计帐号
        /// <param name="account">被保存的统计帐号</param>
        /// </summary>
        public void SaveStatisticsAccount(StatisticsAccount account)
        {
            if (account == null || string.IsNullOrEmpty(account.Password) || string.IsNullOrEmpty(account.UserName))
                return;

            SystemDataService systemDataService = new SystemDataService();
            long siteId = systemDataService.GetLong("CNZZStatisticsSiteId");
            long password = systemDataService.GetLong("CNZZStatisticsPassword");

            long accountSiteId = 0;
            if (!long.TryParse(account.UserName, out accountSiteId))
                return;

            long accountPassword = 0;
            if (!long.TryParse(account.Password, out accountPassword))
                return;

            if (accountSiteId != siteId)
                systemDataService.Change("CNZZStatisticsSiteId", accountSiteId - siteId);
            if (accountPassword != password)
                systemDataService.Change("CNZZStatisticsPassword", accountPassword - password);

            Enable = true;

            SiteSettings siteSettings = siteSettingsManager.Get();

            siteSettings.StatScript = GetStatisticsCode();

            siteSettingsManager.Save(siteSettings);
        }
예제 #7
0
        /// <summary>
        /// 获取统计代码
        /// </summary>
        /// <returns></returns>
        public string GetStatisticsCode()
        {
            SystemDataService service = new SystemDataService();
            long siteId = service.GetLong("CNZZStatisticsSiteId");
            if (siteId > 0)
                return string.Format("<script src='http://pw.cnzz.com/c.php?id={0}&l=2' language='JavaScript' charset='gb2312'></script>", siteId);

            return string.Empty;
        }
예제 #8
0
        /// <summary>
        /// 获取展示统计页面的连接
        /// </summary>
        /// <returns></returns>
        public string GetCNZZStatisticsPageLink()
        {
            SystemDataService service = new SystemDataService();
            long siteId = service.GetLong("CNZZStatisticsSiteId");
            long password = service.GetLong("CNZZStatisticsPassword");

            SiteSettings siteSettings = siteSettingsManager.Get();

            if (siteId <= 0 || password <= 0)
                return string.Empty;

            return string.Format("http://wss.cnzz.com/user/companion/spacebuilder_login.php?site_id={0}&password={1}", siteId, password);
        }
예제 #9
0
        /// <summary>
        /// 获取统计账户信息
        /// </summary>
        /// <returns></returns>
        public StatisticsAccount GetAccount()
        {
            SystemDataService systemDataService = new SystemDataService();
            StatisticsAccount account = new StatisticsAccount();
            long siteId = systemDataService.GetLong("CNZZStatisticsSiteId");
            long password = systemDataService.GetLong("CNZZStatisticsPassword");

            if (siteId <= 0 || password <= 0)
                return null;

            account.UserName = siteId.ToString();
            account.Password = password.ToString();
            return account;
        }