Beispiel #1
0
        /// <summary>
        /// 更新PV统计
        /// </summary>
        /// <param name="updatePVStatState">更新PV统计状态</param>
        public void UpdatePVStat(UpdatePVStatState updatePVStatState)
        {
            string year = updatePVStatState.Time.Year.ToString();
            string month = updatePVStatState.Time.Year.ToString() + updatePVStatState.Time.Month.ToString("00");
            string day = updatePVStatState.Time.ToString("yyyy-MM-dd");
            string hour = updatePVStatState.Time.ToString("yyyy-MM-dd") + updatePVStatState.Time.Hour.ToString("00");
            string week = updatePVStatState.Time.ToString("yyyy-MM-dd") + updatePVStatState.Time.Month.ToString("00") + ((int)updatePVStatState.Time.DayOfWeek).ToString();

            MallConfigInfo mallConfigInfo = BMAConfig.MallConfig;
            bool isStatOS = mallConfigInfo.IsStatOS == 1;
            bool isStatBrowser = mallConfigInfo.IsStatBrowser == 1;
            bool isStatRegion = mallConfigInfo.IsStatRegion == 1;

            string condition = string.Format("([storeid]=0 AND [category]='total') OR ([storeid]=0 AND [category]='year' AND [value]='{1}')  OR ([storeid]=0 AND [category]='month' AND [value]='{2}') OR ([storeid]=0 AND [category]='day' AND [value]='{3}') OR ([storeid]=0 AND [category]='hour' AND [value]='{4}') OR ([storeid]=0 AND [category]='week' AND [value]='{5}'){6}{7}{8} OR ([storeid]={0} AND [category]='total') OR ([storeid]={0} AND [category]='year' AND [value]='{1}') OR ([storeid]={0} AND [category]='month' AND [value]='{2}') OR ([storeid]={0} AND [category]='day' AND [value]='{3}') OR ([storeid]={0} AND [category]='hour' AND [value]='{4}') OR ([storeid]={0} AND [category]='week' AND [value]='{5}'){9}",
                                                updatePVStatState.StoreId,
                                                year,
                                                month,
                                                day,
                                                hour,
                                                week,
                                                isStatOS ? string.Format(" OR ([storeid]=0 AND [category]='os' AND [value]='{0}')", updatePVStatState.OS) : "",
                                                isStatBrowser ? string.Format(" OR ([storeid]=0 AND [category]='browser' AND [value]='{0}')", updatePVStatState.Browser) : "",
                                                isStatRegion ? string.Format(" OR ([storeid]=0 AND [category]='region' AND [value]='{0}')", updatePVStatState.RegionId) : "",
                                                isStatRegion ? string.Format(" OR ([storeid]={0} AND [category]='region' AND [value]='{1}')", updatePVStatState.StoreId, updatePVStatState.RegionId) : "");

            int affectRow = 12;
            if (isStatOS)
                affectRow = affectRow + 1;
            if (isStatBrowser)
                affectRow = affectRow + 1;
            if (isStatRegion)
                affectRow = affectRow + 2;

            if (UpdatePVStat(condition) < affectRow)
            {
                AddPVStat(0, "total", "");
                AddPVStat(0, "year", year);
                AddPVStat(0, "month", month);
                AddPVStat(0, "day", day);
                AddPVStat(0, "hour", hour);
                AddPVStat(0, "week", week);
                AddPVStat(updatePVStatState.StoreId, "total", "");
                AddPVStat(updatePVStatState.StoreId, "year", year);
                AddPVStat(updatePVStatState.StoreId, "month", month);
                AddPVStat(updatePVStatState.StoreId, "day", day);
                AddPVStat(updatePVStatState.StoreId, "hour", hour);
                AddPVStat(updatePVStatState.StoreId, "week", week);

                if (isStatOS)
                    AddPVStat(0, "os", updatePVStatState.OS);
                if (isStatBrowser)
                    AddPVStat(0, "browser", updatePVStatState.Browser);
                if (isStatRegion)
                {
                    AddPVStat(0, "region", updatePVStatState.RegionId.ToString());
                    AddPVStat(updatePVStatState.StoreId, "region", updatePVStatState.RegionId.ToString());
                }
            }
        }
Beispiel #2
0
 /// <summary>
 /// 更新PV统计
 /// </summary>
 /// <param name="updatePVStatState">更新PV统计状态</param>
 public static void UpdatePVStat(UpdatePVStatState updatePVStatState)
 {
     BrnMall.Core.BMAData.RDBS.UpdatePVStat(updatePVStatState);
 }
Beispiel #3
0
 /// <summary>
 /// 更新PV统计
 /// </summary>
 /// <param name="state">state</param>
 public void UpdatePVStat(UpdatePVStatState state)
 {
     ManagedThreadPool.QueueUserWorkItem(new WaitCallback(PVStats.UpdatePVStat), state);
 }