Ejemplo n.º 1
0
        /// <summary>
        /// 接口主入口
        /// </summary>
        /// <param name="context"></param>
        public override void ProcessRequest(HttpContext context)
        {
            #region 获取公共参数

            int[]                softIds   = string.IsNullOrEmpty(ThisRequest["SoftIds"]) ? new int[] { -1 } : ThisRequest["SoftIds"].Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(a => Convert.ToInt32(a)).ToArray();
            int[]                platforms = string.IsNullOrEmpty(ThisRequest["Platforms"]) ? new int[] { -1 } : ThisRequest["Platforms"].Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(a => Convert.ToInt32(a)).ToArray();
            int                  period    = string.IsNullOrEmpty(ThisRequest["Period"]) ? -1 : Convert.ToInt32(ThisRequest["Period"]);
            DateTime             startDate = string.IsNullOrEmpty(ThisRequest["StartDate"]) ? DateTime.MinValue : Convert.ToDateTime(ThisRequest["StartDate"]);
            DateTime             endDate   = string.IsNullOrEmpty(ThisRequest["EndDate"]) ? DateTime.MinValue : Convert.ToDateTime(ThisRequest["EndDate"]);
            int[]                chlIds    = string.IsNullOrEmpty(ThisRequest["ChannelIds"]) ? new int[] { -1 } : ThisRequest["ChannelIds"].Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(a => Convert.ToInt32(a)).ToArray();
            ChannelTypeOptions[] chlTypes  = string.IsNullOrEmpty(ThisRequest["ChannelTypes"]) ? new ChannelTypeOptions[] { ChannelTypeOptions.Category } : ThisRequest["ChannelTypes"].Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(a => (ChannelTypeOptions)Convert.ToInt32(a)).ToArray();
            if (chlIds.Length != chlTypes.Length)
            {
                chlIds   = new int[] { -1 };
                chlTypes = new ChannelTypeOptions[] { ChannelTypeOptions.Category };
            }

            #endregion

            //使用GB2312输出
            ThisResponse.ContentEncoding = Encoding.GetEncoding("GB2312");

            switch (ThisRequest["Action"])
            {
            case "GetRankOfSubChannels":
                GetRankOfSubChannels(softIds[0], platforms[0], period, startDate, endDate, chlIds[0]);
                break;

            case "GetRankOfVersions":
                GetRankOfVersions(softIds[0], platforms[0], period, startDate, endDate, chlIds[0], chlTypes[0]);
                break;

            case "GetRankOfAreas":
                GetRankOfAreas(softIds[0], platforms[0], period, startDate, endDate, chlIds[0], chlTypes[0]);
                break;

            case "GetStatUsersByVersionLine":
                GetStatUsersByVersionLine(softIds[0], platforms[0], period, startDate, endDate, chlIds[0], chlTypes[0]);
                break;

            case "GetStatUsersByAreaLine":
                GetStatUsersByAreaLine(softIds[0], platforms[0], period, startDate, endDate, chlIds[0], chlTypes[0]);
                break;
            }

            ThisResponse.Flush();
        }
        /// <summary>
        /// 接口主入口
        /// </summary>
        /// <param name="context"></param>
        public override void ProcessRequest(HttpContext context)
        {
            #region 获取公共参数

            int                  softId    = string.IsNullOrEmpty(ThisRequest["SoftID"]) ? -1 : Convert.ToInt32(ThisRequest["SoftID"]);
            int                  platform  = string.IsNullOrEmpty(ThisRequest["Platform"]) ? -1 : Convert.ToInt32(ThisRequest["Platform"]);
            int                  period    = string.IsNullOrEmpty(ThisRequest["Period"]) ? -1 : Convert.ToInt32(ThisRequest["Period"]);
            DateTime             startDate = string.IsNullOrEmpty(ThisRequest["StartDate"]) ? DateTime.MinValue : Convert.ToDateTime(ThisRequest["StartDate"]);
            DateTime             endDate   = string.IsNullOrEmpty(ThisRequest["EndDate"]) ? DateTime.MinValue : Convert.ToDateTime(ThisRequest["EndDate"]);
            int[]                chlIds    = string.IsNullOrEmpty(ThisRequest["ChannelIds"]) ? new int[] { -1 } : ThisRequest["ChannelIds"].Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(a => Convert.ToInt32(a)).ToArray();
            ChannelTypeOptions[] chlTypes  = string.IsNullOrEmpty(ThisRequest["ChannelTypes"]) ? new ChannelTypeOptions[] { ChannelTypeOptions.Category } : ThisRequest["ChannelTypes"].Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(a => (ChannelTypeOptions)Convert.ToInt32(a)).ToArray();
            string[]             chlTexts  = string.IsNullOrEmpty(ThisRequest["ChannelTexts"]) ? new string[] { string.Empty } : ThisRequest["ChannelTexts"].Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).ToArray();
            if (chlIds.Length != chlTypes.Length || chlIds.Length != chlTexts.Length)
            {
                chlIds   = new int[] { -1 };
                chlTypes = new ChannelTypeOptions[] { ChannelTypeOptions.Category };
                chlTexts = new string[] { string.Empty };
            }

            #endregion

            //使用GB2312输出
            ThisResponse.ContentEncoding = Encoding.GetEncoding("GB2312");

            switch (ThisRequest["Action"])
            {
            case "GetStatRetainedUsers":
                GetStatRetainedUsers(softId, platform, period, startDate, endDate, chlIds, chlTypes, chlTexts);
                break;

            case "GetStatRetainedActiveUsers":
                GetStatRetainedActiveUsers(softId, platform, startDate, endDate, chlIds, chlTypes, chlTexts);
                break;

            case "GetStatUsersByArea":
                GetStatUsersByArea(softId, platform, period, startDate, endDate, chlIds, chlTypes, chlTexts);
                break;

            case "GetStatRetainedUsersByArea":
                GetStatRetainedUsersByArea(softId, platform, period, startDate, endDate, chlIds, chlTypes, chlTexts);
                break;

            case "GetStatRetainedActiveUsersByArea":
                GetStatRetainedActiveUsersByArea(softId, platform, startDate, endDate, chlIds, chlTypes, chlTexts);
                break;

            case "GetStatUsersByVersion":
                GetStatUsersByVersion(softId, platform, period, startDate, endDate, chlIds, chlTypes, chlTexts);
                break;

            case "GetStatUsersByCountryByVersionEn":
                GetStatUsersByCountryByVersionEn(softId, platform, startDate, endDate);
                break;

            case "GetStatRetainedUsersByVersion":
                GetStatRetainedUsersByVersion(softId, platform, period, startDate, endDate, chlIds, chlTypes, chlTexts);
                break;

            case "GetStatUsersByVersionTransverse":
                GetStatUsersByVersionTransverse(softId, platform, period, startDate, endDate, chlIds, chlTypes);
                break;

            case "GetStatUsersByAreaTransverse":
                GetStatUsersByAreaTransverse(softId, platform, period, startDate, endDate, chlIds, chlTypes);
                break;
            }
            ThisResponse.Flush();
        }