public ContentResult HomeCharts(string days) { JMP.BLL.jmp_appcount bll = new JMP.BLL.jmp_appcount(); //时间 string s_time = ""; if (days == "0") { s_time = DateTime.Now.ToString("yyyy-MM-dd"); } else if (days == "1") { s_time = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"); } else if (days == "2") { s_time = DateTime.Now.AddDays(-2).ToString("yyyy-MM-dd"); } //时间 string startTime = s_time + " 00:00:00"; string endTime = s_time + " 23:59:59"; //前三日平均 string startTimeAdy = DateTime.Now.AddDays(-4).ToString("yyyy-MM-dd") + " 00:00:00"; string endTimeAdy = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd") + " 23:59:59"; //查询数据 DataSet ds = bll.DataStatisticsAdy(UserInfo.UserId, startTime, endTime, startTimeAdy, endTimeAdy); return(Content(JsonConvert.SerializeObject(new { Data = ds }), "application/json")); }
public ActionResult Index() { //每日应用汇总 JMP.BLL.jmp_appcount bll = new JMP.BLL.jmp_appcount(); JMP.MDL.jmp_appcount model = new JMP.MDL.jmp_appcount(); JMP.MDL.jmp_user sm_model = new JMP.MDL.jmp_user(); //开发者每日结算详情 JMP.BLL.CoSettlementDeveloperAppDetails cobll = new JMP.BLL.CoSettlementDeveloperAppDetails(); JMP.MDL.CoSettlementDeveloperAppDetails comodel_yesterday = new JMP.MDL.CoSettlementDeveloperAppDetails(); JMP.MDL.CoSettlementDeveloperAppDetails comodel_month = new JMP.MDL.CoSettlementDeveloperAppDetails(); JMP.MDL.CoSettlementDeveloperAppDetails comodel_preceding_month = new JMP.MDL.CoSettlementDeveloperAppDetails(); int u_id = UserInfo.UserId; JMP.BLL.jmp_user sm_bll = new JMP.BLL.jmp_user(); sm_model = sm_bll.GetModel(u_id); ViewBag.FrozenMoney = sm_model.FrozenMoney.ToString("f0"); //今天 string u_time = DateTime.Now.ToString("yyyy-MM-dd"); //昨天 string u_time_yesterday = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"); //本月 string u_time_month = DateTime.Now.ToString("yyyy-MM"); //上月 string u_time_preceding_month = DateTime.Now.AddMonths(-1).ToString("yyyy-MM"); //根据日期查询交易金额和笔数(今天) model = bll.DataAppcountAdy(u_time, u_id, 0); //根据不同日期统计查询(昨天) comodel_yesterday = cobll.GetModelKFZ_total(u_id, u_time_yesterday, 0); //根据不同日期统计查询(本月) comodel_month = cobll.GetModelKFZ_total(u_id, u_time_month, 1); //根据不同日期统计查询(上月) comodel_preceding_month = cobll.GetModelKFZ_total(u_id, u_time_preceding_month, 1); //流水及收入金额 ViewBag.comodel_yesterday = comodel_yesterday; ViewBag.comodel_month = comodel_month; ViewBag.comodel_preceding_month = comodel_preceding_month; ViewBag.AppCount = model; return(View()); }
public ContentResult HomeCharts(string days) { JMP.BLL.jmp_appcount bll = new JMP.BLL.jmp_appcount(); DataSet ds = new DataSet(); //登录用户ID int userid = UserInfo.UserId; //时间 string s_time = ""; //状态(前天昨天今天) if (days == "0") { s_time = DateTime.Now.ToString("yyyy-MM-dd"); } else if (days == "1") { s_time = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"); } else if (days == "2") { s_time = DateTime.Now.AddDays(-2).ToString("yyyy-MM-dd"); } //时间 string startTime = s_time + " 00:00:00"; string endTime = s_time + " 23:59:59"; //前三日平均 string startTimeAdy = DateTime.Now.AddDays(-4).ToString("yyyy-MM-dd") + " 00:00:00"; string endTimeAdy = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd") + " 23:59:59"; //查询数据 ds = _AppCountService.FindPagedListBp(userid, startTime, endTime, startTimeAdy, endTimeAdy); return(Content(JsonConvert.SerializeObject(new { Data = ds }), "application/json")); }
public ActionResult Default() { #region 获取用户实名认证状态信息 JMP.BLL.jmp_user sm_bll = new JMP.BLL.jmp_user(); JMP.MDL.jmp_user sm_model = new JMP.MDL.jmp_user(); int u_ids = UserInfo.Uid; //查询登录信息 sm_model = sm_bll.GetModel(u_ids); ViewBag.auditstate = sm_model.u_auditstate; ViewBag.linkEmail = sm_model.u_email; #endregion int r_id = UserInfo.UserRid; string menuStr = GetMenStr(u_ids, r_id); ViewBag.UserName = UserInfo.UserNo; ViewBag.MsgCount = sm_bll.GetUserMsgCount(u_ids); ViewBag.MenuTopStr = menuStr; ViewBag.QQ = ConfigurationManager.AppSettings["linkqq"]; ViewBag.Tel = ConfigurationManager.AppSettings["linkphone"]; //每日应用汇总 JMP.BLL.jmp_appcount bllapp = new JMP.BLL.jmp_appcount(); JMP.MDL.jmp_appcount modelapp = new JMP.MDL.jmp_appcount(); //开发者每日结算详情 JMP.BLL.CoSettlementDeveloperAppDetails cobll = new JMP.BLL.CoSettlementDeveloperAppDetails(); JMP.MDL.CoSettlementDeveloperAppDetails comodel_yesterday = new JMP.MDL.CoSettlementDeveloperAppDetails(); JMP.MDL.CoSettlementDeveloperAppDetails comodel_month = new JMP.MDL.CoSettlementDeveloperAppDetails(); JMP.MDL.CoSettlementDeveloperAppDetails comodel_preceding_month = new JMP.MDL.CoSettlementDeveloperAppDetails(); int u_id = UserInfo.UserId; //今天 string u_time = DateTime.Now.ToString("yyyy-MM-dd"); //昨天 string u_time_yesterday = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"); //本月 string u_time_month = DateTime.Now.ToString("yyyy-MM"); //上月 string u_time_preceding_month = DateTime.Now.AddMonths(-1).ToString("yyyy-MM"); //根据日期查询交易金额和笔数(今天) modelapp = bllapp.DataAppcountAdy(u_time, u_id, 0); //根据不同日期统计查询(昨天) comodel_yesterday = cobll.GetModelKFZ_total(u_id, u_time_yesterday, 0); //根据不同日期统计查询(本月) comodel_month = cobll.GetModelKFZ_total(u_id, u_time_month, 1); //根据不同日期统计查询(上月) comodel_preceding_month = cobll.GetModelKFZ_total(u_id, u_time_preceding_month, 1); //流水及收入金额 ViewBag.comodel_yesterday = comodel_yesterday; ViewBag.comodel_month = comodel_month; ViewBag.comodel_preceding_month = comodel_preceding_month; ViewBag.AppCount = modelapp; return(View()); }
public AppRequestDetector() { _appCountBll = new JMP.BLL.jmp_appcount(); }
/// <summary> /// 应用报表 /// </summary> /// <returns></returns> public ActionResult AppReport(string rtype) { #region 获取用户实名认证状态信息 JMP.BLL.jmp_user sm_bll = new JMP.BLL.jmp_user(); JMP.MDL.jmp_user sm_model = new JMP.MDL.jmp_user(); int u_ids = UserInfo.Uid; //查询登录信息 sm_model = sm_bll.GetModel(u_ids); ViewBag.auditstate = sm_model.u_auditstate; ViewBag.linkEmail = sm_model.u_email; #endregion rtype = !string.IsNullOrEmpty(rtype) ? rtype : "total"; //日期 string stime = string.IsNullOrEmpty(Request["s_begin"]) ? DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd") : Request["s_begin"]; string etime = string.IsNullOrEmpty(Request["s_end"]) ? DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd") : Request["s_end"]; //首页跳转标识 int num = string.IsNullOrEmpty(Request["start"]) ? -1 : int.Parse(Request["start"]); //账单管理跳转标识 string time = string.IsNullOrEmpty(Request["time"]) ? "" : Request["time"]; if (time != "") { stime = JMP.TOOL.DESEncrypt.Decrypt(time); etime = JMP.TOOL.DESEncrypt.Decrypt(time); } else { if (rtype == "today") { num = 0; } switch (num) { case 0: stime = DateTime.Now.ToString("yyyy-MM-dd"); etime = DateTime.Now.ToString("yyyy-MM-dd"); break; case 2: stime = DateTime.Now.ToString("yyyy-MM-01"); etime = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"); break; case 3: stime = DateTime.Now.AddMonths(-1).ToString("yyyy-MM-01"); etime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-01")).AddDays(-1).ToString("yyyy-MM-dd"); break; } } ViewBag.rtype = rtype; int pageCount = 0; int pageIndexs = string.IsNullOrEmpty(Request["curr"]) ? 1 : Int32.Parse(Request["curr"]); //当前页 int PageSize = string.IsNullOrEmpty(Request["psize"]) ? 20 : Int32.Parse(Request["psize"]); //每页显示数量 string types = string.IsNullOrEmpty(Request["s_type"]) ? "0" : Request["s_type"]; string searchKey = string.IsNullOrEmpty(Request["s_key"]) ? "" : Request["s_key"]; int sort = string.IsNullOrEmpty(Request["s_sort"]) ? 1 : int.Parse(Request["s_sort"]); string searchTotal = string.IsNullOrEmpty(Request["s_field"]) ? "" : Request["s_field"]; DataTable dt = new DataTable(); DataTable ddt = new DataTable();//用于查询总和CountSect string where = "where 1=1"; string orderby = "order by "; string BsaeDb = System.Configuration.ConfigurationManager.AppSettings["BaseDb"]; string helpUrl = System.Configuration.ConfigurationManager.AppSettings["helpUrl"].ToString(); ViewBag.helpUrl = helpUrl; #region 组装排序字段 //按日期倒序展示 if (!string.IsNullOrEmpty(searchTotal)) { if (searchTotal == "0") { orderby += "a_equipment "; } else if (searchTotal == "1") { orderby += "a_success "; } else if (searchTotal == "2") { orderby += "a_notpay "; } else if (searchTotal == "3") { orderby += "a_alipay "; } else if (searchTotal == "4") { orderby += "a_wechat "; } else { orderby += "a_time "; } } else { orderby += rtype == "total" ? "a_time " : "a_appid "; } orderby += (sort == 1 ? "desc" : "asc"); #endregion #region 查询 if (rtype == "total") { if (!string.IsNullOrEmpty(types)) { if (!string.IsNullOrEmpty(searchKey)) { switch (types) { case "0": //where += " and r_app_key like '%" + searchKey + "%'"; break; case "1": where += " and a.a_appname like '%" + searchKey + "%'"; break; case "2": where += " and b.u_realname like '%" + searchKey + "%'"; break; } } } where += " and b.u_id='" + UserInfo.UserId + "'"; where += " and a_time>='" + stime + "' and a_time<='" + etime + "' "; string sql = string.Format(@"select a_appname,a_appid, isnull(SUM(a_equipment),0) as a_equipment,a_time, isnull(SUM(a_success),0) a_success, isnull(SUM(a_notpay),0) a_notpay, isnull(SUM(a_alipay),0) a_alipay, isnull(SUM(a_wechat),0) a_wechat, isnull(SUM(a_qqwallet),0) a_qqwallet, isnull(SUM(a_count),0) a_count, isnull(SUM(a_curr),0) a_curr, isnull(SUM(a_successratio),0) a_successratio, isnull(SUM(a_arpur),0) a_arpur, isnull(SUM(a_request),0) a_request, isnull(sum(a_unionpay),0) a_unionpay, b.u_realname from jmp_appreport a left join {0}.dbo.jmp_user b on a.a_uerid=b.u_id {1} group by a_appname,b.u_realname,a_appid,a_time", BsaeDb, where); string countsql = string.Format(@"select sum(a_equipment) a_equipment,sum(a_success) a_success,SUM(a_notpay) a_notpay,sum(a_alipay) a_alipay,sum(a_wechat)a_wechat,isnull(SUM(a_qqwallet),0) a_qqwallet,sum(a_unionpay) a_unionpay, sum(a_count)a_count,SUM(a_curr)a_curr,SUM(a_request) a_request,SUM(a_successratio) a_successratio,SUM(a_arpur) a_arpur from jmp_appreport a left join {0}.dbo.jmp_user b on a.a_uerid=b.u_id {1} ", BsaeDb, where); dt = bll_report.GetLists(sql, orderby, pageIndexs, PageSize, out pageCount); ddt = bll_report.CountSect(countsql); } #endregion #region 查询今日 else if (rtype == "today") { where += " and b.u_id='" + UserInfo.UserId + "' "; where += " and a_datetime>='" + DateTime.Now.ToString("yyyy-MM-dd") + " 00:00" + "' and a_datetime<='" + DateTime.Now.ToString("yyyy-MM-dd") + " 23:59" + "' "; if (!string.IsNullOrEmpty(types)) { if (!string.IsNullOrEmpty(searchKey)) { switch (types) { case "0": //where += " and temp.t_appkey like '%" + searchKey + "%' "; break; case "1": where += " and a.a_appname like '%" + searchKey + "%'"; break; case "2": where += " and b.u_realname like '%" + searchKey + "%'"; break; } } } string r_time = DateTime.Now.ToString("yyyy-MM-dd"); string tname = GetOrderTableName(r_time); string query = string.Format(@"select a_appname,a_appid, isnull(SUM(a_equipment),0) as a_equipment,GETDATE() a_time, isnull(SUM(a_success),0) a_success, isnull(SUM(a_notpay),0) a_notpay, isnull(SUM(a_alipay),0) a_alipay, isnull(SUM(a_wechat),0) a_wechat, isnull(SUM(a_qqwallet),0) a_qqwallet, isnull(SUM(a_count),0) a_count, isnull(SUM(a_curr),0) a_curr, isnull(SUM(a_successratio),0) a_successratio, isnull(SUM(a_arpur),0) a_arpur, isnull(SUM(a_request),0) a_request, isnull(sum(a_unionpay),0) a_unionpay, b.u_realname from jmp_appcount a left join {0}.dbo.jmp_user b on a.a_uerid=b.u_id {1} group by a_appname,b.u_realname,a_appid ", BsaeDb, where); string countsql = string.Format(@"select sum(a_equipment) a_equipment,sum(a_success) a_success,SUM(a_notpay) a_notpay,sum(a_alipay) a_alipay,sum(a_wechat)a_wechat,isnull(SUM(a_qqwallet),0) a_qqwallet,sum(a_unionpay) a_unionpay, sum(a_count)a_count,SUM(a_curr)a_curr,SUM(a_request) a_request,SUM(a_successratio) a_successratio,SUM(a_arpur) a_arpur from jmp_appcount a left join {0}.dbo.jmp_user b on a.a_uerid=b.u_id {1}", BsaeDb, where); JMP.BLL.jmp_appcount bll = new JMP.BLL.jmp_appcount(); dt = bll.GetTodayList(query, orderby, pageIndexs, PageSize, out pageCount); if (dt.Rows.Count > 0) { ddt = bll.CountSect(countsql); } } #endregion ViewBag.pageIndexs = pageIndexs; ViewBag.PageSize = PageSize; ViewBag.pageCount = pageCount; ViewBag.ddt = ddt; ViewBag.rtype = rtype; ViewBag.stime = stime; ViewBag.etime = etime; return(View(dt)); }
public string BuildChart(string days, string appid) { //默认查询当天 days = !string.IsNullOrEmpty(days) ? days : "0"; #region 查询数据 //查询日期 string sDate = string.Empty; switch (days) { case "0": sDate = DateTime.Now.ToString("yyyy-MM-dd"); break; case "1": sDate = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"); break; case "2": sDate = DateTime.Now.AddDays(-2).ToString("yyyy-MM-dd"); break; } string tName = GetOrderTableName(sDate); JMP.BLL.jmp_appcount bll = new JMP.BLL.jmp_appcount(); DataSet dsAverage = new DataSet(); DataTable dt = bll.GetListDay(sDate, UserInfo.UserId); dsAverage = bll.GetListAverage(DateTime.Now.AddDays(-4).ToString("yyyy-MM-dd"), DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"), "1", UserInfo.UserId, 0); #endregion string htmls = string.Empty; if (dt.Rows.Count > 0 || dsAverage.Tables[0].Rows.Count > 0) { #region 查询有数据时才构造json数据 htmls += "{\"chart\":{\"caption\":\"\",\"numberprefix\":\"\",\"plotgradientcolor\":\"\",\"bgcolor\":\"ffffff\",\"showalternatehgridcolor\":\"0\",\"divlinecolor\":\"cccccc\",\"showvalues\":\"0\",\"showcanvasborder\":\"0\",\"canvasborderalpha\":\"0\",\"canvasbordercolor\":\"cccccc\",\"canvasborderthickness\":\"1\",\"yaxismaxvalue\":\"\",\"captionpadding\":\"50\",\"linethickness\":\"3\",\"yaxisvaluespadding\":\"30\",\"legendshadow\":\"0\",\"legendborderalpha\":\"0\",\"palettecolors\":\"#f8bd19,#008ee4,#33bdda,#e44a00,#6baa01,#583e78\",\"showborder\":\"0\",\"toolTipSepChar\":\" / \",\"formatNumberScale\":\"0\"},"; htmls += "\"categories\": ["; htmls += "{"; htmls += "\"category\": ["; //构建横坐标(每小时),今天截止当前时间的小时 int len = 24; if (days == "0") { len = int.Parse(DateTime.Now.ToString("HH")) + 1; } for (int i = 0; i < len; i++) { htmls += "{\"label\": \"" + i + "\"},"; } htmls = htmls.TrimEnd(','); htmls += "]"; htmls += "}"; htmls += "],"; htmls += "\"dataset\": ["; htmls += "{"; //htmls += "\"seriesName\": \"交易额\","; htmls += "\"seriesName\": " + (days == "3" ? "\"今天\"," : "\"前三天平均交易量\","); htmls += "\"data\": ["; string jyuser = "******"seriesName\": \"交易用户数\",\"data\": ["; string aprr = "{\"seriesName\":\"ARPPU\",\"data\": ["; //根据每小时组装数据 for (int i = 0; i <= len; i++) { bool flag = true; foreach (DataRow dr in dt.Rows) { int hours = int.Parse(DateTime.Parse(dr["a_datetime"].ToString()).ToString("HH")); if (i == hours) { flag = false; decimal jye = !string.IsNullOrEmpty(dr["a_curr"].ToString()) ? decimal.Parse(dr["a_curr"].ToString()) : 0; string sJye = jye.ToString("f2"); if (days == "3") { htmls += "{\"value\": \"" + sJye + "\",\"toolText\": \"时段交易趋势" + i + "时:交易额" + sJye + "\"},"; } decimal jyyhs = !string.IsNullOrEmpty(dr["a_success"].ToString()) ? decimal.Parse(dr["a_success"].ToString()) : 0; string sJyyhs = jyyhs.ToString("f0"); jyuser += "{\"value\": \"" + sJyyhs + "\",\"toolText\": \"时段交易趋势" + i + "时:交易用户数" + sJyyhs + "\"},"; decimal arppu = jyyhs == 0 ? 0 : jye / jyyhs; string sArppu = arppu.ToString("f2"); aprr += "{\"value\": \"" + sArppu + "\",\"toolText\": \"时段交易趋势" + i + "时:ARPPU " + sArppu + "\"},"; break; } } if (flag) { if (days == "3") { htmls += "{\"value\": \"0\",\"toolText\": \"时段交易趋势" + i + "时:交易额0\"},"; } jyuser += "{\"value\": \"0\",\"toolText\": \"时段交易趋势" + i + "时:交易用户数0\"},"; aprr += "{\"value\": \"0\",\"toolText\": \"时段交易趋势" + i + "时:ARPPU 0\"},"; } } #region 组装前三天平均交易量 if (days != "3") { //根据每小时组装数据 for (int i = 0; i < len; i++) { bool curr = true; foreach (DataRow dr in dsAverage.Tables[0].Rows) { int hours = int.Parse(dr["a_datetime"].ToString()); if (i == hours) { curr = false; htmls += "{\"value\": \"" + decimal.Parse(dr["a_success"].ToString()).ToString("f0") + "\","; htmls += "\"toolText\": \"" + (days == "3" ? "支付量走势" : "交易走势") + i + "时:" + (days == "3" ? "今天" : "平均交易量") + decimal.Parse(dr["a_success"].ToString()).ToString("f0") + "\"},"; break; } } if (curr) { htmls += "{\"value\": \"0\","; htmls += "\"toolText\": \"" + (days == "3" ? "支付量走势" : "交易走势") + i + "时:" + (days == "3" ? "今天" : "平均交易量") + "0\"},"; } } } #endregion htmls = htmls.TrimEnd(','); htmls += "]"; htmls += "},"; jyuser = jyuser.TrimEnd(','); jyuser += "]"; jyuser += "},"; aprr = aprr.TrimEnd(','); aprr += "]"; aprr += "}"; htmls = htmls + jyuser + aprr; htmls += "]"; htmls += "}"; #endregion } else { htmls = "0"; } return(htmls); }
/// <summary> /// 应用支付成功率异常监控器 /// </summary> public AppPaySuccessRatioDetector() { _appCountBll = new JMP.BLL.jmp_appcount(); }