コード例 #1
0
ファイル: HotelCommService.cs プロジェクト: JPomichael/IPOW
 /// <summary>
 /// Gets the hotel comm by id.
 /// </summary>
 /// <param name="hid">The hid.</param>
 /// <param name="cid">The cid.</param>
 /// <param name="pi">The pi.</param>
 /// <param name="type">The type.0是全部,1是好,2是中,3是差,4是带图片的。</param>
 /// <returns></returns>
 public iPow.Application.Union.Dto.HotelCommListDto GetHotelCommById(string hid, string cid, string pi = "1", string type = "0")
 {
     //http://data.128uu.com/data/hotel_dianpinglist/?hotelid=658&cid=21&px=1&type=1&agent_id=112935&agent_md=O81U21UM11.html
     iPow.Application.Union.Dto.HotelCommListDto data = null;
     Config.IUnionConfig fig = Config.ConfigManager.GetConfigProvider();
     UnionDataUrlBase dataUrl = new DataUrl.Default.HotelDianPingListDefaultService(fig);
     dataUrl.UrlParas.Add("hotelid", hid);
     dataUrl.UrlParas.Add("cid", cid.ToString());
     dataUrl.UrlParas.Add("px", pi);
     dataUrl.UrlParas.Add("type", type);
     iPow.Infrastructure.Crosscutting.Function.WebHttpHelper req = new Infrastructure.Crosscutting.Function.WebHttpHelper();
     var url = dataUrl.GetUrl();
     try
     {
         var dataStr = req.WebRequest(iPow.Infrastructure.Crosscutting.Function.HttpMethod.GET, url.AbsoluteUri, "");
         if (dataStr != null && dataStr != "")
         {
             data = Newtonsoft.Json.JsonConvert.DeserializeObject<iPow.Application.Union.Dto.HotelCommListDto>(dataStr);
         }
     }
     catch (Exception ex)
     {
         iPow.Infrastructure.Data.LoggerReopsitoryManager.AddLogInfo(1, 0,
                iPow.Infrastructure.Crosscutting.Function.StringHelper.GetCurrentUrl(),
                iPow.Infrastructure.Crosscutting.Function.StringHelper.GetReferrerUrl(),
                "酒店评论", ex.Message,
                iPow.Infrastructure.Crosscutting.Function.StringHelper.GetRealIP());
     }
     return data;
 }
コード例 #2
0
ファイル: HotelCommService.cs プロジェクト: JPomichael/IPOW
        /// <summary>
        /// Gets the hotel comm by id.
        /// </summary>
        /// <param name="hid">The hid.</param>
        /// <param name="cid">The cid.</param>
        /// <param name="pi">The pi.</param>
        /// <param name="type">The type.0是全部,1是好,2是中,3是差,4是带图片的。</param>
        /// <returns></returns>
        public iPow.Application.Union.Dto.HotelCommListDto GetHotelCommById(string hid, string cid, string pi = "1", string type = "0")
        {
            //http://data.128uu.com/data/hotel_dianpinglist/?hotelid=658&cid=21&px=1&type=1&agent_id=112935&agent_md=O81U21UM11.html
            iPow.Application.Union.Dto.HotelCommListDto data = null;
            Config.IUnionConfig fig     = Config.ConfigManager.GetConfigProvider();
            UnionDataUrlBase    dataUrl = new DataUrl.Default.HotelDianPingListDefaultService(fig);

            dataUrl.UrlParas.Add("hotelid", hid);
            dataUrl.UrlParas.Add("cid", cid.ToString());
            dataUrl.UrlParas.Add("px", pi);
            dataUrl.UrlParas.Add("type", type);
            iPow.Infrastructure.Crosscutting.Function.WebHttpHelper req = new Infrastructure.Crosscutting.Function.WebHttpHelper();
            var url = dataUrl.GetUrl();

            try
            {
                var dataStr = req.WebRequest(iPow.Infrastructure.Crosscutting.Function.HttpMethod.GET, url.AbsoluteUri, "");
                if (dataStr != null && dataStr != "")
                {
                    data = Newtonsoft.Json.JsonConvert.DeserializeObject <iPow.Application.Union.Dto.HotelCommListDto>(dataStr);
                }
            }
            catch (Exception ex)
            {
                iPow.Infrastructure.Data.LoggerReopsitoryManager.AddLogInfo(1, 0,
                                                                            iPow.Infrastructure.Crosscutting.Function.StringHelper.GetCurrentUrl(),
                                                                            iPow.Infrastructure.Crosscutting.Function.StringHelper.GetReferrerUrl(),
                                                                            "酒店评论", ex.Message,
                                                                            iPow.Infrastructure.Crosscutting.Function.StringHelper.GetRealIP());
            }
            return(data);
        }