public string GetCardDetail(string code, string card_id) { try { string resmsg = NetHelper.HttpRequest(AppConfig.TokenUrl, "", "GET", 2000, Encoding.UTF8, "application/json"); TokeRes toke = JsonHelper.DeserializeObject <TokeRes>(resmsg); string token = toke.Access_Token; cardInfo cardInfo = new cardInfo(); cardInfo.card_id = card_id; string url = "https://api.weixin.qq.com/card/code/decrypt?access_token=" + token; string json = @"{""encrypt_code"":""" + code + @"""}"; string resMessage = NetHelper.HttpRequest(url, json, "POST", 2000, Encoding.UTF8, "application/json"); if (resMessage.Contains("\"ok\"")) { code = resMessage.Split('"')[9]; cardInfo.code = code; //查询卡券信息 url = "https://api.weixin.qq.com/card/get?access_token=" + token; json = @"{ ""card_id"": """ + card_id + @""" }"; resMessage = NetHelper.HttpRequest(url, json, "POST", 2000, Encoding.UTF8, "application/json"); if (resMessage.Contains("\"ok\"")) { try { var brand_name = resMessage.Substring(resMessage.IndexOf("brand_name") + 10).Split('"')[2]; var title = resMessage.Substring(resMessage.IndexOf("title") + 5).Split('"')[2]; var color = resMessage.Substring(resMessage.IndexOf("color") + 5).Split('"')[2]; cardInfo.brand_name = brand_name; cardInfo.title = title; cardInfo.color = color; } catch { cardInfo.brand_name = ""; cardInfo.title = ""; cardInfo.color = ""; } } } string cardInfoMsg = JsonConvert.SerializeObject(cardInfo); response.Status = 1; response.Data = cardInfoMsg; } catch (Exception ex) { response.Status = 0; response.Message = "核销异常" + ex.Message; response.Data = null; } return(JsonHelper.ToJSON(response)); }
//假聯絡人 //public static distributorInfo fakeContact() //{ // distributorInfo fake = new distributorInfo() // { // companyXid = "1", // channelOid = "111", // userid = "2", // firstName = "sharon", // lastName = "chang", // areatel = "886", // tel = "3939889", // email = "*****@*****.**", // countryCd = "TW", // lang = "zh-tw", // currency = "TWD", // state="TW", // memberUuid = "051794b8-db2a-4fe7-939f-31ab1ee2c719", // tokenKey = "897af29c45ed180451c2e6bfa81333b6", // deviceId = "3c2ab71448224d1d7148350f7972e96e" // }; // return fake; //} //假國攷 //public static List<Country> fakeCountry() //{ // Country c1 = new Country() { countryCd = "TW", countryName = "台灣", countryEngName = "TAIWAN" }; // Country c2 = new Country() { countryCd = "HK", countryName = "香港", countryEngName = "HONG KONG" }; // Country c3 = new Country() { countryCd = "MO", countryName = "澳門", countryEngName = "MO" }; // Country c4 = new Country() { countryCd = "CN", countryName = "中國", countryEngName = "CN" }; // Country c5 = new Country() { countryCd = "US", countryName = "美國", countryEngName = "US" }; // List<Country> lstCountry = new List<Country>(); // lstCountry.Add(c1); // lstCountry.Add(c2); // lstCountry.Add(c3); // lstCountry.Add(c4); // lstCountry.Add(c5); // return lstCountry; //} //單純的目的是產出前台可以使用的object string public static DataModel getDefaultDataModel(int qty, string guidNo) { DataModel d = new DataModel(); d.guidNo = guidNo; modulesData modules = new modulesData(); otherDataM other = new otherDataM(); other.moduleType = "OMDL_OTHER_DATA"; moduleData_otherData mo = new moduleData_otherData(); other.moduleData = mo; modules.otherData = other; contactDataM contact = new contactDataM(); contact.moduleType = "OMDL_CONTACT_DATA"; moduleData_contactData mcontract = new moduleData_contactData(); contactNameInfo cni = new contactNameInfo(); contactTelInfo cti = new contactTelInfo(); contactAppInfo cai = new contactAppInfo(); mcontract.contactName = cni; mcontract.contactTel = cti; mcontract.contactApp = cai; contact.moduleData = mcontract; modules.contactData = contact; sendDataM send = new sendDataM(); send.moduleType = "OMDL_SEND_DATA"; moduleData_sendData msend = new moduleData_sendData(); receiverNameInfo receiverName = new receiverNameInfo(); receiverTelInfo receiverTel = new receiverTelInfo(); sendToCountryInfo sendToCountry = new sendToCountryInfo(); receiveAddressInfo receiveAdd = new receiveAddressInfo(); sendToCountry.receiveAddress = receiveAdd; sendToHotelInfo sendToHotel = new sendToHotelInfo(); buyerPassportEnglishNameInfo buyerPassportEnglishName = new buyerPassportEnglishNameInfo(); buyerLocalNameInfo buyerLocalName = new buyerLocalNameInfo(); sendToHotel.buyerPassportEnglishName = buyerPassportEnglishName; sendToHotel.buyerLocalName = buyerLocalName; shipInfoInfo shipInfo = new shipInfoInfo(); msend.receiverName = receiverName; msend.receiverTel = receiverTel; msend.sendToCountry = sendToCountry; msend.sendToHotel = sendToHotel; msend.shipInfo = shipInfo; send.moduleData = msend; modules.sendData = send; passengerDataM passenger = new passengerDataM(); passenger.moduleType = "OMDL_PSGR_DATA"; moduleData_passenger mp = new moduleData_passenger(); qtyChildSeatInfo qtyChildSeat = new qtyChildSeatInfo(); qtyInfantSeatInfo qtyInfantSeat = new qtyInfantSeatInfo(); mp.qtyChildSeat = qtyChildSeat; mp.qtyInfantSeat = qtyInfantSeat; passenger.moduleData = mp; modules.passengerData = passenger; carRentingDataM carRentingData = new carRentingDataM(); carRentingData.moduleType = "OMDL_RENT_CAR"; moduleData_CarRent cm = new moduleData_CarRent(); pickUpInfo_forCar pickUp = new pickUpInfo_forCar(); dateTimeInfo t = new dateTimeInfo(); pickUp.datetime = t; dropOffInfo_forCar dropOff = new dropOffInfo_forCar(); dropOff.datetime = t; cm.pickUp = pickUp; cm.dropOff = dropOff; carRentingData.moduleData = cm; modules.carRentingData = carRentingData; shuttleDataM shuttle = new shuttleDataM(); shuttle.moduleType = "OMDL_SHUTTLE"; moduleData_Shuttle ms = new moduleData_Shuttle(); designatedLocationInfo designatedLocation = new designatedLocationInfo(); timeInfo time = new timeInfo(); pickUpInfo pp = new pickUpInfo(); pp.time = time; dropOffInfo dd = new dropOffInfo(); designatedByCustomerInfo designatedByCustomer = new designatedByCustomerInfo(); designatedByCustomer.pickUp = pp; designatedByCustomer.dropOff = dd; charterRouteInfo charterRoute = new charterRouteInfo(); ms.designatedLocation = designatedLocation; ms.designatedByCustomer = designatedByCustomer; ms.charterRoute = charterRoute; shuttle.moduleData = ms; modules.shuttleData = shuttle; flightInfoDataM flight = new flightInfoDataM(); flight.moduleType = "OMDL_FLIGHT_INFO"; moduleData_FlightInfo mf = new moduleData_FlightInfo(); arrivalInfo arrival = new arrivalInfo(); arrivalDatetimeInfo atime = new arrivalDatetimeInfo(); arrival.arrivalDatetime = atime; departureInfo departure = new departureInfo(); departureDatetimeInfo dtime = new departureDatetimeInfo(); departure.departureDatetime = dtime; mf.arrival = arrival; mf.departure = departure; flight.moduleData = mf; modules.flightInfoData = flight; d.modules = modules; List <CusDataInfo> LstCus = new List <CusDataInfo>(); for (int i = 0; i < qty; i++) { CusDataInfo cus = new CusDataInfo(); nationalityInfo nation = new nationalityInfo(); cus.nationality = nation; passportInfo ppt = new passportInfo(); cus.passport = ppt; englishNameInfo en = new englishNameInfo(); cus.englishName = en; localNameInfo localName = new localNameInfo(); cus.localName = localName; weightInfo weight = new weightInfo(); cus.weight = weight; heightInfo height = new heightInfo(); cus.height = height; shoeSizeInfo shoes = new shoeSizeInfo(); cus.shoeSize = shoes; foodAllergyInfo food = new foodAllergyInfo(); mealInfo meal = new mealInfo(); meal.foodAllergy = food; meal.excludeFoodType = new string[] { }; cus.meal = meal; LstCus.Add(cus); } d.travelerData = LstCus; cardInfo card = new cardInfo(); d.card = card; return(d); }