Example #1
0
        public void ProcessRequest(HttpContext context)
        {
            string time           = context.Request["time"];
            string moduleType     = context.Request["module_type"];
            var    list           = bllMonitor.GetMonitorStatisticsList(50, time, moduleType);
            string monitorPlanIDs = "";

            if (list.Count > 0)
            {
                monitorPlanIDs = ZentCloud.Common.MyStringHelper.ListToStr(list.Select(p => p.MonitorPlanID).ToList(), "", ",");
            }
            var locationList = new List <string> {
                "北京", "天津", "上海", "重庆", "河北", "河南", "云南", "辽宁", "黑龙江", "湖南", "安徽", "山东", "新疆", "江苏", "浙江", "江西", "湖北", "广西", "甘肃", "山西", "内蒙古", "陕西", "吉林", "福建", "贵州", "广东", "青海", "西藏", "四川", "宁夏", "海南", "台湾", "香港", "澳门"
            };
            List <dynamic> result = new List <dynamic>();
            int            max    = 0;

            foreach (var item in locationList)
            {
                int ncount = 0;
                if (list.Count > 0)
                {
                    ncount = bllMonitor.GetMonitorStatisticsLocationCount(time, moduleType, monitorPlanIDs, item);
                    if (ncount > max)
                    {
                        max = ncount;
                    }
                }
                result.Add(new
                {
                    name  = item,
                    value = ncount
                });
            }
            apiResp.result = new {
                max  = max,
                data = result
            };
            apiResp.status = true;
            apiResp.code   = (int)BLLJIMP.Enums.APIErrCode.IsSuccess;
            bllMonitor.ContextResponse(context, apiResp);
        }
Example #2
0
        public void ProcessRequest(HttpContext context)
        {
            string         mType       = context.Request["module_type"]; //访问类型
            string         dTime       = context.Request["time"];        //时间类型
            var            monitorList = bllMonitor.GetMonitorStatisticsList(50, dTime, mType);
            List <dynamic> returnList  = new List <dynamic>();

            foreach (var item in monitorList)
            {
                string title = string.Empty;
                switch (mType)
                {
                case "activity":
                case "article":
                case "greetingcard":
                    JuActivityInfo jModel = bllMonitor.Get <JuActivityInfo>(string.Format(" WebsiteOwner='{0}' AND MonitorPlanID={1} ", bllMonitor.WebsiteOwner, item.MonitorPlanID));
                    if (jModel == null)
                    {
                        continue;
                    }
                    title = jModel.ActivityName;
                    returnList.Add(new
                    {
                        id    = jModel.JuActivityID,
                        title = title,
                        count = item.tCount
                    });
                    break;

                case "product":
                    WXMallProductInfo pModel = bllMall.GetProduct(item.MonitorPlanID.ToString());
                    if (pModel == null)
                    {
                        continue;
                    }
                    title = pModel.PName;
                    returnList.Add(new
                    {
                        id    = pModel.PID,
                        title = title,
                        count = item.tCount
                    });
                    break;

                case "question":
                    Questionnaire qModel = bllMall.Get <Questionnaire>(string.Format(" WebsiteOwner='{0}' AND QuestionnaireID={1}", bllMall.WebsiteOwner, item.MonitorPlanID));
                    if (qModel == null)
                    {
                        continue;
                    }
                    title = qModel.QuestionnaireName;
                    returnList.Add(new
                    {
                        id    = qModel.QuestionnaireID,
                        title = title,
                        count = item.tCount
                    });
                    break;

                case "questionnaireset":
                    BLLJIMP.Model.QuestionnaireSet sModel = bllMall.Get <BLLJIMP.Model.QuestionnaireSet>(string.Format(" WebsiteOwner='{0}' AND AutoId={1}", bllMall.WebsiteOwner, item.MonitorPlanID));
                    if (sModel == null)
                    {
                        continue;
                    }
                    title = sModel.Title;
                    returnList.Add(new
                    {
                        id    = sModel.AutoID,
                        title = title,
                        count = item.tCount
                    });
                    break;

                case "thevote":
                    TheVoteInfo tModel = bllMall.Get <TheVoteInfo>(string.Format(" WebsiteOwner='{0}' AND AutoID={1}", bllMall.WebsiteOwner, item.MonitorPlanID));
                    if (tModel == null)
                    {
                        continue;
                    }
                    title = tModel.VoteName;
                    returnList.Add(new
                    {
                        id    = tModel.AutoId,
                        title = title,
                        count = item.tCount
                    });
                    break;

                case "scratch":
                case "shake":
                    WXLotteryV1 wModel = bllMall.Get <WXLotteryV1>(string.Format(" WebsiteOwner='{0}' AND LotteryID={1} ", bllMall.WebsiteOwner, item.MonitorPlanID));
                    if (wModel == null)
                    {
                        continue;
                    }
                    title = wModel.LotteryName;
                    returnList.Add(new
                    {
                        id    = wModel.LotteryID,
                        title = title,
                        count = item.tCount
                    });
                    break;

                case "wshow":
                    WXShowInfo xModel = bllMall.Get <WXShowInfo>(string.Format(" WebsiteOwner='{0}' AND AutoId={1}", bllMall.WebsiteOwner, item.MonitorPlanID));
                    if (xModel == null)
                    {
                        continue;
                    }
                    title = xModel.ShowName;
                    returnList.Add(new
                    {
                        id    = xModel.AutoId,
                        title = title,
                        count = item.tCount
                    });

                    break;

                default:
                    break;
                }
            }

            context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(returnList));
        }