调用第三方接口,第三方推送数据的方式为backurl?a=xx&c=xxx.......,其中backurl是自己在第三方平台设置的推送地址。如何获取推送的数据呢?
关键是第三方推送的有实时的,有非实时的,该怎么获取获取呢?
GoEasyweb 推送基于websocket 和polling两种实现,兼容IE6-IE11的所有IE浏览器以及其它主流浏览器。它提供了Restful API支持各个开发语言。服务稳定,文档齐全。官网:goeasy.io
第三方无论是否是实时与非实时 总有一个触发事件 这个触发事件就需要你在这边做一个单点接口就行
获取数据:
$.get("url", { "type": text }, function (data) {
if (data == "1") {
location.href = "/indexDetail.aspx" + url + "&src=" + encodeURIComponent(text);
}
else {
//可以在此触发事件
});
}
});
protected void Page_Load(object sender, EventArgs e)
{
Main(HttpContext.Current);
}
/// <summary>
/// 主运行
/// </summary>
/// <param name="context"></param>
public void Main(HttpContext context)
{
//获取推送数据
string serial_id = context.Request.Form["serial_id"];
string order_id = context.Request.Form["order_id"];
string card_json = context.Request.Form["card_json"];
string xmlResp = "返回推送的数据";
context.Response.ClearContent();
context.Response.ContentType = "application/octet-stream";
byte[] byteResp = ResponseData(xmlResp);
context.Response.BinaryWrite(byteResp);
}