diff --git a/APIJSON.NET/APIJSON.NET/APIJSON.NET.csproj b/APIJSON.NET/APIJSON.NET/APIJSON.NET.csproj index f7bd43b..01fe4ec 100644 --- a/APIJSON.NET/APIJSON.NET/APIJSON.NET.csproj +++ b/APIJSON.NET/APIJSON.NET/APIJSON.NET.csproj @@ -16,17 +16,15 @@ - + - - - - + + diff --git a/APIJSON.NET/APIJSON.NET/Controllers/JsonController.cs b/APIJSON.NET/APIJSON.NET/Controllers/JsonController.cs index 6590965..709aa4a 100644 --- a/APIJSON.NET/APIJSON.NET/Controllers/JsonController.cs +++ b/APIJSON.NET/APIJSON.NET/Controllers/JsonController.cs @@ -37,15 +37,13 @@ public JsonController(SelectTable _selectTable, DbContext _db,IIdentityService i /// [HttpPost("/get")] - public ActionResult Query([FromBody]string json) + public ActionResult Query([FromBody] JObject jobject) { - json = HttpUtility.UrlDecode(json); JObject ht = new JObject(); ht.Add("code", "200"); ht.Add("msg", "success"); try { - JObject jobject = JObject.Parse(json); int page = 0, count = 0, query = 0, total = 0; foreach (var item in jobject) { @@ -178,16 +176,16 @@ public ActionResult Query([FromBody]string json) /// /// [HttpPost("/add")] - public ActionResult Add([FromBody]string json) + public ActionResult Add([FromBody]JObject jobject) { - json = HttpUtility.UrlDecode(json); + JObject ht = new JObject(); ht.Add("code", "200"); ht.Add("msg", "success"); try { - JObject jobject = JObject.Parse(json); - var sb = new System.Text.StringBuilder(100); + + foreach (var item in jobject) { @@ -222,16 +220,13 @@ public ActionResult Add([FromBody]string json) /// /// [HttpPost("/edit")] - public ActionResult Edit([FromBody]string json) + public ActionResult Edit([FromBody]JObject jobject) { - json = HttpUtility.UrlDecode(json); JObject ht = new JObject(); ht.Add("code", "200"); ht.Add("msg", "success"); try { - JObject jobject = JObject.Parse(json); - foreach (var item in jobject) { string key = item.Key.Trim(); @@ -276,16 +271,14 @@ public ActionResult Edit([FromBody]string json) /// /// [HttpPost("/remove")] - public ActionResult Remove([FromBody]string json) + public ActionResult Remove([FromBody]JObject jobject) { - json = HttpUtility.UrlDecode(json); JObject ht = new JObject(); ht.Add("code", "200"); ht.Add("msg", "success"); try { var role = _identitySvc.GetRole(); - JObject jobject = JObject.Parse(json); foreach (var item in jobject) { string key = item.Key.Trim(); diff --git a/APIJSON.NET/APIJSON.NET/Startup.cs b/APIJSON.NET/APIJSON.NET/Startup.cs index 84a7dd2..15d9b6c 100644 --- a/APIJSON.NET/APIJSON.NET/Startup.cs +++ b/APIJSON.NET/APIJSON.NET/Startup.cs @@ -12,10 +12,7 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.IdentityModel.Tokens; - using SqlKata.Execution; using Swashbuckle.AspNetCore.Swagger; - using MySql.Data.MySqlClient; - using SqlKata.Compilers; public class Startup { diff --git a/APIJSON.NET/APIJSON.NET/wwwroot/js/main.js b/APIJSON.NET/APIJSON.NET/wwwroot/js/main.js index 829ccae..7f32e28 100644 --- a/APIJSON.NET/APIJSON.NET/wwwroot/js/main.js +++ b/APIJSON.NET/APIJSON.NET/wwwroot/js/main.js @@ -147,7 +147,7 @@ url: $('#rest-url').val(), type: "POST", dataType: "json", contentType: "application/json;charset=utf-8", - data: JSON.stringify($('#vInput').val()), + data: $('#vInput').val(), success: function (data) { App.jsonhtml = data;