public void ProcessRequest(HttpContext context) { Common.Transfer Trans = new Common.Transfer(); //密钥类型 //不同调用者密钥不同 string MacType = ""; HttpRequest Request = context.Request; Trans.Class = Request["Class"].ToString(); Trans.Command = Request["Command"].ToString(); Trans.Mac = Request["Mac"].ToString(); if (Request["ComCode"] != null) { MacType = Request["ComCode"].ToString(); } PubContext.OperateRSA(ref Trans, MacType); context.Response.ContentType = "text/plain"; context.Response.AddHeader("Access-Control-Allow-Origin", "*"); context.Response.Write(Trans.Output()); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; context.Response.AddHeader("Access-Control-Allow-Origin", "*"); try { Common.Transfer Trans = new Common.Transfer(); HttpRequest Request = context.Request; if (!Request.Params.AllKeys.Contains("Class")) { context.Response.Write(new ApiResult(false, "缺少参数Class").toJson()); return; } //获取要执行的类名称 Trans.Class = Request["Class"].ToString(); if (string.IsNullOrEmpty(Trans.Class)) { context.Response.Write(new ApiResult(false, "Class不能为空").toJson()); return; } if (!Request.Params.AllKeys.Contains("Command")) { context.Response.Write(new ApiResult(false, "缺少参数Command").toJson()); return; } //wlg 20191204 没有地方使用??? if (Request["QYID"] != null) { Trans.QYID = Request["QYID"].ToString(); } //wlg 20191204 没有地方使用??? if (Request["QYUnitType"] != null) { Trans.QYUnitType = Request["QYUnitType"].ToString(); } //获取命令类型 Trans.Command = Request["Command"].ToString(); if (string.IsNullOrEmpty(Trans.Command)) { context.Response.Write(new ApiResult(false, "Command不能为空").toJson()); return; } if (Request.Params.AllKeys.Contains("Agreement")) { Trans.Agreement = HttpUtility.UrlDecode(Request["Agreement"].ToString());//碧桂园 获取协议html代码 } //获取属性xml格式字符串 if (!Request.Params.AllKeys.Contains("Attribute")) { context.Response.Write(new ApiResult(false, "缺少参数Attribute").toJson()); return; } Trans.Attribute = HttpUtility.UrlDecode(Request["Attribute"].ToString()); if (string.IsNullOrEmpty(Trans.Attribute)) { context.Response.Write(new ApiResult(false, "Attribute不能为空").toJson()); return; } if (!Request.Params.AllKeys.Contains("Mac")) { context.Response.Write(new ApiResult(false, "缺少参数Mac").toJson()); return; } Trans.Mac = Request["Mac"].ToString(); if (string.IsNullOrEmpty(Trans.Mac)) { context.Response.Write(new ApiResult(false, "Mac不能为空").toJson()); return; } //如果是文件类型 if (Trans.Class == "Files") { new Files().ProcessRequest(context); } else { //wlg 20200110 增加操作日志记录 Common.Transfer tranNew = new Transfer() { Result = Trans.Result, Attribute = Trans.Attribute, Command = Trans.Command, Class = Trans.Class, Mac = Trans.Mac, QYID = Trans.QYID, QYUnitType = Trans.QYUnitType }; RecordOperationLog(tranNew); PubContext.Operate(ref Trans); } Compress(context); context.Response.Write(Trans.Output()); } catch (Exception ex) { context.Response.Write(new ApiResult(false, ex.Message + Environment.NewLine + ex.StackTrace).toJson()); } }