Пример #1
0
        public List <JobAd> GetJobAds(QueryUrl url)
        {
            List <JobAd> JobAds = new List <JobAd>();

            string queryUrl = $"https://jobinja.ir/jobs?filters%5Bkeywords%5D%5B%5D=&filters%5Blocations%5D%5B%5D=%D8%AA%D9%87%D8%B1%D8%A7%D9%86&filters%5Bjob_categories%5D%5B%5D=%D9%88%D8%A8%D8%8C%E2%80%8C+%D8%A8%D8%B1%D9%86%D8%A7%D9%85%D9%87%E2%80%8C%D9%86%D9%88%DB%8C%D8%B3%DB%8C+%D9%88+%D9%86%D8%B1%D9%85%E2%80%8C%D8%A7%D9%81%D8%B2%D8%A7%D8%B1&filters[keywords][0]={url.SearchString}&page={url.PageNumber}";

            HtmlWeb      web = new HtmlWeb();
            HtmlDocument doc = web.Load(queryUrl);

            HtmlNodeCollection nodes = doc.DocumentNode.SelectNodes("//*[@id=\"js-jobSeekerSearchResult\"]/div/div[2]/section/div/ul/li");

            foreach (var node in nodes)
            {
                JobAds.Add(new JobAd()
                {
                    Title    = node.SelectSingleNode(".//div/div[1]/h3/a").InnerHtml.CleanStr(),
                    LogoUrl  = node.SelectSingleNode(".//div/div[1]/a/img").Attributes["src"].Value,
                    Company  = node.SelectSingleNode(".//div/div[1]/ul/li[1]/span").InnerHtml.CleanStr(),
                    Location = node.SelectSingleNode(".//div/div[1]/ul/li[2]/span").InnerHtml.CleanStr(),
                    Url      = node.SelectSingleNode(".//div/div[1]/h3/a").Attributes["href"].Value
                });
            }

            return(JobAds);
        }
Пример #2
0
        public void WillRemoveTagQueryParamFromUrl()
        {
            // Arrange
            var queryUrl = new QueryUrl(
                new RouteValueDictionary(),
                new QueryCollection(
                    new Dictionary <string, StringValues>
            {
                {
                    "Category",
                    new StringValues(new[] { "business" })
                },
                {
                    "tag",
                    new StringValues(new[] { "healthy" })
                }
            }
                    )
                );

            _filteredUrl.SetQueryUrl(queryUrl);

            // Act
            var newQueryUrl = _filteredUrl.WithoutTagFilter();

            newQueryUrl.ContainsKey("tag").Should().BeFalse();
        }
Пример #3
0
        public List <JobAd> GetJobAds(QueryUrl url)
        {
            List <JobAd> JobAds = new List <JobAd>();

            string queryUrl = "https://quera.ir/careers/jobs?level=I&city=T";

            HtmlWeb      web = new HtmlWeb();
            HtmlDocument doc = web.Load(queryUrl);

            HtmlNodeCollection nodes = doc.DocumentNode.SelectNodes("//*[@id=\"jobs-segment\"]/div");

            foreach (var node in nodes)
            {
                JobAds.Add(new JobAd()
                {
                    Title    = node.SelectSingleNode(".//div[2]/h2/a/text()").InnerHtml.CleanStr(),
                    LogoUrl  = "https://quera.ir/" + node.SelectSingleNode(".//div[1]/a/img").Attributes["src"].Value,
                    Company  = node.SelectNodes(".//div[2]/div[2]")[1].InnerHtml.Split('-')[0],
                    Location = node.SelectNodes(".//div[2]/div[2]")[1].InnerHtml.Split('-')[1],
                    Url      = "https://quera.ir/" + node.SelectSingleNode(".//div[2]/h2/a").Attributes["href"].Value
                });
            }

            return(JobAds);
        }
Пример #4
0
        public void WillRemoveDateFilterQueryParamFromUrl()
        {
            // Arrange
            var queryUrl = new QueryUrl(
                new RouteValueDictionary(),
                new QueryCollection(
                    new Dictionary <string, StringValues>
            {
                {
                    "DateFrom",
                    new StringValues(new[] { "irrelevant" })
                },
                {
                    "DateTo",
                    new StringValues(new[] { "irrelevant" })
                }
            }
                    )
                );

            _filteredUrl.SetQueryUrl(queryUrl);

            // Act
            var newQueryUrl = _filteredUrl.WithoutDateFilter();

            // Assert
            newQueryUrl.ContainsKey("DateFrom").Should().BeFalse();
            newQueryUrl.ContainsKey("DateTo").Should().BeFalse();
        }
Пример #5
0
        public void WillAddDateToFilterToUrl()
        {
            // Arrange
            var queryUrl = new QueryUrl(
                new RouteValueDictionary(),
                new QueryCollection(
                    new Dictionary <string, StringValues>
            {
                {
                    "tag",
                    new StringValues(new[] { "healthy" })
                }
            }
                    )
                );

            _filteredUrl.SetQueryUrl(queryUrl);

            var startDate = new DateTime(2017, 01, 01);

            // Act
            var newQueryUrl = _filteredUrl.AddMonthFilter(startDate);

            newQueryUrl.ContainsKey("dateTo").Should().BeTrue();
        }
Пример #6
0
        public List <JobAd> GetJobAds(QueryUrl url)
        {
            List <JobAd> JobAds = new List <JobAd>();

            JobAds.Add(new JobAd()
            {
                Title       = url.SearchString,
                Url         = "www.google.com",
                Description = "Description Here",
                Company     = "company name",
                LogoUrl     = "/img/logo.png",
                Location    = url.Location,
                Contract    = new string[] { "fulltime", "parttime" },
                Experience  = "experience here",
                Date        = "date added",
                Abilities   = new string[] { "c#", "sql", "javascript" }
            });

            JobAds.Add(new JobAd()
            {
                Title       = "job title2",
                Url         = "www.google.com",
                Description = "Description Here2",
                Company     = "company name2",
                LogoUrl     = "/img/logo.png",
                Location    = url.Location,
                Contract    = new string[] { "fulltime" },
                Experience  = "2 years",
                Date        = "today",
                Abilities   = new string[] { "python", "djngo", "nosql" }
            });

            return(JobAds);
        }
Пример #7
0
        public void ShouldReturnTodaysDateIfDateToIsWithinTheCurrentMonth()
        {
            var queryUrl = new QueryUrl(new RouteValueDictionary(), new QueryCollection());

            _filteredUrl.SetQueryUrl(queryUrl);

            var url = _filteredUrl.AddMonthFilter(new DateTime(2017, 02, 01));

            url["DateTo"].Should().Be(new DateTime(2017, 02, 21).ToString("yyyy-MM-dd"));
        }
Пример #8
0
        public override int GetHashCode()
        {
            int idHashCode       = Id.GetHashCode();
            int nameHashCode     = Name.GetHashCode();
            int urlHashCode      = QueryUrl.GetHashCode();
            int resultESHashCode = ResultElementSelector.GetHashCode();
            int titleESHashCode  = TitleElementSelector.GetHashCode();
            int descESHashCode   = DescElementSelector.GetHashCode();
            int linkESHashCode   = LinkElementSelector.GetHashCode();

            return(idHashCode ^ nameHashCode ^ urlHashCode ^ resultESHashCode ^ titleESHashCode ^ descESHashCode ^ linkESHashCode);
        }
Пример #9
0
        public void WillIdentifyWhenDateFilterIsNotPresent()
        {
            // Arrange
            var queryUrl = new QueryUrl(
                new RouteValueDictionary(),
                new QueryCollection(new Dictionary <string, StringValues>()
                                    ));

            _filteredUrl.SetQueryUrl(queryUrl);

            // Act
            var hasNoDatefilter = _filteredUrl.HasNoDateFilter();

            hasNoDatefilter.Should().BeTrue();
        }
Пример #10
0
        public void ShouldReturnFalseIfQueryNameIsNotInCurrentQueryParamaters()
        {
            var startingRoutesDictionary = new RouteValueDictionary()
            {
                { "name", "value" }
            };
            var mockQueryCollection = new Mock <IQueryCollection>();

            mockQueryCollection.Setup(o => o.ContainsKey("queryName")).Returns(true);
            mockQueryCollection.Setup(o => o["queryName"]).Returns("queryValue");

            var isInQueryParameters = new QueryUrl(startingRoutesDictionary, mockQueryCollection.Object).HasQueryParam("notInQueryString");

            isInQueryParameters.Should().BeFalse();
        }
Пример #11
0
        public void ShouldReturnFalseIfQueryIsInCurrentQueryParamaters()
        {
            var startingRoutesDictionary = new RouteValueDictionary()
            {
                { "name", "value" }
            };
            var mockQueryCollection = new Mock <IQueryCollection>();

            mockQueryCollection.Setup(o => o.Keys).Returns(new List <string>()
            {
                "queryName"
            });
            mockQueryCollection.Setup(o => o["queryName"]).Returns("queryValue");

            var isInQueryParameters = new QueryUrl(startingRoutesDictionary, mockQueryCollection.Object).MatchesQueryParam("currentQueryName", "currentQueryValue");

            isInQueryParameters.Should().BeFalse();
        }
Пример #12
0
        public void ShouldReturnTrueIfQueryIsInCurrentQueryParamaters()
        {
            var startingRoutesDictionary = new RouteValueDictionary()
            {
                { "name", "value" }
            };
            var          mockQueryCollection = new Mock <IQueryCollection>();
            const string existingQueryName   = "queryName";
            const string existingQueryValue  = "queryValue";

            mockQueryCollection.Setup(o => o.ContainsKey(existingQueryName)).Returns(true);
            mockQueryCollection.Setup(o => o[existingQueryName]).Returns(existingQueryValue);

            var isInQueryParameters = new QueryUrl(startingRoutesDictionary, mockQueryCollection.Object)
                                      .MatchesQueryParam(existingQueryName, existingQueryValue);

            isInQueryParameters.Should().BeTrue();
        }
Пример #13
0
        public async Task <QueryResult <Neuron> > SendQueryInternal(string queryUrl, string bearerToken, CancellationToken token = default)
        {
            QueryResult <Neuron> result = new QueryResult <Neuron>()
            {
                Items = new Neuron[0]
            };

            if (QueryUrl.TryParse(queryUrl, out QueryUrl request))
            {
                NeuronQuery query = NeuronQuery.TryParse(request.QueryString, out NeuronQuery nquery) ?
                                    nquery :
                                    new NeuronQuery();

                if (request.Id.Length > 0)
                {
                    if (request.HasRelatives)
                    {
                        // http://[avatar]/cortex/neurons/[id]/relatives/[id2]
                        if (request.Id2.Length > 0)
                        {
                            result = await this.GetNeuronByIdInternal(request.AvatarUrl, request.Id2, request.Id, query, bearerToken, token);
                        }
                        // http://[avatar]/cortex/neurons/[id]/relatives
                        else
                        {
                            result = await this.GetNeuronsInternal(request.AvatarUrl, request.Id, query, bearerToken, token);
                        }
                    }
                    else
                    {
                        // http://[avatar]/cortex/neurons/[id]
                        result = await this.GetNeuronByIdInternal(request.AvatarUrl, request.Id, query, bearerToken, token);
                    }
                }
                // http://[avatar]/cortex/neurons
                else
                {
                    result = await this.GetNeuronsInternal(request.AvatarUrl, request.Id, query, bearerToken, token);
                }
            }

            return(result);
        }
        public void BuildUrlShouldUseUrlHelperToCreateUrlWithPageQueryParamWithCorrectPageNumber()
        {
            // Arrange
            int      pageNumber = 5;
            QueryUrl queryUrl   = new QueryUrl(new RouteValueDictionary(), new QueryCollection());
            var      urlHelper  = new Mock <IUrlHelperWrapper>();

            urlHelper
            .Setup(u => u.RouteUrl(It.Is <RouteValueDictionary>(x =>
                                                                x.ContainsKey("Page") &&
                                                                x.Values.Contains(pageNumber.ToString()))))
            .Returns("this string is not relevant");

            // Act
            PaginationHelper.BuildUrl(pageNumber, queryUrl, urlHelper.Object);

            // Assert
            urlHelper.Verify();
        }
Пример #15
0
        public void ShouldRemoveQueriesFromQueryParamaters()
        {
            var startingRoutesDictionary = new RouteValueDictionary()
            {
                { "name", "value" }
            };
            var mockQueryCollection = new Mock <IQueryCollection>();

            mockQueryCollection.Setup(o => o.Keys).Returns(new List <string>()
            {
                "queryName", "anotherQueryName"
            });

            var routesDictionary = new  QueryUrl(startingRoutesDictionary, mockQueryCollection.Object).WithoutQueryParam(new List <string>()
            {
                "queryName", "anotherQueryName"
            });

            routesDictionary.Count.Should().Be(1);
            routesDictionary["name"].Should().Be("value");
        }
Пример #16
0
        public void WillPopulateDateToFilterInUrl()
        {
            var queryUrl = new QueryUrl(
                new RouteValueDictionary(),
                new QueryCollection(
                    new Dictionary <string, StringValues>
            {
                {
                    "tag",
                    new StringValues(new[] { "healthy" })
                }
            }
                    )
                );

            _filteredUrl.SetQueryUrl(queryUrl);

            var startDate   = new DateTime(2017, 01, 01);
            var newQueryUrl = _filteredUrl.AddMonthFilter(startDate);

            newQueryUrl["dateTo"].Should().Be(new DateTime(2017, 01, 31).ToString("yyyy-MM-dd"));
        }
Пример #17
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            bitmap = Image.FromFile(BQIPDConfig.Instance.BQIPDHisChartImage);
            g = Graphics.FromImage(bitmap);
            g.SmoothingMode = SmoothingMode.HighQuality;
            if (Request.QueryString == null)
            {
                g.DrawString("No Data", new Font("����", 24), new SolidBrush(Color.Black), 230, 125);
            }
            else
            {
                url = new QueryUrl(Request.QueryString.ToString());
                Draw();
                /*try
                {
                    url = new QueryUrl(Request.QueryString.ToString());
                    Draw();
                }
                catch
                {
                    g.DrawString("No Data", new Font("����", 24), new SolidBrush(Color.Black), 230, 125);
                }*/
            }

            MemoryStream stream = new MemoryStream();
            bitmap.Save(stream, ImageFormat.Png);

            Response.Clear();
            Response.ContentType = "image/png";
            Response.AddHeader("Pragma", "no-cache");
            Response.AddHeader("Cache-Control", "no-cache");
            Response.AddHeader("Expires", "0");
            Response.BinaryWrite(stream.ToArray());
            Response.Flush();
            g.Dispose();
            bitmap.Dispose();
        }
Пример #18
0
        public void WillIdentifyWhenDateFilterIsPresent()
        {
            // Arrange
            var queryUrl = new QueryUrl(
                new RouteValueDictionary(),
                new QueryCollection(
                    new Dictionary <string, StringValues>
            {
                {
                    "DateFrom",
                    new StringValues(new[] { "irrelevant" })
                }
            }
                    )
                );

            _filteredUrl.SetQueryUrl(queryUrl);

            // Act
            var hasNoDatefilter = _filteredUrl.HasNoDateFilter();

            hasNoDatefilter.Should().BeFalse();
        }
Пример #19
0
        public void WillAddCategoryFilterToUrl()
        {
            // Arrange
            var queryUrl = new QueryUrl(
                new RouteValueDictionary(),
                new QueryCollection(
                    new Dictionary <string, StringValues>
            {
                {
                    "tag",
                    new StringValues(new[] { "healthy" })
                }
            }
                    )
                );

            _filteredUrl.SetQueryUrl(queryUrl);

            // Act
            var newQueryUrl = _filteredUrl.AddCategoryFilter("business");

            newQueryUrl.ContainsKey("Category").Should().BeTrue();
        }
Пример #20
0
        public void WillIdentifyWhenCategoryFilterIsPresent()
        {
            // Arrange
            var queryUrl = new QueryUrl(
                new RouteValueDictionary(),
                new QueryCollection(
                    new Dictionary <string, StringValues>
            {
                {
                    "Category",
                    new StringValues(new[] { "business" })
                }
            }
                    )
                );

            _filteredUrl.SetQueryUrl(queryUrl);

            // Act
            var hasNoCategoryfilter = _filteredUrl.HasNoCategoryFilter();

            hasNoCategoryfilter.Should().BeFalse();
        }
Пример #21
0
        public void ShouldAddNewQueriesToQueryParamaters()
        {
            var startingRoutesDictionary = new RouteValueDictionary()
            {
                { "name", "value" }, { "a-key", "a-value" }
            };
            var mockQueryCollection = new Mock <IQueryCollection>();

            mockQueryCollection.Setup(o => o.Keys).Returns(new List <string>()
            {
                "queryName"
            });
            mockQueryCollection.Setup(o => o["queryName"]).Returns("queryValue");

            var routesDictionary = new QueryUrl(startingRoutesDictionary, mockQueryCollection.Object).AddQueriesToUrl(new Dictionary <string, string> {
                { "newQueryName", "newQueryValue" }
            });

            routesDictionary.Count.Should().Be(4);
            routesDictionary["name"].Should().Be("value");
            routesDictionary["queryName"].Should().Be("queryValue");
            routesDictionary["newQueryName"].Should().Be("newQueryValue");
            routesDictionary["a-key"].Should().Be("a-value");
        }
        /// <summary>
        /// 服务执行后
        /// </summary>
        /// <param name="actionExecutedContext"></param>
        public override async void OnActionExecuted(HttpActionExecutedContext actionExecutedContext)
        {
            try
            {
                var controller         = actionExecutedContext.ActionContext.ControllerContext.Controller;
                var unitOfWorkProperty = controller.GetType().BaseType.GetField("_UnitOfWorks", System.Reflection.BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public);
                var unitOfWorkDict     = (Dictionary <string, IUnitOfWork>)unitOfWorkProperty.GetValue(controller);

                var            serviceContextProperty = controller.GetType().BaseType.GetProperty("ServiceContext", System.Reflection.BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public);
                ServiceContext serviceContext         = serviceContextProperty.GetValue(controller) as ServiceContext;

                string fuWuCsStr = await actionExecutedContext.ActionContext.Request.Content.ReadAsStringAsync();

                // 获取服务完整地址信息
                string serviceUri = actionExecutedContext.ActionContext.Request.RequestUri.ToString();

                // 获取服务信息
                string pathAndQuery = actionExecutedContext.ActionContext.Request.RequestUri.PathAndQuery;
                string server       = actionExecutedContext.ActionContext.Request.RequestUri.Host;
                string port         = actionExecutedContext.ActionContext.Request.RequestUri.Port.ToString();
                string moKuaiMc     = pathAndQuery.Split('/')[1];
                string yeWuMc       = pathAndQuery.Split('/')[2];
                string caoZuoMc     = pathAndQuery.Split('/')[3];

                StringBuilder sqlLogText = new StringBuilder();

                //ESLog eSLog = new ESLog();
                StringBuilder stringBuilder = new StringBuilder();

                #region 记录调用日志

                // 记录日志=====================================================================
                try
                {
                    SysLogEntity logEntity = new SysLogEntity();
                    logEntity.RiZhiID      = Guid.NewGuid().ToString();
                    logEntity.ChuangJianSj = DateTime.Now.ToInvariantString("yyyy/MM/dd HH:mm:ss");
                    logEntity.RiZhiBt      = serviceContext.USERNAME + "[" + serviceContext.USERID + "]成功调用了[" + moKuaiMc + "/" + yeWuMc + "/" + caoZuoMc + "]服务。";

                    stringBuilder.AppendLine(serviceContext.USERNAME + "[" + serviceContext.USERID + "]成功调用了[" + server + ":" + port + "端口上的" + serviceUri + "]服务。");

                    stringBuilder.AppendLine();
                    stringBuilder.AppendLine("参数列表:");
                    // 服务参数
                    var fuWuCsList = QueryUrl.GetData(fuWuCsStr);
                    foreach (var item in fuWuCsList)
                    {
                        stringBuilder.AppendLine(item.Key + "=" + Uri.UnescapeDataString(item.Value).DecompressString());
                    }

                    try
                    {
                        var res = await actionExecutedContext.Response.Content.ReadAsStringAsync();

                        ServiceResult serviceResult = JsonUtil.DeserializeToObject <ServiceResult>(res);
                        serviceResult.ReturnCode       = serviceResult.ReturnCode.DecompressString();
                        serviceResult.ReturnMessage    = serviceResult.ReturnMessage.DecompressString();
                        serviceResult.ExceptionContent = serviceResult.ExceptionContent.DecompressString();
                        serviceResult.Content          = serviceResult.Content.DecompressString();

                        stringBuilder.AppendLine("返回内容:");
                        stringBuilder.AppendLine(JsonUtil.SerializeObject(serviceResult));
                    }
                    catch (Exception ex)
                    {
                        stringBuilder.AppendLine("返回内容:无,信息:" + ex.ToString());
                    }



                    logEntity.RiZhiNr   = stringBuilder.ToString();
                    logEntity.FuWuMc    = moKuaiMc + "/" + yeWuMc + "/" + caoZuoMc;
                    logEntity.QingQiuLy = serviceContext.DANGQIANCKMC;
                    // 日志类型:1.菜单打开,2.客户端异常,3.服务调用,4服务端异常,5.SQL日志,6.性能日志
                    logEntity.RiZhiLx      = 3;
                    logEntity.YINGYONGID   = serviceContext.YINGYONGID;
                    logEntity.XITONGID     = serviceContext.XITONGID;
                    logEntity.YINGYONGMC   = serviceContext.YINGYONGMC;
                    logEntity.YINGYONGJC   = serviceContext.YINGYONGJC;
                    logEntity.VERSION      = serviceContext.VERSION;
                    logEntity.IP           = serviceContext.IP;
                    logEntity.MAC          = serviceContext.MAC;
                    logEntity.COMPUTERNAME = serviceContext.COMPUTERNAME;
                    logEntity.USERNAME     = serviceContext.USERNAME;
                    logEntity.USERID       = serviceContext.USERID;
                    logEntity.KESHIID      = serviceContext.KESHIID;
                    logEntity.KESHIMC      = serviceContext.KESHIMC;
                    logEntity.BINGQUID     = serviceContext.BINGQUID;
                    logEntity.BINGQUMC     = serviceContext.BINGQUMC;
                    logEntity.JIUZHENKSID  = serviceContext.JIUZHENKSID;
                    logEntity.JIUZHENKSMC  = serviceContext.JiuZhenKSMC;
                    logEntity.YUANQUID     = serviceContext.YUANQUID;
                    logEntity.GONGZUOZID   = serviceContext.GONGZUOZID;
                    //eSLog.PutLog(logEntity);
                    LogHelper.Intance.PutSysInfoLog(logEntity);
                    // 记录日志=====================================================================
                }
                catch (Exception e)
                {
                    LocalLog.WriteLog(this.GetType(), e);
                }

                #endregion

                List <string> unitOfWorkKeys = new List <string>(unitOfWorkDict.Keys);
                for (int i = 0; i < unitOfWorkDict.Values.Count; i++)
                {
                    IUnitOfWork unitOfWork = unitOfWorkDict[unitOfWorkKeys[i]];

                    #region 记录SQL日志

                    try
                    {
                        // 记录日志=====================================================================
                        if (!string.IsNullOrWhiteSpace(unitOfWork.SqlLog.ToString()))
                        {
                            sqlLogText.AppendLine(unitOfWork.SqlLog.ToString());

                            SysLogEntity sqlLogEntity = new SysLogEntity();
                            sqlLogEntity.RiZhiID      = Guid.NewGuid().ToString();
                            sqlLogEntity.ChuangJianSj = DateTime.Now.ToInvariantString("yyyy/MM/dd HH:mm:ss");
                            sqlLogEntity.RiZhiBt      = "[" + moKuaiMc + "/" + yeWuMc + "/" + caoZuoMc + "]服务运行期间的SQL记录。";
                            sqlLogEntity.RiZhiNr      = unitOfWork.SqlLog.ToString();

                            sqlLogEntity.FuWuMc    = moKuaiMc + "/" + yeWuMc + "/" + caoZuoMc;
                            sqlLogEntity.QingQiuLy = serviceContext.DANGQIANCKMC;
                            // 日志类型:1.菜单打开,2.客户端异常,3.服务调用,4服务端异常,5.SQL日志,6.性能日志
                            sqlLogEntity.RiZhiLx = 5;

                            sqlLogEntity.YINGYONGID   = serviceContext.YINGYONGID;
                            sqlLogEntity.XITONGID     = serviceContext.XITONGID;
                            sqlLogEntity.YINGYONGMC   = serviceContext.YINGYONGMC;
                            sqlLogEntity.YINGYONGJC   = serviceContext.YINGYONGJC;
                            sqlLogEntity.VERSION      = serviceContext.VERSION;
                            sqlLogEntity.IP           = serviceContext.IP;
                            sqlLogEntity.MAC          = serviceContext.MAC;
                            sqlLogEntity.COMPUTERNAME = serviceContext.COMPUTERNAME;
                            sqlLogEntity.USERNAME     = serviceContext.USERNAME;
                            sqlLogEntity.USERID       = serviceContext.USERID;
                            sqlLogEntity.KESHIID      = serviceContext.KESHIID;
                            sqlLogEntity.KESHIMC      = serviceContext.KESHIMC;
                            sqlLogEntity.BINGQUID     = serviceContext.BINGQUID;
                            sqlLogEntity.BINGQUMC     = serviceContext.BINGQUMC;
                            sqlLogEntity.JIUZHENKSID  = serviceContext.JIUZHENKSID;
                            sqlLogEntity.JIUZHENKSMC  = serviceContext.JiuZhenKSMC;
                            sqlLogEntity.YUANQUID     = serviceContext.YUANQUID;
                            sqlLogEntity.GONGZUOZID   = serviceContext.GONGZUOZID;
                            //eSLog.PutLog(sqlLogEntity);
                            LogHelper.Intance.PutSysInfoLog(sqlLogEntity);
                        }
                    }
                    catch (Exception e)
                    {
                        LocalLog.WriteLog(this.GetType(), e);
                    }
                    // 记录日志=====================================================================

                    #endregion

                    //try
                    //{
                    //    unitOfWork.MessagePlugin?.Handler();
                    //}
                    //catch (Exception e)
                    //{
                    //    Enterprise.Log.LogHelper.Intance.Error("业务插件",e.Message, JsonUtil.SerializeObject(e));
                    //}

                    try
                    {
                        // 是否发送
                        if (unitOfWork != null && unitOfWork.CurrentMessager.IsPublish)
                        {
                            unitOfWork.CurrentMessager.Context = serviceContext;

                            unitOfWork.CurrentMessager.MoKuaiMc = moKuaiMc;
                            unitOfWork.CurrentMessager.YeWuMc   = yeWuMc;
                            unitOfWork.CurrentMessager.CaoZuoMc = caoZuoMc;

                            // 发送消息
                            using (var client = MessageQueueClientFactory.CreateDbClient())
                            {
                                client.Publish(moKuaiMc, yeWuMc, caoZuoMc, unitOfWork.CurrentMessager);
                            }

                            //是否需要推送消息处理日志
                            bool tuiSong = unitOfWork.CurrentMessager.EntityNameList.ToList().Exists(d => Messager.DaiJianCeSTList.Contains(d));

                            // 将发送的消息异步记录到ES
                            // 需要先将消息内容序列化,否则异步序列化会因部分对象已释放而报错
                            string riZhiNr = JsonConvert.SerializeObject(unitOfWork.CurrentMessager);
                            string id      = unitOfWork.CurrentMessager.ID;
                            await Task.Factory.StartNew(() =>
                            {
                                LogHelper.Intance.Info("消息发送", "消息发送成功", riZhiNr, id);

                                if (tuiSong)
                                {
                                    dynamic obj = new System.Dynamic.ExpandoObject(); //动态类型字段 可读可写
                                    obj.ID      = id;
                                    obj.Status  = 0;                                  //0表示未处理
                                    obj.ChuLiSJ = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                                    LogHelper.Intance.Info("消息处理", "消息处理完毕", JsonConvert.SerializeObject(obj), id);
                                }
                            });
                        }
                    }
                    catch (Exception ex)
                    {
                        // 发送消息队列失败
                        throw ex;
                    }
                    finally
                    {
                        if (unitOfWork != null)
                        {
                            unitOfWork.Dispose();
                            unitOfWork = null;
                        }
                        unitOfWork = null;
                    }
                }
                unitOfWorkDict.Clear();

                var requestContextCacheProperty = controller.GetType().BaseType.GetField("_RequestContextCache", System.Reflection.BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public);
                if (requestContextCacheProperty != null)
                {
                    var requestContextCacheObj = requestContextCacheProperty.GetValue(controller);
                    if (requestContextCacheObj != null)
                    {
                        var requestContextCache = (ContextCache)requestContextCacheObj;
                        requestContextCache.Clear();
                        requestContextCache.Dispose();
                        requestContextCache = null;
                    }
                }

                // 记录服务调用耗时日志
                var ServiceStartTimeProperty = controller.GetType().BaseType.GetField("_ServiceStartTime", System.Reflection.BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public);
                if (ServiceStartTimeProperty != null)
                {
                    var ServiceStartTimeObj = ServiceStartTimeProperty.GetValue(controller);
                    if (ServiceStartTimeObj != null)
                    {
                        var      serviceStartTime = (long)ServiceStartTimeObj;
                        long     nowTicks         = DateTime.Now.Ticks;
                        DateTime dateTime         = new DateTime(nowTicks - serviceStartTime);
                        float    haoShi           = (float)Math.Round((decimal)((nowTicks - serviceStartTime) / 10000000d), 4);

                        SysLogEntity logTimeEntity = new SysLogEntity
                        {
                            RiZhiID      = Guid.NewGuid().ToString(),
                            ChuangJianSj = DateTime.Now.ToInvariantString("yyyy/MM/dd HH:mm:ss"),
                            RiZhiBt      = serviceContext.USERNAME + "[" + serviceContext.USERID + "]调用[" + moKuaiMc + "/" + yeWuMc + "/" + caoZuoMc + "]服务,总耗时:" + haoShi + "秒。",
                            RiZhiNr      = "[服务调用耗时:" + haoShi + "秒] " + stringBuilder.ToString() + sqlLogText.ToString(),
                            FuWuHs       = haoShi, // 添加耗时
                            FuWuMc       = moKuaiMc + "/" + yeWuMc + "/" + caoZuoMc,
                            QingQiuLy    = serviceContext.DANGQIANCKMC,
                            // 日志类型:1.菜单打开,2.客户端异常,3.服务调用,4服务端异常,5.SQL日志,6.性能日志
                            RiZhiLx      = 6,
                            YINGYONGID   = serviceContext.YINGYONGID,
                            XITONGID     = serviceContext.XITONGID,
                            YINGYONGMC   = serviceContext.YINGYONGMC,
                            YINGYONGJC   = serviceContext.YINGYONGJC,
                            VERSION      = serviceContext.VERSION,
                            IP           = serviceContext.IP,
                            MAC          = serviceContext.MAC,
                            COMPUTERNAME = serviceContext.COMPUTERNAME,
                            USERNAME     = serviceContext.USERNAME,
                            USERID       = serviceContext.USERID,
                            KESHIID      = serviceContext.KESHIID,
                            KESHIMC      = serviceContext.KESHIMC,
                            BINGQUID     = serviceContext.BINGQUID,
                            BINGQUMC     = serviceContext.BINGQUMC,
                            JIUZHENKSID  = serviceContext.JIUZHENKSID,
                            JIUZHENKSMC  = serviceContext.JiuZhenKSMC,
                            YUANQUID     = serviceContext.YUANQUID,
                            GONGZUOZID   = serviceContext.GONGZUOZID
                        };
                        //eSLog.PutLog(logTimeEntity);
                        LogHelper.Intance.PutSysInfoLog(logTimeEntity);
                    }
                }
            }
            catch (Exception ex)
            {
                var            controller             = actionExecutedContext.ActionContext.ControllerContext.Controller;
                var            serviceContextProperty = controller.GetType().BaseType.GetProperty("ServiceContext", System.Reflection.BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public);
                ServiceContext serviceContext         = serviceContextProperty.GetValue(controller) as ServiceContext;
                // 本地日志
                LogHelper.Intance.Error("系统日志", "ApiActionFilterAttribute处理OnActionExecuted报错", "ApiActionFilterAttribute处理OnActionExecuted报错:" + ex.ToString() + "\r\n" + JsonUtil.SerializeObject(serviceContext));
            }
            base.OnActionExecuted(actionExecutedContext);
        }
Пример #23
0
 public IActionResult QueraResult(QueryUrl url)
 {
     ViewData["website"] = "Quera";
     return(PartialView("_adPartial", _parserFactory.GetParsers()[0].GetJobAds(url)));
 }
Пример #24
0
        public IActionResult Index()
        {
            QueryUrl url = new QueryUrl();

            return(View(url));
        }
        /// <summary>
        /// 异常拦截
        /// </summary>
        /// <param name="actionExecutedContext"></param>
        public override async void OnException(HttpActionExecutedContext actionExecutedContext)
        {
            StringBuilder sqlLogText = new StringBuilder();

            try
            {
                var controller         = actionExecutedContext.ActionContext.ControllerContext.Controller;
                var unitOfWorkProperty = controller.GetType().BaseType.GetField("_UnitOfWorks", System.Reflection.BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public);
                var unitOfWorkDict     = (Dictionary <string, IUnitOfWork>)unitOfWorkProperty.GetValue(controller);

                var            serviceContextProperty = controller.GetType().BaseType.GetProperty("ServiceContext", System.Reflection.BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public);
                ServiceContext serviceContext         = serviceContextProperty.GetValue(controller) as ServiceContext;

                string fuWuCsStr = await actionExecutedContext.ActionContext.Request.Content.ReadAsStringAsync();

                // 获取服务信息
                string pathAndQuery = actionExecutedContext.ActionContext.Request.RequestUri.PathAndQuery;
                string moKuaiMc     = pathAndQuery.Split('/')[1];
                string yeWuMc       = pathAndQuery.Split('/')[2];
                string caoZuoMc     = pathAndQuery.Split('/')[3];


                //ESLog eSLog = new ESLog();


                List <string> unitOfWorkKeys = new List <string>(unitOfWorkDict.Keys);
                for (int i = 0; i < unitOfWorkDict.Values.Count; i++)
                {
                    IUnitOfWork unitOfWork = unitOfWorkDict[unitOfWorkKeys[i]];
                    try
                    {
                        #region 记录SQL日志

                        // 记录日志=====================================================================
                        if (!string.IsNullOrWhiteSpace(unitOfWork.SqlLog.ToString()))
                        {
                            sqlLogText.AppendLine(unitOfWork.SqlLog.ToString());

                            SysLogEntity sqlLogEntity = new SysLogEntity();
                            sqlLogEntity.RiZhiID      = Guid.NewGuid().ToString();
                            sqlLogEntity.ChuangJianSj = DateTime.Now.ToInvariantString("yyyy/MM/dd HH:mm:ss");
                            sqlLogEntity.RiZhiBt      = "[" + moKuaiMc + "/" + yeWuMc + "/" + caoZuoMc + "]服务运行期间的SQL记录。";
                            sqlLogEntity.RiZhiNr      = unitOfWork.SqlLog.ToString();

                            sqlLogEntity.FuWuMc    = moKuaiMc + "/" + yeWuMc + "/" + caoZuoMc;
                            sqlLogEntity.QingQiuLy = serviceContext.DANGQIANCKMC;
                            // 日志类型:1.菜单打开,2.客户端异常,3.服务调用,4服务端异常,5.SQL日志,6.性能日志
                            sqlLogEntity.RiZhiLx = 5;

                            sqlLogEntity.YINGYONGID   = serviceContext.YINGYONGID;
                            sqlLogEntity.XITONGID     = serviceContext.XITONGID;
                            sqlLogEntity.YINGYONGMC   = serviceContext.YINGYONGMC;
                            sqlLogEntity.YINGYONGJC   = serviceContext.YINGYONGJC;
                            sqlLogEntity.VERSION      = serviceContext.VERSION;
                            sqlLogEntity.IP           = serviceContext.IP;
                            sqlLogEntity.MAC          = serviceContext.MAC;
                            sqlLogEntity.COMPUTERNAME = serviceContext.COMPUTERNAME;
                            sqlLogEntity.USERNAME     = serviceContext.USERNAME;
                            sqlLogEntity.USERID       = serviceContext.USERID;
                            sqlLogEntity.KESHIID      = serviceContext.KESHIID;
                            sqlLogEntity.KESHIMC      = serviceContext.KESHIMC;
                            sqlLogEntity.BINGQUID     = serviceContext.BINGQUID;
                            sqlLogEntity.BINGQUMC     = serviceContext.BINGQUMC;
                            sqlLogEntity.JIUZHENKSID  = serviceContext.JIUZHENKSID;
                            sqlLogEntity.JIUZHENKSMC  = serviceContext.JiuZhenKSMC;
                            sqlLogEntity.YUANQUID     = serviceContext.YUANQUID;
                            sqlLogEntity.GONGZUOZID   = serviceContext.GONGZUOZID;
                            //eSLog.PutLog(sqlLogEntity);
                            LogHelper.Intance.PutSysInfoLog(sqlLogEntity);
                        }
                        // 记录日志=====================================================================

                        #endregion
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                    finally
                    {
                        unitOfWork.Rollback();
                        unitOfWork.Dispose();
                        unitOfWork = null;
                    }
                }
                unitOfWorkKeys.Clear();

                #region 记录日志

                // 记录日志=====================================================================

                SysLogEntity logEntity = new SysLogEntity();
                logEntity.RiZhiID      = Guid.NewGuid().ToString();
                logEntity.ChuangJianSj = DateTime.Now.ToInvariantString("yyyy/MM/dd HH:mm:ss");
                logEntity.RiZhiBt      = serviceContext.USERNAME + "[" + serviceContext.USERID + "]调用[" + moKuaiMc + "/" + yeWuMc + "/" + caoZuoMc + "]服务发生错误。";
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.AppendLine(serviceContext.USERNAME + "[" + serviceContext.USERID + "]调用[" + moKuaiMc + "/" + yeWuMc + "/" + caoZuoMc + "]服务发生错误。");
                stringBuilder.AppendLine();
                stringBuilder.AppendLine("参数列表:");
                // 服务参数
                var fuWuCsList = QueryUrl.GetData(fuWuCsStr);
                foreach (var item in fuWuCsList)
                {
                    stringBuilder.AppendLine(item.Key + "=" + Uri.UnescapeDataString(item.Value).DecompressString());
                }
                stringBuilder.AppendLine();
                stringBuilder.AppendLine("异常信息:");

                if (actionExecutedContext.Exception is BaseException)
                {
                    var exct = (BaseException)actionExecutedContext.Exception;
                    stringBuilder.Append(exct.ErrorMessage);
                }

                stringBuilder.AppendLine(actionExecutedContext.Exception.ToString());
                stringBuilder.AppendLine("异常信息Json:");
                try
                {
                    stringBuilder.AppendLine(JsonUtil.SerializeObject(actionExecutedContext.Exception));
                }
                catch (Exception ex)
                {
                    stringBuilder.Append("转换json日志时发生错误:" + ex.ToString());
                }

                stringBuilder.AppendLine("SQL日志:");
                stringBuilder.AppendLine(sqlLogText.ToString());

                logEntity.RiZhiNr   = stringBuilder.ToString();
                logEntity.FuWuMc    = moKuaiMc + "/" + yeWuMc + "/" + caoZuoMc;
                logEntity.QingQiuLy = serviceContext.DANGQIANCKMC;
                // 日志类型:1.菜单打开,2.客户端异常,3.服务调用,4服务端异常,5.SQL日志,6.性能日志
                logEntity.RiZhiLx      = 4;
                logEntity.YINGYONGID   = serviceContext.YINGYONGID;
                logEntity.XITONGID     = serviceContext.XITONGID;
                logEntity.YINGYONGMC   = serviceContext.YINGYONGMC;
                logEntity.YINGYONGJC   = serviceContext.YINGYONGJC;
                logEntity.VERSION      = serviceContext.VERSION;
                logEntity.IP           = serviceContext.IP;
                logEntity.MAC          = serviceContext.MAC;
                logEntity.COMPUTERNAME = serviceContext.COMPUTERNAME;
                logEntity.USERNAME     = serviceContext.USERNAME;
                logEntity.USERID       = serviceContext.USERID;
                logEntity.KESHIID      = serviceContext.KESHIID;
                logEntity.KESHIMC      = serviceContext.KESHIMC;
                logEntity.BINGQUID     = serviceContext.BINGQUID;
                logEntity.BINGQUMC     = serviceContext.BINGQUMC;
                logEntity.JIUZHENKSID  = serviceContext.JIUZHENKSID;
                logEntity.JIUZHENKSMC  = serviceContext.JiuZhenKSMC;
                logEntity.YUANQUID     = serviceContext.YUANQUID;
                logEntity.GONGZUOZID   = serviceContext.GONGZUOZID;
                //eSLog.PutLog(logEntity);
                LogHelper.Intance.PutSysErrorLog(logEntity);
                // 记录日志=====================================================================

                #endregion

                var requestContextCacheProperty = controller.GetType().BaseType.GetField("_RequestContextCache", System.Reflection.BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public);
                if (requestContextCacheProperty != null)
                {
                    var requestContextCacheObj = requestContextCacheProperty.GetValue(controller);
                    if (requestContextCacheObj != null)
                    {
                        var requestContextCache = (ContextCache)requestContextCacheObj;
                        requestContextCache.Clear();
                        requestContextCache.Dispose();
                        requestContextCache = null;
                    }
                }

                // 如果截获异常为我们自定义,可以处理的异常则通过我们自己的规则处理
                ServiceResult serviceResult = new ServiceResult("-1", "服务器发生未知错误!", "服务器发生未知错误!");
                if (actionExecutedContext.Exception is ApplicationException)
                {
                    serviceResult = new ServiceResult("-1", actionExecutedContext.Exception.Message, actionExecutedContext.Exception.ToString() + "\n" + sqlLogText);
                }
                if (actionExecutedContext.Exception is UnauthorizedException)
                {
                    serviceResult = new ServiceResult("-5", actionExecutedContext.Exception.Message, actionExecutedContext.Exception.ToString() + "\n" + sqlLogText);
                }
                else if (actionExecutedContext.Exception is ServiceException)
                {
                    var exception = (ServiceException)actionExecutedContext.Exception;
                    serviceResult = new ServiceResult(exception.ErrorCode.ToString(), exception.ErrorMessage, JsonUtil.SerializeObject(actionExecutedContext.Exception) + "\n" + sqlLogText);
                }
                else if (actionExecutedContext.Exception is BaseException)
                {
                    var exception = (BaseException)actionExecutedContext.Exception;
                    serviceResult = new ServiceResult(exception.ErrorCode.ToString(), exception.ErrorMessage, JsonUtil.SerializeObject(actionExecutedContext.Exception) + "\n" + sqlLogText);
                }

                else
                {
                    serviceResult = new ServiceResult("-1", actionExecutedContext.Exception.Message, JsonUtil.SerializeObject(actionExecutedContext.Exception) + "\n" + sqlLogText);
                }

                // 记录服务调用耗时日志
                var ServiceStartTimeProperty = controller.GetType().BaseType.GetField("_ServiceStartTime", System.Reflection.BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public);
                if (ServiceStartTimeProperty != null)
                {
                    var ServiceStartTimeObj = ServiceStartTimeProperty.GetValue(controller);
                    if (ServiceStartTimeObj != null)
                    {
                        var      serviceStartTime = (long)ServiceStartTimeObj;
                        long     nowTicks         = DateTime.Now.Ticks;
                        DateTime dateTime         = new DateTime(nowTicks - serviceStartTime);
                        float    haoShi           = (float)Math.Round((decimal)((nowTicks - serviceStartTime) / 10000000d), 4);

                        SysLogEntity logTimeEntity = new SysLogEntity
                        {
                            RiZhiID      = Guid.NewGuid().ToString(),
                            ChuangJianSj = DateTime.Now.ToInvariantString("yyyy/MM/dd HH:mm:ss"),
                            RiZhiBt      = serviceContext.USERNAME + "[" + serviceContext.USERID + "]调用[" + moKuaiMc + "/" + yeWuMc + "/" + caoZuoMc + "]服务,总耗时:" + haoShi + "秒。",
                            RiZhiNr      = "[服务调用耗时:" + haoShi + "秒] " + stringBuilder.ToString() + sqlLogText.ToString(),
                            FuWuHs       = haoShi, // 添加耗时
                            FuWuMc       = moKuaiMc + "/" + yeWuMc + "/" + caoZuoMc,
                            QingQiuLy    = serviceContext.DANGQIANCKMC,
                            // 日志类型:1.菜单打开,2.客户端异常,3.服务调用,4服务端异常,5.SQL日志,6.性能日志
                            RiZhiLx      = 6,
                            YINGYONGID   = serviceContext.YINGYONGID,
                            XITONGID     = serviceContext.XITONGID,
                            YINGYONGMC   = serviceContext.YINGYONGMC,
                            YINGYONGJC   = serviceContext.YINGYONGJC,
                            VERSION      = serviceContext.VERSION,
                            IP           = serviceContext.IP,
                            MAC          = serviceContext.MAC,
                            COMPUTERNAME = serviceContext.COMPUTERNAME,
                            USERNAME     = serviceContext.USERNAME,
                            USERID       = serviceContext.USERID,
                            KESHIID      = serviceContext.KESHIID,
                            KESHIMC      = serviceContext.KESHIMC,
                            BINGQUID     = serviceContext.BINGQUID,
                            BINGQUMC     = serviceContext.BINGQUMC,
                            JIUZHENKSID  = serviceContext.JIUZHENKSID,
                            JIUZHENKSMC  = serviceContext.JiuZhenKSMC,
                            YUANQUID     = serviceContext.YUANQUID,
                            GONGZUOZID   = serviceContext.GONGZUOZID
                        };
                        //eSLog.PutLog(logTimeEntity);
                        LogHelper.Intance.PutSysInfoLog(logTimeEntity);
                    }
                }

                actionExecutedContext.Response =
                    actionExecutedContext.Request.CreateResponse(HttpStatusCode.OK,
                                                                 serviceResult);
            }
            catch (Exception ex)
            {
                try
                {
                    // 返回错误信息,并向客户端传递错误
                    var            controller             = actionExecutedContext.ActionContext.ControllerContext.Controller;
                    var            serviceContextProperty = controller.GetType().BaseType.GetProperty("ServiceContext", System.Reflection.BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public);
                    ServiceContext serviceContext         = serviceContextProperty.GetValue(controller) as ServiceContext;

                    var serviceResult = new ServiceResult("-1", actionExecutedContext.Exception.Message + "ApiExceptionFilterAttribute处理OnException报错:" + ex.Message, JsonUtil.SerializeObject(actionExecutedContext.Exception) + "\n" + JsonUtil.SerializeObject(ex) + "\n" + sqlLogText);

                    actionExecutedContext.Response =
                        actionExecutedContext.Request.CreateResponse(HttpStatusCode.OK,
                                                                     serviceResult);
                    // 本地日志
                    LogHelper.Intance.Error("系统日志", "ApiExceptionFilterAttribute处理OnException报错", "ApiActionFilterAttribute处理OnActionExecuted报错:" + ex.ToString() + "\r\n" + JsonUtil.SerializeObject(serviceContext));
                }
                catch (Exception iex)
                {
                    // 增加捕获异常的异常的处理
                    LogHelper.Intance.Error("ApiExceptionFilterAttribute", "ApiExceptionFilterAttribute处理OnException报错,在异常处理中再次报错", "直接异常:" + ex.ToString() + ";捕获处理异常:" + iex.ToString());
                }
            }
        }
 public void AddQueryUrl(QueryUrl queryUrl)
 {
     CurrentUrl = queryUrl;
 }
 public override int GetHashCode()
 {
     return(QueryUrl.GetHashCode() ^ string.Join("", IncludeKeywords).GetHashCode() ^ string.Join("", ExcludeKeywords).GetHashCode());
 }
Пример #28
0
        /// <summary>
        /// �������ƹ����
        /// </summary>
        /// <returns></returns>
        private string BQIPD()
        {
            /*if (Request.UrlReferrer == null)
            {
                return "�Ƿ�����";
            }

            if (Request.UrlReferrer.Host != Request.Url.Host)
            {
                return "�Ƿ�����";
            }*/

            string url = "";
            string keywords = "";

            if (Request.Form["u"] == null || Request.Form["q"] == null)
            {
                return "ȱ�����������";
            }

            keywords = Request.Form["q"].Trim();
            url = Request.Form["u"].Trim();

            QueryUrl qUrl = null;

            try
            {
                qUrl = new QueryUrl(url);
            }
            catch
            {
                return "��֧�� " + url  + " �ĸ�ʽ��";
            }

            BQIPDQuery query = new BQIPDQuery(QueryType.PRKA, qUrl, keywords);
            BQIPDQueryResult result = null;

            try
            {
                result = query.Query();
            }
            catch
            {
                return "��Ϲ����г��ִ���������";
            }

            return BQIPDConclusion.GetConclusionXML(result);
        }