public string[] GetHotelIdList(int cityCode) { StringBuilder hotelIdList = new StringBuilder(); var hotelIdlistRes = HotelApiAccess.QueryObj <HotelIdListReqEntity, HotelIdListResEntity>(new HotelIdListReqEntity { City = cityCode, PageIndex = 1, PageSize = 4000 }); if (hotelIdlistRes.Total != 0) { hotelIdList = hotelIdList.Append(hotelIdlistRes.HotelIDs); var temp = hotelIdlistRes.Total / 4000; for (int i = 1; i <= temp; i++) { hotelIdList = hotelIdList.Append(HotelApiAccess.QueryObj <HotelIdListReqEntity, HotelIdListResEntity>(new HotelIdListReqEntity { City = 2, PageIndex = (i + 1), PageSize = 4000 }).HotelIDs); } } return(hotelIdList.ToString().Split(',')); }
public HotelStaticInfo GetHotelInfo(string hotelId) { var hotelDesInfoResEntity = HotelApiAccess.QueryObj <HotelDesInfoReqEntity, HotelDesInfoResEntity>(new HotelDesInfoReqEntity { SearchCandidate = new SearchCandidate { HotelID = hotelId }, Settings = new Settings { PrimaryLangID = "zh-cn", ExtendedNodes = new string[] { "HotelStaticInfo.GeoInfo", "HotelStaticInfo.NearbyPOIs", "HotelStaticInfo.TransportationInfos", "HotelStaticInfo.Brand", "HotelStaticInfo.Group", "HotelStaticInfo.Ratings", "HotelStaticInfo.Policies", "HotelStaticInfo.NormalizedPolicies.ChildAndExtraBedPolicy", "HotelStaticInfo.AcceptedCreditCards", "HotelStaticInfo.ImportantNotices", "HotelStaticInfo.Facilities", "HotelStaticInfo.Pictures", "HotelStaticInfo.Descriptions", "HotelStaticInfo.Themes", "HotelStaticInfo.ContactInfo", "HotelStaticInfo.ArrivalTimeLimitInfo", "HotelStaticInfo.DepartureTimeLimitInfo", "HotelStaticInfo.HotelTags.IsBookable" } } }); return(hotelDesInfoResEntity.HotelStaticInfo); }
/// <summary> /// 是否为即时确认订单-即时确认订单是艺龙提高订单快速确认所提供的一项服务,当此订单为即时确认订单时,即是订单状态未变成“已确认“状态,也可以先给客人进行订单确认; /// </summary> /// <param name="orderId">三方订单Id</param> /// <returns></returns> public bool IsInstantConfirmOrder(long orderId) { InstantOrderResponse response = new InstantOrderResponse(); try { OrderDetailCondition condition = new OrderDetailCondition() { OrderId = orderId }; var result = HotelApiAccess.Query <OrderDetailCondition, InstantOrderResponse>(condition, "hotel.order.instant"); if (result.Code == "0") { response = result.Result; } else { throw new Exception("接口请求失败:" + result.Code); } } catch (Exception ex) { throw ex; } return(response.InstantStatus == EnumInstantStatus.Instant); }
public void AddHotels(string hotelId) { var hotelDesReq = new HotelDesInfoReqEntity { SearchCandidate = new EntityModel.Proxy.CTripHotel.SearchCandidate { HotelID = hotelId }, Settings = new Settings { PrimaryLangID = "zh-cn", ExtendedNodes = new string[] { "HotelStaticInfo.GeoInfo", "HotelStaticInfo.NearbyPOIs", "HotelStaticInfo.TransportationInfos", "HotelStaticInfo.Brand", "HotelStaticInfo.Group", "HotelStaticInfo.Ratings", "HotelStaticInfo.Policies", "HotelStaticInfo.NormalizedPolicies.ChildAndExtraBedPolicy", "HotelStaticInfo.AcceptedCreditCards", "HotelStaticInfo.ImportantNotices", "HotelStaticInfo.Facilities", "HotelStaticInfo.Pictures", "HotelStaticInfo.Descriptions", "HotelStaticInfo.Themes", "HotelStaticInfo.ContactInfo", "HotelStaticInfo.ArrivalTimeLimitInfo", "HotelStaticInfo.DepartureTimeLimitInfo", "HotelStaticInfo.HotelTags.IsBookable" } } }; var resultObj = HotelApiAccess.QueryObj <HotelDesInfoReqEntity, HotelDesInfoResEntity>(hotelDesReq); //_cTripHotelDesDal.AddHotelDesToSolr(); }
/// <summary> /// 订单实时状态查询 /// </summary> /// <param name="condition"></param> /// <returns></returns> public HotelOrderStatus GetOrderStatus(OrderDetailCondition condition) { HotelOrderStatus response = HotelOrderStatus.B3; try { if (!IsInstantConfirmOrder(condition.OrderId)) { var result = HotelApiAccess.Query <OrderDetailCondition, OrderDetailResponse>(condition, "hotel.order.detail"); if (result.Code == "0") { response = (HotelOrderStatus)Enum.Parse(typeof(HotelOrderStatus), result.Result.Status); } else { throw new Exception("接口请求失败:" + result.Code); } } else { response = HotelOrderStatus.A; } } catch (Exception ex) { throw ex; } return(response); }
public HotelListResponseEntity Query(HotelDetailRequestEntity request) { var result = HotelApiAccess.Query <HotelDetailRequestEntity, HotelListResponseEntity>(request, "hotel.detail").Result; //#region 担保过滤 //if (result.Hotels == null || (!result.Hotels.Any())) //{ // return result; //} //if (result.Hotels[0].Rooms == null || (!result.Hotels[0].Rooms.Any())) //{ // return result; //} //foreach (var room in result.Hotels[0].Rooms) //{ // if (room.RatePlans != null && room.RatePlans.Any()) // { // room.RatePlans = room.RatePlans.Where(a => string.IsNullOrWhiteSpace(a.GuaranteeRuleIds)).ToArray(); // } //} //#endregion return(result); }
/// <summary> /// 取消订单 /// </summary> /// <param name="condition"></param> /// <returns></returns> public bool OrderCancel(OrderCancelCondition condition) { bool response = false; try { var result = HotelApiAccess.Query <OrderCancelCondition, OrderCancelResponse>(condition, "hotel.order.cancel"); if (result.Code == "0") { response = result.Result.Successs; } else { throw new Exception("接口请求失败:" + result.Code); } } catch (Exception ex) { throw ex; } return(response); }
/// <summary> /// 订单详情 /// </summary> /// <param name="condition"></param> /// <returns></returns> public OrderDetailResponse GetOrderDetail(OrderDetailCondition condition) { OrderDetailResponse response = new OrderDetailResponse(); try { var result = HotelApiAccess.Query <OrderDetailCondition, OrderDetailResponse>(condition, "hotel.order.detail"); if (result.Code == "0") { response = result.Result; } else { throw new Exception("接口请求失败:" + result.Code); } } catch (Exception ex) { throw ex; } return(response); }
public ChangeInfoResEntity Query(ChangeInfoReqEntity req) { return(JsonHelper.DeserializeJsonToObject <ChangeInfoResEntity>(HotelApiAccess.Query <ChangeInfoReqEntity>(req, "ChangeInfo"))); }
public CreditCardsResponseEntity GetAll() { return(HotelApiAccess.GetStatic <CreditCardsResponseEntity>(string.Format("{0}xml/v2.0/hotel/creditcards.xml", Configuraton.ApiGatewayConfig.URL_STATIC))); }
public string QueryStr(RoomDesInfoReqEntity req) { return(HotelApiAccess.Query(req, "RoomDesInfo")); }
public RoomDesInfoResEntity Query(RoomDesInfoReqEntity req) { return(JsonHelper.DeserializeJsonToObject <RoomDesInfoResEntity>(HotelApiAccess.Query(req, "RoomDesInfo"))); }
public void UpLoadHotelListToSolr(int cityCode) { StringBuilder hotelIdList = new StringBuilder(); var hotelIdlistRes = HotelApiAccess.QueryObj <HotelIdListReqEntity, HotelIdListResEntity>(new HotelIdListReqEntity { City = cityCode, PageIndex = 1, PageSize = 4000 }); if (hotelIdlistRes.Total != 0) { hotelIdList = hotelIdList.Append(hotelIdlistRes.HotelIDs); var temp = hotelIdlistRes.Total / 4000; for (int i = 1; i <= temp; i++) { hotelIdList = hotelIdList.Append(HotelApiAccess.QueryObj <HotelIdListReqEntity, HotelIdListResEntity>(new HotelIdListReqEntity { City = 2, PageIndex = (i + 1), PageSize = 4000 }).HotelIDs); } } var hotelIdArr = hotelIdList.ToString().Split(','); var hotels = new List <HotelSimpleInfoSolrModel>(); Random rd = new Random(); for (int i = 0; i < hotelIdArr.Length; i++) { var hotelDesInfoResEntity = HotelApiAccess.QueryObj <HotelDesInfoReqEntity, HotelDesInfoResEntity>(new HotelDesInfoReqEntity { SearchCandidate = new SearchCandidate { HotelID = hotelIdArr[i] }, Settings = new Settings { PrimaryLangID = "zh-cn", ExtendedNodes = new string[] { "HotelStaticInfo.GeoInfo", "HotelStaticInfo.NearbyPOIs", "HotelStaticInfo.TransportationInfos", "HotelStaticInfo.Brand", "HotelStaticInfo.Group", "HotelStaticInfo.Ratings", "HotelStaticInfo.Policies", "HotelStaticInfo.NormalizedPolicies.ChildAndExtraBedPolicy", "HotelStaticInfo.AcceptedCreditCards", "HotelStaticInfo.ImportantNotices", "HotelStaticInfo.Facilities", "HotelStaticInfo.Pictures", "HotelStaticInfo.Descriptions", "HotelStaticInfo.Themes", "HotelStaticInfo.ContactInfo", "HotelStaticInfo.ArrivalTimeLimitInfo", "HotelStaticInfo.DepartureTimeLimitInfo", "HotelStaticInfo.HotelTags.IsBookable" } } }); var hotelStaticInfo = hotelDesInfoResEntity.HotelStaticInfo; if (hotelStaticInfo != null) { hotels.Add(new HotelSimpleInfoSolrModel { HotelId = hotelStaticInfo.HotelId, HotelName = hotelStaticInfo.HotelName, HotelNameEN = hotelStaticInfo.HotelNameEN, StarRating = hotelStaticInfo.StarRating, Price = rd.Next(100, 1000), CityCode = hotelStaticInfo.GeoInfo.City?.Code, CityName = hotelStaticInfo.GeoInfo.City?.Name, AreaCode = hotelStaticInfo.GeoInfo.Area?.Code, AreaName = hotelStaticInfo.GeoInfo.Area?.Name, PostalCode = string.IsNullOrWhiteSpace(hotelStaticInfo.GeoInfo.PostalCode) ? null : hotelStaticInfo.GeoInfo.PostalCode, Address = hotelStaticInfo.GeoInfo?.Address, AdjacentIntersection = hotelStaticInfo.GeoInfo?.AdjacentIntersection, GetInfo = JsonHelper.SerializeObject(hotelStaticInfo.GeoInfo), Ratings = JsonHelper.SerializeObject(hotelStaticInfo.Ratings), Pictures = JsonHelper.SerializeObject(hotelStaticInfo.Pictures), ImportantNotices = JsonHelper.SerializeObject(hotelStaticInfo.ImportantNotices), TransportationInfos = JsonHelper.SerializeObject(hotelStaticInfo.TransportationInfos) }); } } SolrApi.Adds <HotelSimpleInfoSolrModel>(hotels, "simplehotel"); }
public string QueryStr(HotelDetailRequestEntity request) { return(HotelApiAccess.Query(request, "hotel.detail")); }
public LowPriceResEntity QueryObj(LowPriceReqEntity req) { return(HotelApiAccess.QueryObj <LowPriceReqEntity, LowPriceResEntity>(req)); }
public void GetHotelsByCityCode(int cityCode) { StringBuilder hotelIdList = new StringBuilder(); var hotelIdlistRes = HotelApiAccess.QueryObj <HotelIdListReqEntity, HotelIdListResEntity>(new HotelIdListReqEntity { City = cityCode, PageIndex = 1, PageSize = 4000 }); if (hotelIdlistRes.Total != 0) { hotelIdList = hotelIdList.Append(hotelIdlistRes.HotelIDs); var temp = hotelIdlistRes.Total / 4000; for (int i = 1; i <= temp; i++) { hotelIdList = hotelIdList.Append(HotelApiAccess.QueryObj <HotelIdListReqEntity, HotelIdListResEntity>(new HotelIdListReqEntity { City = 2, PageIndex = (i + 1), PageSize = 4000 }).HotelIDs); } } var hotelIdArr = hotelIdList.ToString().Split(','); var hotels = new List <KeyWordHotel>(); for (int i = 0; i < 1000; i++) { var hotelDesInfoResEntity = HotelApiAccess.QueryObj <HotelDesInfoReqEntity, HotelDesInfoResEntity>(new HotelDesInfoReqEntity { SearchCandidate = new SearchCandidate { HotelID = hotelIdArr[i] }, Settings = new Settings { PrimaryLangID = "zh-cn", ExtendedNodes = new string[] { "HotelStaticInfo.GeoInfo", "HotelStaticInfo.NearbyPOIs", "HotelStaticInfo.TransportationInfos", "HotelStaticInfo.Brand", "HotelStaticInfo.Group", "HotelStaticInfo.Ratings", "HotelStaticInfo.Policies", "HotelStaticInfo.NormalizedPolicies.ChildAndExtraBedPolicy", "HotelStaticInfo.AcceptedCreditCards", "HotelStaticInfo.ImportantNotices", "HotelStaticInfo.Facilities", "HotelStaticInfo.Pictures", "HotelStaticInfo.Descriptions", "HotelStaticInfo.Themes", "HotelStaticInfo.ContactInfo", "HotelStaticInfo.ArrivalTimeLimitInfo", "HotelStaticInfo.DepartureTimeLimitInfo", "HotelStaticInfo.HotelTags.IsBookable" } } }); var hotelStaticInfo = hotelDesInfoResEntity.HotelStaticInfo; if (hotelStaticInfo != null) { hotels.Add(new KeyWordHotel { HotelId = hotelStaticInfo.HotelId, HotelName = hotelStaticInfo.HotelName, CityName = hotelStaticInfo.GeoInfo.City?.Name, CityCode = hotelStaticInfo.GeoInfo.City?.Code, AreaName = hotelStaticInfo.GeoInfo.Area?.Name, AreaCode = hotelStaticInfo.GeoInfo.Area?.Code, BusinessDistrict = string.Join(";", hotelStaticInfo.GeoInfo.BusinessDistrict.Select(a => a.Code + "," + a.Name).ToArray()),//!string.IsNullOrEmpty(businessDistrictNames) ? businessDistrictNames : null, HotelBrandName = hotelStaticInfo.Brand?.Name, HotelBrandCode = hotelStaticInfo.Brand?.Code }); } } SolrApi.Adds <KeyWordHotel>(hotels, "testsolr2"); }
public string QueryStr(LowPriceReqEntity req) { return(HotelApiAccess.QueryStr <LowPriceReqEntity>(req)); }
public string QueryStr(HotelIdListRequestEntity req) { return(HotelApiAccess.Query(req, "HotelIdList")); }
public string QueryStr(HotelListRequestEntity request) { return(HotelApiAccess.Query(request, "hotel.list")); }
public HotelListResponseEntity Query(HotelListRequestEntity request) { return(HotelApiAccess.Query <HotelListRequestEntity, HotelListResponseEntity>(request, "hotel.list").Result); }
public string QueryStr(HotelDesInfoReqEntity req) { return(HotelApiAccess.QueryStr(req)); }
public HotelGeosResponseEntity GetAll() { return(HotelApiAccess.GetStatic <HotelGeosResponseEntity>(string.Format("{0}xml/v2.0/hotel/geo_cn.xml", Configuraton.ApiGatewayConfig.URL_STATIC))); }
public string QueryStr(ChangeInfoReqEntity req) { return(HotelApiAccess.Query(req, "ChangeInfo")); }
public HotelIdListResponseEntity Query(HotelIdListRequestEntity req) { return(JsonHelper.DeserializeJsonToObject <HotelIdListResponseEntity>(HotelApiAccess.Query <HotelIdListRequestEntity>(req, "HotelIdList"))); }