Exemplo n.º 1
0
        public void CheckMonthlyAllotPoint()
        {
            try
            {
                DateTime utcNow = DateTime.UtcNow;

                var users = this.unitOfWork.Repository <ApplicationUser>().GetMany(p =>
                                                                                   p.AllotSetting != null &&
                                                                                   p.AllotSetting.MonthlyAllot == true &&
                                                                                   p.AllotSetting.MonthlyAllotDay == utcNow.Day).ToList();

                if (!users.Any())
                {
                    // this.logService.Debug("無任何使用者須滿足每月定期撥點觸發條件");
                    return;
                }

                this.logService.Debug("處理每月定期撥點(使用者:[{0}])", string.Join("、", users.Select(p => p.UserName)));

                foreach (var user in users)
                {
                    tradeService.MonthlyAllotPoint(user);
                }
            }
            catch (Exception ex)
            {
                this.logService.Error(ex);
                throw;
            }
        }