增加审核参数
This commit is contained in:
@@ -1,9 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Web.Http;
|
||||
using System.Web.Http.Description;
|
||||
using System.Web.UI.WebControls;
|
||||
using log4net;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.Common;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.Entity;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.Json;
|
||||
@@ -22,7 +27,7 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
|
||||
/// <summary>
|
||||
/// 日志组件
|
||||
/// </summary>
|
||||
protected readonly ILog logInfo = LogManager.GetLogger("logInfo");
|
||||
protected readonly ILog _logInfo = LogManager.GetLogger("logInfo");
|
||||
|
||||
/// <summary>
|
||||
/// U8登录接口
|
||||
@@ -36,7 +41,8 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
|
||||
{
|
||||
try
|
||||
{
|
||||
logInfo.Debug($"当前接口:api/U8/DP/Login,参数:{input.ToJson()}");
|
||||
|
||||
_logInfo.Debug($"当前接口:api/U8/DP/Login,参数:{input.ToJson()}");
|
||||
|
||||
var db = CommUnit.GetDbClient();
|
||||
|
||||
@@ -81,7 +87,7 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logInfo.Error(ex.Message, ex);
|
||||
_logInfo.Error(ex.Message, ex);
|
||||
|
||||
await Task.Delay(1);
|
||||
|
||||
@@ -90,7 +96,6 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// U8登录接口
|
||||
/// </summary>
|
||||
@@ -103,7 +108,7 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
|
||||
try
|
||||
{
|
||||
|
||||
logInfo.Debug($"当前接口:api/U8/DP/Login/Token,参数:{input.ToJson()}");
|
||||
_logInfo.Debug($"当前接口:api/U8/DP/Login/Token,参数:{input.ToJson()}");
|
||||
|
||||
var token = CommUnit.GetUserToken(input.userToken);
|
||||
|
||||
@@ -123,7 +128,7 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logInfo.Error(ex.Message, ex);
|
||||
_logInfo.Error(ex.Message, ex);
|
||||
|
||||
await Task.Delay(1);
|
||||
|
||||
@@ -149,7 +154,7 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logInfo.Error(ex.Message, ex);
|
||||
_logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<string> { bSuccess = false, message = "登录失败", result = ex.Message };
|
||||
}
|
||||
@@ -176,7 +181,7 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logInfo.Error(ex.Message, ex);
|
||||
_logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<dynamic> { bSuccess = false, message = "查询失败", result = ex.Message };
|
||||
}
|
||||
@@ -200,7 +205,7 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logInfo.Error(ex.Message, ex);
|
||||
_logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<string> { bSuccess = false, message = "加密失败", result = ex.Message };
|
||||
}
|
||||
@@ -224,7 +229,7 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logInfo.Error(ex.Message, ex);
|
||||
_logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<string> { bSuccess = false, message = "解密失败", result = ex.Message };
|
||||
}
|
||||
@@ -259,7 +264,7 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logInfo.Debug($"密码未加密:{ex.Message},将进行密码加密");
|
||||
_logInfo.Debug($"密码未加密:{ex.Message},将进行密码加密");
|
||||
|
||||
input.cPassword = CommUnit.GetEncrypt(input.cPassword);
|
||||
}
|
||||
@@ -270,7 +275,7 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logInfo.Error(ex.Message, ex);
|
||||
_logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<dynamic> { bSuccess = false, message = "新增失败", result = ex.Message };
|
||||
}
|
||||
@@ -306,7 +311,7 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logInfo.Debug($"密码未加密:{ex.Message},将进行密码加密");
|
||||
_logInfo.Debug($"密码未加密:{ex.Message},将进行密码加密");
|
||||
|
||||
input.cPassword = CommUnit.GetEncrypt(input.cPassword);
|
||||
}
|
||||
@@ -317,7 +322,7 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logInfo.Error(ex.Message, ex);
|
||||
_logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<dynamic> { bSuccess = false, message = "更新失败", result = ex.Message };
|
||||
}
|
||||
@@ -344,10 +349,110 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logInfo.Error(ex.Message, ex);
|
||||
_logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<dynamic> { bSuccess = false, message = "查询失败", result = ex.Message };
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 上传配置
|
||||
/// </summary>
|
||||
/// <param name="cKey"></param>
|
||||
/// <param name="inputs"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("api/U8/DP/UploadConfig")]
|
||||
public async Task<BaseResult<string>> UploadConfig(string cKey,[FromBody] List<Dictionary<string,object>> inputs)
|
||||
{
|
||||
try
|
||||
{
|
||||
var fileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"App_Data/{cKey}.json");
|
||||
|
||||
File.WriteAllText(fileName, inputs.ToJson());
|
||||
|
||||
return new BaseResult<string>()
|
||||
{
|
||||
result = "上传成功",
|
||||
message = "上传成功",
|
||||
bSuccess = true
|
||||
};
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logInfo.Error(ex.Message, ex);
|
||||
|
||||
await Task.Delay(1);
|
||||
|
||||
return new BaseResult<string> { bSuccess = false, message = "查询失败", result = ex.Message };
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 下载配置
|
||||
/// </summary>
|
||||
/// <param name="cKey"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("api/U8/DP/DownloadConfig")]
|
||||
public async Task<BaseResult<string>> DownloadConfig(string cKey)
|
||||
{
|
||||
try
|
||||
{
|
||||
var fileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"App_Data/{cKey}.json");
|
||||
|
||||
var txt=File.ReadAllText(fileName );
|
||||
|
||||
return new BaseResult<string>()
|
||||
{
|
||||
result = txt,
|
||||
message = "上传成功",
|
||||
bSuccess = true
|
||||
};
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logInfo.Error(ex.Message, ex);
|
||||
|
||||
await Task.Delay(1);
|
||||
|
||||
return new BaseResult<string> { bSuccess = false, message = "查询失败", result = ex.Message };
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询日志
|
||||
/// </summary>
|
||||
/// <param name="dDate"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("api/U8/DP/LoadLog")]
|
||||
public async Task<string> LoadLog(string dDate)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!DateTime.TryParse(dDate, out var cDate))
|
||||
{
|
||||
throw new Exception("日期格式错误");
|
||||
}
|
||||
|
||||
var fileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"Log/Log_{cDate:yyyyMMdd}.log");
|
||||
|
||||
var txt = File.ReadAllLines(fileName);
|
||||
|
||||
return string.Join(Environment.NewLine, txt);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logInfo.Error(ex.Message, ex);
|
||||
|
||||
await Task.Delay(1);
|
||||
|
||||
return ex.Message;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user