public EdgeServerDataModule()
        {
            Get["/"] = parameters =>
            {
                //EdgeServerBLL.Send2EdgeServer("EdgeServerInterface", "POST", "{'id':'124'}");
                return HttpStatusCode.OK;
            };

            Post["/EdgeServerData"] = _ =>
            {
                string datastring = RestHelper.GetBodyFromRequest(Request);
                LogHelper.WriteInfoLog(typeof(EdgeServerDataModule), "收到EdgeServer发送的消息:" + datastring);
                EdgeServerData data = new EdgeServerData();
                try
                {
                    data = JsonConvert.DeserializeObject<EdgeServerData>(datastring);
                }
                catch (Exception)
                {
                    return HttpStatusCode.BadRequest;
                }

                EdgeServerResponse resp = EdgeServerBLL.EdgeServerDilivery(data);
                return Response.AsJson(resp.result, resp.status);
            };
        }
示例#2
0
 public static EdgeServerResponse EdgeServerDilivery(EdgeServerData edgeServer)
 {
     //为客户端业务数据
     if (edgeServer.serviceID == 1)
     {
         return DiliveryClientData(edgeServer.payload);
     }
     //为EdgeServer回告
     else if (edgeServer.serviceID == 2)
     {
         return ProcessResponseData(edgeServer.payload);
     }
     //为客户端登陆数据
     else if (edgeServer.serviceID == 3)
     {
         return ProcessLogonData(edgeServer.payload);
     }
     return new EdgeServerResponse(HttpStatusCode.BadRequest);
 }