This commit is contained in:
2024-04-11 17:31:32 +08:00
parent f6eaa2f481
commit 4fbc6c0267
200 changed files with 1252 additions and 1860 deletions

View File

@@ -47,8 +47,6 @@ namespace JNPF.Systems;
/// <summary>
/// 数据接口
/// 版 本V3.2
/// 版 权引迈信息技术有限公司https://www.jnpfsoft.com
/// 作 者JNPF开发平台组
/// 日 期2021-06-01.
/// </summary>
[ApiDescriptionSettings(Tag = "System", Name = "DataInterface", Order = 204)]
@@ -314,6 +312,7 @@ public class DataInterfaceService : IDataInterfaceService, IDynamicApiController
/// <returns></returns>
[HttpPost("{id}/Actions/Preview")]
[UnitOfWork]
[AllowAnonymous]
public async Task<dynamic> Preview(string id, [FromBody] DataInterfacePreviewInput input)
{
_configId = _userManager.TenantId;
@@ -325,6 +324,11 @@ public class DataInterfaceService : IDataInterfaceService, IDynamicApiController
{
dicParameters = input.paramList.ToDictionary(x => x.field, y => y.defaultValue);
}
if (!string.IsNullOrEmpty(info.Path) && !info.Path.StartsWith("http"))
{
info.Path = $"{App.HttpContext.Request.Scheme}://{App.HttpContext.Request.Host}{info.Path}";
}
VerifyRequired(info, dicParameters);
ReplaceParameterValue(info, dicParameters);
if (info?.DataType == 1)
@@ -558,6 +562,7 @@ public class DataInterfaceService : IDataInterfaceService, IDynamicApiController
[UnitOfWork]
public async Task<dynamic> GetFields(string id, [FromBody] DataInterfacePreviewInput input)
{
Object tempObj = null;
try
{
//modifyby zhoukeda 20230803
@@ -569,12 +574,22 @@ public class DataInterfaceService : IDataInterfaceService, IDynamicApiController
}
else
{
return result.ToObject<List<Dictionary<string, object>>>().FirstOrDefault().Keys.ToList();
tempObj = result;
var list = result.ToObject<List<Dictionary<string, object>>>().FirstOrDefault().Keys.ToList();
return list;
}
}
catch (Exception e)
{
throw Oops.Oh(ErrorCode.COM1020);
try
{
return JsonConvert.DeserializeObject<List<Dictionary<string,object>>>(JsonConvert.SerializeObject(tempObj)).FirstOrDefault().Keys.ToList();
}
catch (Exception exception)
{
throw Oops.Oh(ErrorCode.COM1020);
}
}
}
#endregion