接口预览字段返回修改
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Text.Json.Nodes;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using JNPF.Common.Configuration;
|
using JNPF.Common.Configuration;
|
||||||
@@ -41,6 +42,7 @@ using Microsoft.AspNetCore.Mvc;
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
|
using JNPF.Common.Filter;
|
||||||
|
|
||||||
namespace JNPF.Systems;
|
namespace JNPF.Systems;
|
||||||
|
|
||||||
@@ -611,35 +613,25 @@ public class DataInterfaceService : IDataInterfaceService, IDynamicApiController
|
|||||||
{
|
{
|
||||||
//modifyby zhoukeda 20230803
|
//modifyby zhoukeda 20230803
|
||||||
var result = await Preview(id, input);
|
var result = await Preview(id, input);
|
||||||
if (result is DataTable)
|
//if (result is Microsoft.ClearScript.V8.V8ScriptItem.V8Array)
|
||||||
|
if (result.ToString()=="Microsoft.ClearScript.V8.V8ScriptItem+V8Array")
|
||||||
{
|
{
|
||||||
List<Dictionary<string, Object>> list = JsonConvert.DeserializeObject<List<Dictionary<string, object>>>(JsonConvert.SerializeObject(result));
|
List<Dictionary<string, Object>> list = JsonConvert.DeserializeObject<List<Dictionary<string, object>>>(JsonConvert.SerializeObject(result));
|
||||||
return list.FirstOrDefault()?.Keys.ToList() ?? Enumerable.Empty<string>();
|
return list.FirstOrDefault()?.Keys.ToList() ?? Enumerable.Empty<string>();
|
||||||
}
|
}
|
||||||
|
else if (result.ToString() == "Microsoft.ClearScript.V8.V8ScriptItem")
|
||||||
|
{
|
||||||
|
PageResult<Dictionary<string, object>> page = JsonConvert.DeserializeObject<PageResult<Dictionary<string, object>>>(JsonConvert.SerializeObject(result));
|
||||||
|
return page.list.FirstOrDefault()?.Keys.ToList() ?? Enumerable.Empty<string>();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return result.ToObject<List<Dictionary<string, object>>>().FirstOrDefault().Keys.ToList();
|
return Enumerable.Empty<string>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
// if (e.Message == "TypeError: Method or property not found")
|
throw Oops.Oh(ErrorCode.COM1020);
|
||||||
// {
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var result = await PreviewWithOutJs(id, input);
|
|
||||||
List<Dictionary<string, Object>> list = JsonConvert.DeserializeObject<List<Dictionary<string, object>>>(result.ToString());
|
|
||||||
return list.FirstOrDefault()?.Keys.ToList() ?? Enumerable.Empty<string>();
|
|
||||||
}
|
|
||||||
catch (Exception exception)
|
|
||||||
{
|
|
||||||
throw Oops.Oh(ErrorCode.COM1020);
|
|
||||||
}
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// throw Oops.Oh(ErrorCode.COM1020);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
Reference in New Issue
Block a user