using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Common { public static class TianMaoOperation { private static log4net.ILog logger = log4net.LogManager.GetLogger(typeof(TianMaoOperation)); private const string apiURL = "http://pms.boonlive-rcu.com:90/home/"; private const string accessKeyId = "5d36d736c7866d47600d87d6a881adaa"; private const string accessKeySecret = "b4f94f725b2417dfbc4703dd457087f9"; /// /// /// /// 方法名:PostCustomScene /// /// /// public static void PostWebRequestToTianMao(string method, string jsonData, string hotelCode, string roomNumber) { try { var QQQ = Newtonsoft.Json.JsonConvert.SerializeObject(new { accessKeyId = accessKeyId, accessKeySecret = accessKeySecret, jsonData = jsonData }); //logger.Error("天猫精灵调用的JSON:"+QQQ); string result = Common.HttpWebRequestHelper.PostWebRequest(apiURL + method, QQQ); APIResultEntity apiResult = Newtonsoft.Json.JsonConvert.DeserializeObject(result); if (!apiResult.result) { logger.Error(string.Format("酒店({0})客房({1})上报天猫精灵接口({2}),结果:{3},数据:{4}", hotelCode, roomNumber, method, result, Newtonsoft.Json.JsonConvert.SerializeObject(jsonData))); } } catch (Exception ex) { logger.Error(string.Format("酒店({0})客房({1})上报天猫精灵接口({2})失败:{3},数据:{4}", hotelCode, roomNumber, method, ex.ToString(), Newtonsoft.Json.JsonConvert.SerializeObject(jsonData))); } } } public class APIResultEntity { /// /// 结果:true成功,false失败 /// public bool result { get; set; } /// /// 提示信息 /// public string msg { get; set; } /// /// 返回数据 /// public string data { get; set; } } }