上面,有两个虚拟字段Error_Code和TransMessage
使用的时候,可以这样使用:
throw new ECOrderException { ErrorCode = "X1008-01", TransMessage = "交易代码验证失败" }; var obj = new JObject( new JProperty("head", new JObject( new JProperty("transMessage", transMessage), new JProperty("errorCode", ErrorCode) )), new JProperty("body", new JObject()) ); var result = new ContentResult() { Content = Newtonsoft.Json.JsonConvert.SerializeObject(obj), ContentType = "application/json" };然后这样就可以返回一个Json的格式信息给前端。
转载于:https://www.cnblogs.com/ZkbFighting/p/11249102.html
