//protobuf3
C2sCalenderTicketPrice p = new C2sCalenderTicketPrice();
p.Airline = "ALL";
p.BigCabin = "Y";
p.DepartureDate = "2024-01-27";
p.DeptCode = "BJS";
p.DeptCodeType = 1;
p.DestCode = "SHA";
p.DestCodeType = 1;
p.HasChild = true;
p.HasInfant = true;
p.IsRoundTrip = true;
p.ReqSource = "WXINDEX";
p.SourceFrom = "wx";
//protobuf2
net.webby.protostuff.runtime.C2sCalenderTicketPrice pto2 = new net.webby.protostuff.runtime.C2sCalenderTicketPrice();
pto2.bigCabin = "123";
pto2.deptCode = "123456";
//版本3
byte[] datato3 = p.ToByteArray();
C2sCalenderTicketPrice person12 = C2sCalenderTicketPrice.Parser.ParseFrom(datato3);
//datato3 = person12.ToByteArray();
C2sBodyWrapP pk = new C2sBodyWrapP();
pk.RequestBody = Google.Protobuf.ByteString.CopyFrom(datato3);
pk.Rcuuid = "t54dafc9faaaf4f9ba182eb0e2b7b32b";
pk.Rchannel = "00000000";
pk.Rcver = "WECHAT_u01_07.16.1120";
pk.Rpver = "8.2";
pk.Rsid = "126121397$$33fa33a2017b4c3a8d343117cee78ed";
pk.Rpid = "1211002";
pk.Rkey = "2024-01-26 17:17:24 +0000";
pk.Latitude = "39.912491";
pk.Longitude = "116.175797";
datato3 = pk.ToByteArray();
//base64
string ckbase6411 = QcHelp.Devcode.EncodeBase64(datato3);
//aes
string cdbody11 = new Aes().AesEncrypt(ckbase6411, "Ume2012Trip0309");
///请求数据
string url = "https://static.umetrip.com/gateway/api/umetrip/native";
string post = cdbody11;
Dictionary dic = new Dictionary();
dic.Add("Content-Serialize", "pb");
var body = QcHelp.DevHttp.PostStream(url, post, "", dic, "", true);
S2cBodyWrapPB person12111 = S2cBodyWrapPB.Parser.ParseFrom(body);
byte[] cggggg = person12111.S2CRspBodyWrapPB.ToByteArray();
S2cSearchTicketListNew person13 = S2cSearchTicketListNew.Parser.ParseFrom(person12111.S2CRspBodyWrapPB.Responsebody.ToByteArray());
经济舱列表数据
//const ySearchTicketList = res.ySearchTicketList || [];
头等舱列表数据
//const fSearchTicketList = res.fSearchTicketList || [];
经济舱列表数据
//const ySearchTicketTransitList = res.ySearchTicketTransitList || [];
头等舱列表数据
//const fSearchTicketTransitList = res.fSearchTicketTransitList || [];
string json = JsonConvert.SerializeObject(person13);
Console.WriteLine(json);
需要用到的知识:Protobuf,AES
AES:AES是高级加密标准(Advanced Encryption Standard)的缩写。它是一种对称加密算法,用于保护计算机数据的机密性。AES算法使用一系列的加密轮运算,按特定的规则对输入数据进行加密,使得只有拥有相应密钥的人才能解密并获得原始数据。AES是当前使用最广泛的加密算法之一,被广泛应用于各种计算机和通信系统中,包括网络通信、文件加密、数据库加密等。
Protobuf:Protobuf (short for Protocol Buffers) 是一种语言无关、平台无关、可扩展的序列化数据结构的协议。它由Google开发,用于高效地序列化结构化数据,并在不同的语言和平台之间进行数据传输和存储。与XML和JSON等常见的数据格式相比,Protobuf具有更小的数据体积和更快的编解码速度,适用于对数据大小和传输效率有较高要求的场景。通过定义结构化的消息类型和文件描述语言,Protobuf能够自动生成用于数据序列化和反序列化的代码,使得开发人员可以方便地在不同的语言中进行数据交换和通信。
响应数据:
{"YSearchTicketList":[{"FlightTicketInfoList":{"AirlineIcon":"http://oss.umetrip.com/fs/airline/logo/1875,3edb844648459f10","FlightCompany":"中国联合航空","FlightNo":"KN5977","HasShare":"","PlaneType":"中","PlaneTypeDesc":"波音73V","FlightDate":"2024-01-27","DeptCode":"PKX","DestCode":"PVG","HostFlightAirlineIcon":"","HostFlightCompany":"","HostFlightNo":"","OntimeRate":"准83%","MealDesc":"无餐","Source":"KN","HasWifi":false,"BigCabin":"","Cabin":"","Price":"","FlightCompanyShort":"中联航","HostFlightCompanyShort":"","StopOverCityInfo":[],"PlaneTypeDescShow":"73V","WifiInfo":null,"PlaneTypeImgUrl":"","AbleUseCash":false},"FlightMixInfoList":"2h25m","RemainTicket":"","PriceCurrencyDesc":"¥","Price":"650","TotalPrice":"770","ChildPrice":"650","ChildTotalPrice":"680","InfantPrice":"160","PriceDesc":"","FlightDate":"2024-01-27","DeptCode":"PKX","DestCode":"PVG","IsReserve":"支持预订","IncludeTax":"","DeptTime":"2024-01-27 20:55","DestTime":"2024-01-27 23:20","SpanDayNum":"","DeptAirportName":"大兴","DestAirportName":"浦东","DeptCityName":"北京","DestCityName":"上海","DeptTerminal":"","DestTerminal":"T1","Day":"周六","TransferCityInfo":"","TransferCityDesc":"","TransferCity":"","HasShare":"","FlightCompany":"中国联合航空","DepPeriod":"18:00-24:00","DesPeriod":"18:00-24:00","PlaneType":"中","FlyTime":145,"CabinDesc":"V舱","CabinRemain":"9张+","CabinDiscount":"经济舱3.9