/// <summary> /// 更新商品统计 /// </summary> /// <param name="updateProductStatState">更新商品统计状态</param> public static void UpdateProductStat(UpdateProductStatState updateProductStatState) { BrnMall.Core.BMAData.RDBS.UpdateProductStat(updateProductStatState); }
/// <summary> /// 更新商品统计 /// </summary> /// <param name="updateProductStatState">更新商品统计状态</param> public void UpdateProductStat(UpdateProductStatState updateProductStatState) { string year = updateProductStatState.Time.Year.ToString(); string month = updateProductStatState.Time.Year.ToString() + updateProductStatState.Time.Month.ToString("00"); string day = updateProductStatState.Time.ToString("yyyy-MM-dd"); string hour = updateProductStatState.Time.ToString("yyyy-MM-dd") + updateProductStatState.Time.Hour.ToString("00"); string week = updateProductStatState.Time.ToString("yyyy-MM-dd") + updateProductStatState.Time.Month.ToString("00") + ((int)updateProductStatState.Time.DayOfWeek).ToString(); bool isStatRegion = BMAConfig.MallConfig.IsStatRegion == 1; string condition = string.Format("([pid]={0} AND [category]='total') OR ([pid]={0} AND [category]='year' AND [value]='{1}') OR ([pid]={0} AND [category]='month' AND [value]='{2}') OR ([pid]={0} AND [category]='day' AND [value]='{3}') OR ([pid]={0} AND [category]='hour' AND [value]='{4}') OR ([pid]={0} AND [category]='week' AND [value]='{5}'){6}", updateProductStatState.Pid, year, month, day, hour, week, isStatRegion ? string.Format(" OR ([pid]={0} AND [category]='region' AND [value]='{1}')", updateProductStatState.Pid, updateProductStatState.RegionId) : ""); if (UpdateProductStat(condition) < (isStatRegion ? 7 : 6)) { AddProductStat(updateProductStatState.Pid, "total", ""); AddProductStat(updateProductStatState.Pid, "year", year); AddProductStat(updateProductStatState.Pid, "month", month); AddProductStat(updateProductStatState.Pid, "day", day); AddProductStat(updateProductStatState.Pid, "hour", hour); AddProductStat(updateProductStatState.Pid, "week", week); if (isStatRegion) AddProductStat(updateProductStatState.Pid, "region", updateProductStatState.RegionId.ToString()); } }
/// <summary> /// 更新商品统计 /// </summary> /// <param name="state">state</param> public void UpdateProductStat(UpdateProductStatState state) { ManagedThreadPool.QueueUserWorkItem(new WaitCallback(ProductStats.UpdateProductStat), state); }