/// <summary> /// 首页顶部 /// </summary> /// <returns></returns> public static IndexTopReport ToIndexTopReport() { IndexTopReport obj = null; ICache objCache = CacheFactory.Cache(); obj = objCache.GetCache <IndexTopReport>("IndexTopReport"); if (obj == null) { obj = new IndexTopReport(); string sql1 = "select count(distinct F_LogNo) from [T_GameLog]"; string sql2 = "select count(distinct F_LogNo) from [T_GameLog] where DateDiff(dd,F_LogTime,getdate())=0 "; string sql3 = "select sum(F_Score) from [dbo].[T_GameLog] where F_CoinType=2"; string sql4 = "select sum(F_Score) from [dbo].[T_GameLog] where F_CoinType=2 and F_WinOrLost=1"; Object objPlayerAllCount = SqlHelper.ExecuteScalar(System.Data.CommandType.Text, sql1, null).ToString(); int PlayerAllCount = 0; if (int.TryParse(objPlayerAllCount.ToString(), out PlayerAllCount)) { obj.PlayerAllCount = PlayerAllCount; } Object objPlayerCountToday = SqlHelper.ExecuteScalar(System.Data.CommandType.Text, sql2, null); int PlayerCountToday = 0; if (int.TryParse(objPlayerCountToday.ToString(), out PlayerCountToday)) { obj.PlayerCountToday = PlayerCountToday; } Object objTotalConsumeLbCount = SqlHelper.ExecuteScalar(System.Data.CommandType.Text, sql3, null); int TotalConsumeLbCount = 0; if (int.TryParse(objTotalConsumeLbCount.ToString(), out TotalConsumeLbCount)) { obj.TotalConsumeLbCount = TotalConsumeLbCount; } Object objTotalConsumeLoveBirdCount = SqlHelper.ExecuteScalar(System.Data.CommandType.Text, sql4, null); int TotalConsumeLoveBirdCount = 0; if (int.TryParse(objTotalConsumeLoveBirdCount.ToString(), out TotalConsumeLoveBirdCount)) { obj.TotalConsumeLoveBirdCount = TotalConsumeLoveBirdCount; } objCache.WriteCache <IndexTopReport>(obj, "IndexTopReport"); } return(obj); }
public ActionResult Default() { ///顶部矩形框数据 IndexTopReport data = DataReportApp.ToIndexTopReport(); ViewBag.PlayerAllCount = data.PlayerAllCount; ViewBag.PlayerCountToday = data.PlayerCountToday; ViewBag.TotalConsumeLbCount = data.TotalConsumeLbCount; ViewBag.TotalConsumeLoveBirdCount = data.TotalConsumeLoveBirdCount; //人员实时情况统计 RealTimeActivePlayerStatisticsReport rept = DataReportApp.ToIndexRealTimeActivePlayerStatisticsReport(); // rept.items var data1 = "{ " + " labels: [\"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"10\", \"11\", \"12\", \"13\", \"14\", \"15\", \"16\", \"17\", \"18\", \"19\", \"20\", \"21\", \"22\", \"23\"], " + " datasets: [ " + " { " + "label: \"My First dataset\", " + " fillColor: \"rgba(255,0,0,0.2)\", " + " strokeColor: \"rgba(255,0,0,1)\", " + " pointColor: \"rgba(255,0,0,1)\", " + " pointStrokeColor: \"#fff\", " + " pointHighlightFill: \"#fff\", " + " pointHighlightStroke: \"rgba(255,0,0,1)\", " + " data: [randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor()] " + " }, " + " { " + " label: \"My Second dataset\", " + " fillColor: \"rgba(0,255,0,0.2)\", " + " strokeColor: \"rgba(0,255,0,1)\", " + " pointColor: \"rgba(0,255,0,1)\", " + " pointStrokeColor: \"#fff\", " + " pointHighlightFill: \"#fff\", " + " pointHighlightStroke: \"rgba(0,255,0,1)\", " + " data: [randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor()] " + " }, " + " { " + " label: \"My Second dataset\", " + " fillColor: \"rgba(255,255,0,0.2)\", " + " strokeColor: \"rgba(255,255,0,1)\", " + " pointColor: \"rgba(255,255,0,1)\", " + " pointStrokeColor: \"#fff\", " + " pointHighlightFill: \"#fff\", " + " pointHighlightStroke: \"rgba(255,255,0,1)\", " + " data: [randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor()] " + " }, " + " { " + " label: \"My Second dataset\", " + " fillColor: \"rgba(151,187,205,0.2)\", " + " strokeColor: \"rgba(151,187,205,1)\", " + " pointColor: \"rgba(151,187,205,1)\", " + " pointStrokeColor: \"#fff\", " + " pointHighlightFill: \"#fff\", " + " pointHighlightStroke: \"rgba(151,187,205,1)\", " + " data: [randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor()] " + " }, " + " { " + " label: \"My Second dataset\", " + " fillColor: \"rgba(151,187,205,0.2)\", " + " strokeColor: \"rgba(151,187,205,1)\", " + " pointColor: \"rgba(151,187,205,1)\", " + " pointStrokeColor: \"#fff\", " + " pointHighlightFill: \"#fff\", " + " pointHighlightStroke: \"rgba(151,187,205,1)\", " + " data: [randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor()] " + " } " + " ] " + " }"; ViewBag.data1 = data1; return(View()); }