63 lines
2.5 KiB
C#
63 lines
2.5 KiB
C#
|
|
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";
|
|||
|
|
/// <summary>
|
|||
|
|
///
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="method">方法名:PostCustomScene</param>
|
|||
|
|
/// <param name="jsonData"></param>
|
|||
|
|
/// <param name="hotelCode"></param>
|
|||
|
|
/// <param name="roomNumber"></param>
|
|||
|
|
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<APIResultEntity>(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
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 结果:true成功,false失败
|
|||
|
|
/// </summary>
|
|||
|
|
public bool result { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 提示信息
|
|||
|
|
/// </summary>
|
|||
|
|
public string msg { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 返回数据
|
|||
|
|
/// </summary>
|
|||
|
|
public string data { get; set; }
|
|||
|
|
}
|
|||
|
|
}
|