Beispiel #1
0
 public void Execute(XmlNode node)
 {
     try
     {
         DateTime now      = DateTime.Now;
         Database database = DatabaseFactory.CreateDatabase();
         this.ClearIpData(now, database);
         List <AccessRecordModel> list = (List <AccessRecordModel>)HiCache.Get("DataCache-AccessRecords");
         if (list != null && list.Count != 0)
         {
             HiCache.Remove("DataCache-AccessRecords");
             IList <SourceIpRecordsInfo> list2 = this.GetTodayAllIpList(database, now);
             if (list2 == null)
             {
                 list2 = new List <SourceIpRecordsInfo>();
             }
             IList <DailyAccessStatisticsInfo> list3 = this.GetTodayDailyAccessStatistics(database, now);
             if (list3 == null)
             {
                 list3 = new List <DailyAccessStatisticsInfo>();
             }
             List <SourceIpRecordsInfo> newIpLst = new List <SourceIpRecordsInfo>();
             List <ProductDailyAccessStatisticsInfo> productStatisticlst = new List <ProductDailyAccessStatisticsInfo>();
             foreach (AccessRecordModel item in list)
             {
                 TrafficJob.ManageDailyAcesssRecords(now, list2, list3, newIpLst, item, productStatisticlst);
             }
             this.ManageTrafficData(newIpLst, list3, productStatisticlst, database);
         }
     }
     catch (Exception ex)
     {
         Globals.AppendLog("Execute: " + ex.Message, "", "", "trafficLog");
     }
 }
Beispiel #2
0
        private static void ManageAllPage(DateTime dtNow, IList <SourceIpRecordsInfo> IpLst, IList <DailyAccessStatisticsInfo> DailyLst, List <SourceIpRecordsInfo> NewIpLst, AccessRecordModel AccessRecord)
        {
            bool flag = false;

            if (!TrafficJob.IsExiteSourceIp(IpLst, NewIpLst, AccessRecord.IpAddress, 4))
            {
                SourceIpRecordsInfo sourceIpRecordsInfo = new SourceIpRecordsInfo();
                sourceIpRecordsInfo.ProductId  = 0;
                sourceIpRecordsInfo.RecordDate = dtNow.Date;
                sourceIpRecordsInfo.SourceIP   = AccessRecord.IpAddress;
                sourceIpRecordsInfo.PageType   = 4;
                NewIpLst.Add(sourceIpRecordsInfo);
            }
            else
            {
                flag = true;
            }
            DailyAccessStatisticsInfo dailyAccessStatisticsInfo = DailyLst.FirstOrDefault((DailyAccessStatisticsInfo c) => c.PageType == 4 && c.SourceId == AccessRecord.SourceId && c.StoreId == AccessRecord.StoreId);

            if (dailyAccessStatisticsInfo != null)
            {
                dailyAccessStatisticsInfo.PV++;
                if (!flag)
                {
                    dailyAccessStatisticsInfo.UV++;
                }
            }
            else
            {
                dailyAccessStatisticsInfo                 = new DailyAccessStatisticsInfo();
                dailyAccessStatisticsInfo.Day             = dtNow.Day;
                dailyAccessStatisticsInfo.Month           = dtNow.Month;
                dailyAccessStatisticsInfo.PV              = 1;
                dailyAccessStatisticsInfo.StatisticalDate = dtNow.Date;
                if (!flag)
                {
                    dailyAccessStatisticsInfo.UV = 1;
                }
                dailyAccessStatisticsInfo.Year     = dtNow.Year;
                dailyAccessStatisticsInfo.PageType = 4;
                dailyAccessStatisticsInfo.SourceId = AccessRecord.SourceId;
                dailyAccessStatisticsInfo.StoreId  = AccessRecord.StoreId;
                DailyLst.Add(dailyAccessStatisticsInfo);
            }
        }
Beispiel #3
0
        private static void ManageDailyAcesssRecords(DateTime dtNow, IList <SourceIpRecordsInfo> IpLst, IList <DailyAccessStatisticsInfo> DailyLst, List <SourceIpRecordsInfo> NewIpLst, AccessRecordModel AccessRecord, List <ProductDailyAccessStatisticsInfo> ProductStatisticlst)
        {
            TrafficJob.ManageAllPage(dtNow, IpLst, DailyLst, NewIpLst, AccessRecord);
            bool flag = TrafficJob.IsExiteSourceIp(IpLst, NewIpLst, AccessRecord.IpAddress, AccessRecord.PageType);

            if (AccessRecord.ProductId > 0 && AccessRecord.PageType == 3)
            {
                DailyAccessStatisticsInfo dailyAccessStatisticsInfo = DailyLst.FirstOrDefault((DailyAccessStatisticsInfo c) => c.SourceId == AccessRecord.SourceId && c.PageType == AccessRecord.PageType && c.StoreId == AccessRecord.StoreId);
                if (dailyAccessStatisticsInfo != null)
                {
                    dailyAccessStatisticsInfo.PV++;
                    if (!flag)
                    {
                        dailyAccessStatisticsInfo.UV++;
                    }
                    dailyAccessStatisticsInfo.StoreId = AccessRecord.StoreId;
                }
                else
                {
                    dailyAccessStatisticsInfo                 = new DailyAccessStatisticsInfo();
                    dailyAccessStatisticsInfo.Day             = dtNow.Day;
                    dailyAccessStatisticsInfo.Month           = dtNow.Month;
                    dailyAccessStatisticsInfo.PV              = 1;
                    dailyAccessStatisticsInfo.StatisticalDate = dtNow.Date;
                    if (!flag)
                    {
                        dailyAccessStatisticsInfo.UV = 1;
                    }
                    dailyAccessStatisticsInfo.Year     = dtNow.Year;
                    dailyAccessStatisticsInfo.PageType = AccessRecord.PageType;
                    dailyAccessStatisticsInfo.SourceId = AccessRecord.SourceId;
                    dailyAccessStatisticsInfo.StoreId  = AccessRecord.StoreId;
                    DailyLst.Add(dailyAccessStatisticsInfo);
                }
                TrafficJob.ManageProductAccess(dtNow, ProductStatisticlst, AccessRecord, IpLst, NewIpLst);
            }
            else
            {
                if (!flag)
                {
                    SourceIpRecordsInfo sourceIpRecordsInfo = new SourceIpRecordsInfo();
                    sourceIpRecordsInfo.ProductId  = 0;
                    sourceIpRecordsInfo.RecordDate = dtNow.Date;
                    sourceIpRecordsInfo.SourceIP   = AccessRecord.IpAddress;
                    sourceIpRecordsInfo.PageType   = AccessRecord.PageType;
                    NewIpLst.Add(sourceIpRecordsInfo);
                }
                DailyAccessStatisticsInfo dailyAccessStatisticsInfo2 = DailyLst.FirstOrDefault((DailyAccessStatisticsInfo c) => c.SourceId == AccessRecord.SourceId && c.PageType == AccessRecord.PageType && c.StoreId == AccessRecord.StoreId);
                if (dailyAccessStatisticsInfo2 != null)
                {
                    dailyAccessStatisticsInfo2.PV++;
                    if (!flag)
                    {
                        dailyAccessStatisticsInfo2.UV++;
                    }
                    dailyAccessStatisticsInfo2.StoreId = AccessRecord.StoreId;
                }
                else
                {
                    dailyAccessStatisticsInfo2                 = new DailyAccessStatisticsInfo();
                    dailyAccessStatisticsInfo2.Day             = dtNow.Day;
                    dailyAccessStatisticsInfo2.Month           = dtNow.Month;
                    dailyAccessStatisticsInfo2.PV              = 1;
                    dailyAccessStatisticsInfo2.StatisticalDate = dtNow.Date;
                    if (!flag)
                    {
                        dailyAccessStatisticsInfo2.UV = 1;
                    }
                    dailyAccessStatisticsInfo2.Year     = dtNow.Year;
                    dailyAccessStatisticsInfo2.PageType = AccessRecord.PageType;
                    dailyAccessStatisticsInfo2.SourceId = AccessRecord.SourceId;
                    dailyAccessStatisticsInfo2.StoreId  = AccessRecord.StoreId;
                    DailyLst.Add(dailyAccessStatisticsInfo2);
                }
            }
        }