Commit 934df22c by lcx

后端http请求统一使用restsharp

parent 46d49c12
...@@ -17,17 +17,18 @@ namespace Performance.Api.Controllers ...@@ -17,17 +17,18 @@ namespace Performance.Api.Controllers
[ApiController] [ApiController]
public class ExConfigController : Controller public class ExConfigController : Controller
{ {
private readonly ILogger<ExConfigController> logger; private ILogger logger;
private WebapiUrl options;
private ExConfigService configService; private ExConfigService configService;
private WebapiUrl url;
public ExConfigController( public ExConfigController(
ILogger<ExConfigController> logger, ILogger<ExConfigController> logger,
ExConfigService configService, IOptions<WebapiUrl> options,
IOptions<WebapiUrl> url) ExConfigService configService)
{ {
this.logger = logger; this.logger = logger;
this.options = options.Value;
this.configService = configService; this.configService = configService;
this.url = url.Value;
} }
/// <summary> /// <summary>
...@@ -70,8 +71,11 @@ public ApiResponse FeeSource([FromBody] ModModuleRequest request) ...@@ -70,8 +71,11 @@ public ApiResponse FeeSource([FromBody] ModModuleRequest request)
if (request.HospitalId == null || request.HospitalId.Value == 0) if (request.HospitalId == null || request.HospitalId.Value == 0)
return new ApiResponse(ResponseType.ParameterError, "HospitalId 参数错误!"); return new ApiResponse(ResponseType.ParameterError, "HospitalId 参数错误!");
string retJson = HttpHelper.HttpPost(url.HttpPost + "/modextract/source", JsonHelper.Serialize(request), true); var http = new RestSharpHelper();
var ret = JsonHelper.Deserialize<ApiResponse>(retJson); var url = http.SetUrl(options.HttpPost, "/modextract/source");
var req = http.CreatePostRequest(JsonHelper.Serialize(request));
var res = http.GetResponse(url, req);
var ret = http.GetContent<ApiResponse>(res);
return new ApiResponse(ResponseType.OK, ret.Data); return new ApiResponse(ResponseType.OK, ret.Data);
} }
...@@ -166,8 +170,14 @@ public ApiResponse Items([FromBody] ModItemRequest request) ...@@ -166,8 +170,14 @@ public ApiResponse Items([FromBody] ModItemRequest request)
if (sheetType == (int)SheetType.Income) if (sheetType == (int)SheetType.Income)
{ {
logger.LogInformation($"绩效收入模板配置项列表 : 请求地址 {url.HttpPost}/modextract/items"); logger.LogInformation($"绩效收入模板配置项列表 : 请求地址 {options.HttpPost}/modextract/items");
HttpHelper.HttpPost(url.HttpPost + "/modextract/items", JsonHelper.Serialize(request), true);
var http = new RestSharpHelper();
var url = http.SetUrl(options.HttpPost, "/modextract/items");
var req = http.CreatePostRequest(JsonHelper.Serialize(request));
var res = http.GetResponse(url, req);
var ret = http.GetContent<ApiResponse>(res);
logger.LogInformation($"绩效收入模板配置项列表在{DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss完成请求")}"); logger.LogInformation($"绩效收入模板配置项列表在{DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss完成请求")}");
} }
var list = configService.QueryItems(request.ModuleId.Value); var list = configService.QueryItems(request.ModuleId.Value);
...@@ -204,8 +214,8 @@ public ApiResponse DelItem([FromBody] ModItemRequest request) ...@@ -204,8 +214,8 @@ public ApiResponse DelItem([FromBody] ModItemRequest request)
return new ApiResponse(ResponseType.OK, "删除成功!"); return new ApiResponse(ResponseType.OK, "删除成功!");
} }
#region 特殊科室模板 #region 特殊科室模板
/// <summary> /// <summary>
/// 特殊科室模板配置项新增 /// 特殊科室模板配置项新增
/// </summary> /// </summary>
...@@ -266,7 +276,6 @@ public ApiResponse DelSpecial([FromBody] ModSpecialRequest request) ...@@ -266,7 +276,6 @@ public ApiResponse DelSpecial([FromBody] ModSpecialRequest request)
return new ApiResponse(ResponseType.OK, "删除成功!"); return new ApiResponse(ResponseType.OK, "删除成功!");
} }
/// <summary> /// <summary>
/// 特殊科室人均 /// 特殊科室人均
/// </summary> /// </summary>
...@@ -278,7 +287,8 @@ public ApiResponse PerforType() ...@@ -278,7 +287,8 @@ public ApiResponse PerforType()
var list = configService.PerforType(); var list = configService.PerforType();
return new ApiResponse(ResponseType.OK, list); return new ApiResponse(ResponseType.OK, list);
} }
#endregion
#endregion 特殊科室模板
/// <summary> /// <summary>
/// 数据配置项 /// 数据配置项
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Threading.Tasks;
namespace Performance.Api.Controllers namespace Performance.Api.Controllers
{ {
...@@ -79,15 +80,19 @@ public IActionResult DownFile(int type = 1) ...@@ -79,15 +80,19 @@ public IActionResult DownFile(int type = 1)
case 1: case 1:
path = Path.Combine(env.ContentRootPath, "Template", "医院绩效模板.xls"); path = Path.Combine(env.ContentRootPath, "Template", "医院绩效模板.xls");
break; break;
case 2: case 2:
path = Path.Combine(env.ContentRootPath, "Template", "医院二次分配绩效模板.xlsx"); path = Path.Combine(env.ContentRootPath, "Template", "医院二次分配绩效模板.xlsx");
break; break;
case 3: case 3:
path = Path.Combine(env.ContentRootPath, "Template", "医院绩效模板(无执行科室).xlsx"); path = Path.Combine(env.ContentRootPath, "Template", "医院绩效模板(无执行科室).xlsx");
break; break;
case 4: case 4:
path = Path.Combine(env.ContentRootPath, "Template", "医院人员绩效模板.xls"); path = Path.Combine(env.ContentRootPath, "Template", "医院人员绩效模板.xls");
break; break;
case 5: case 5:
path = Path.Combine(env.ContentRootPath, "Template", "工作量数据导入模板.xls"); path = Path.Combine(env.ContentRootPath, "Template", "工作量数据导入模板.xls");
break; break;
...@@ -158,6 +163,7 @@ public ApiResponse Import([FromForm] IFormCollection form) ...@@ -158,6 +163,7 @@ public ApiResponse Import([FromForm] IFormCollection form)
} }
#region 老版提取 #region 老版提取
///// <summary> ///// <summary>
///// 提取绩效数据 ///// 提取绩效数据
///// </summary> ///// </summary>
...@@ -218,9 +224,11 @@ public ApiResponse Import([FromForm] IFormCollection form) ...@@ -218,9 +224,11 @@ public ApiResponse Import([FromForm] IFormCollection form)
// throw ex; // throw ex;
// } // }
//} //}
#endregion
#endregion 老版提取
#region 新版提取 #region 新版提取
/// <summary> /// <summary>
/// 提取绩效数据 /// 提取绩效数据
/// </summary> /// </summary>
...@@ -254,11 +262,22 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest ...@@ -254,11 +262,22 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest
} }
else else
{ {
logger.LogInformation("提取绩效数据请求路径:" + url.HttpPost + "/extract/extract"); var http = new RestSharpHelper();
if (string.IsNullOrEmpty(filePath)) string endpoint = "/extract/extract";
HttpHelper.HttpPostNoRequest(url.HttpPost + $"/extract/extract?allotId={request.AllotId}&hospitalId={request.HospitalId}&email={email}&userId={claim.GetUserId()}", ""); var extractUrl = http.SetUrl(url.HttpPost, endpoint);
else
HttpHelper.HttpClient(url.HttpPost + $"/extract/extract?allotId={request.AllotId}&hospitalId={request.HospitalId}&email={email}&userId={claim.GetUserId()}", filePath, true); var obj = new
{
allotId = request.AllotId,
hospitalId = request.HospitalId,
email = email,
userId = claim.GetUserId()
};
string json = JsonHelper.Serialize(obj);
var parameter = JsonHelper.Deserialize<Dictionary<string, object>>(json);
var restRequest = string.IsNullOrEmpty(filePath) ? http.CreatePostRequest(json) : http.CreateFileRequest(new string[] { filePath }, parameter);
Task.Run(() => http.GetResponse(extractUrl, restRequest));
} }
return new ApiResponse(ResponseType.OK, "HIS绩效数据提取任务正在执行,稍后我们将以邮件的通知您!", new { IsExtracting = false }); return new ApiResponse(ResponseType.OK, "HIS绩效数据提取任务正在执行,稍后我们将以邮件的通知您!", new { IsExtracting = false });
...@@ -281,8 +300,8 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest ...@@ -281,8 +300,8 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest
// B 使用配置作为模板 // B 使用配置作为模板
} }
#endregion
#endregion 新版提取
/// <summary> /// <summary>
/// 从WebAPI下载文件 /// 从WebAPI下载文件
...@@ -314,26 +333,31 @@ public IActionResult DownFile([FromQuery] AllotRequest request) ...@@ -314,26 +333,31 @@ public IActionResult DownFile([FromQuery] AllotRequest request)
/// <summary> /// <summary>
/// 保存提取文件 /// 保存提取文件
/// </summary> /// </summary>
/// <param name="form"></param>
/// <param name="allotId"></param>
/// <param name="hospitalId"></param>
/// <returns></returns> /// <returns></returns>
[Route("savefile")] [Route("savefile")]
[HttpPost] [HttpPost]
[AllowAnonymous] [AllowAnonymous]
public ApiResponse SaveFile([FromForm] IFormCollection form, int allotId, int hospitalId) public ApiResponse SaveFile()
{ {
logger.LogInformation($"保存提取文件请求参数:allotId:{allotId} hospitalId:{hospitalId}"); Dictionary<string, object> dict = new Dictionary<string, object>();
try foreach (var key in Request.Form.Keys)
{ {
var file = ((FormFileCollection)form.Files).FirstOrDefault(); dict.Add(key, Request.Form[key]);
if (file == null) }
{ string json = JsonHelper.Serialize(dict);
logger.LogError($"返回文件为空!"); var request = JsonHelper.Deserialize<ExtractRequest>(json);
return new ApiResponse(ResponseType.Error, "上传文件无效");
}
var dpath = Path.Combine(env.ContentRootPath, "Files", $"{hospitalId}", "autoextract"); if (Request.Form.Files == null || !Request.Form.Files.Any())
{
logger.LogError($"返回文件为空!");
return new ApiResponse(ResponseType.Error, "上传文件无效");
}
logger.LogInformation("保存提取文件请求参数:" + json);
try
{
var file = Request.Form.Files[0];
var dpath = Path.Combine(env.ContentRootPath, "Files", $"{request.HospitalId}", "autoextract");
FileHelper.CreateDirectory(dpath); FileHelper.CreateDirectory(dpath);
var path = Path.Combine(dpath, FileHelper.GetFileName(file.FileName)); var path = Path.Combine(dpath, FileHelper.GetFileName(file.FileName));
...@@ -349,24 +373,22 @@ public ApiResponse SaveFile([FromForm] IFormCollection form, int allotId, int ho ...@@ -349,24 +373,22 @@ public ApiResponse SaveFile([FromForm] IFormCollection form, int allotId, int ho
return new ApiResponse(ResponseType.Error, "保存失败"); return new ApiResponse(ResponseType.Error, "保存失败");
} }
} }
var allot = allotService.GetAllot(allotId); var allot = allotService.GetAllot(request.AllotId);
allot.ExtractPath = path; allot.ExtractPath = path;
allot.IsExtracting = 2; allot.IsExtracting = 2;
if (string.IsNullOrEmpty(path) || !FileHelper.IsExistFile(path))
{ string success = "上传成功!";
logger.LogInformation($"保存提取文件文件未保存成功,保存文件不存在!"); string message = (string.IsNullOrEmpty(path) || !FileHelper.IsExistFile(path))
return new ApiResponse(ResponseType.Fail, "上传成功!"); ? "保存提取文件文件未保存成功,保存文件不存在!"
} : (!allotService.Update(allot)) ? "保存提取文件更新文件路径失败!" : success;
if (!allotService.Update(allot))
{ if (message == success)
logger.LogInformation($"保存提取文件更新文件路径失败!"); return new ApiResponse(ResponseType.OK, message);
return new ApiResponse(ResponseType.Fail, "上传成功!"); else
} return new ApiResponse(ResponseType.Fail, message);
return new ApiResponse(ResponseType.OK, "上传成功!");
} }
catch (Exception ex) catch (Exception ex)
{ {
logger.LogInformation($"保存提取文件异常{ex.ToString()}");
logger.LogError($"保存提取文件保存失败:" + ex.ToString()); logger.LogError($"保存提取文件保存失败:" + ex.ToString());
return new ApiResponse(ResponseType.Error, ex.Message); return new ApiResponse(ResponseType.Error, ex.Message);
} }
...@@ -375,24 +397,20 @@ public ApiResponse SaveFile([FromForm] IFormCollection form, int allotId, int ho ...@@ -375,24 +397,20 @@ public ApiResponse SaveFile([FromForm] IFormCollection form, int allotId, int ho
/// <summary> /// <summary>
/// 返回日志 /// 返回日志
/// </summary> /// </summary>
/// <param name="type">1 进度条 2 信息</param> /// <param name="request"></param>
/// <param name="tag"></param>
/// <param name="message"></param>
/// <param name="level"></param>
/// <param name="groupName"></param>
[Route("returnlog")] [Route("returnlog")]
[HttpPost] [HttpPost]
[AllowAnonymous] [AllowAnonymous]
public void ReturnLog(int type, string tag, string message, int level, string groupName) public void ReturnLog([FromBody] SignalrLogRequest request)
{ {
logger.LogInformation("返回日志:" + JsonHelper.Serialize(new { type, tag, message, level, groupName })); logger.LogInformation("返回日志:" + JsonHelper.Serialize(request));
if (type == 3) if (request.Type == 3)
{ {
logService.Schedule(groupName, ConvertHelper.To<decimal>(message), level); logService.Schedule(request.GroupName, ConvertHelper.To<decimal>(request.Message), request.Level);
} }
else else
{ {
logService.ExtractLog(groupName, tag, message, level); logService.ExtractLog(request.GroupName, request.Tag, request.Message, request.Level);
} }
} }
...@@ -443,4 +461,4 @@ public IActionResult ExtractIncome(int allotId) ...@@ -443,4 +461,4 @@ public IActionResult ExtractIncome(int allotId)
return File(memoryStream, memi, Path.GetFileName(filepath)); return File(memoryStream, memi, Path.GetFileName(filepath));
} }
} }
} }
\ No newline at end of file
...@@ -1310,24 +1310,17 @@ ...@@ -1310,24 +1310,17 @@
</summary> </summary>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.TemplateController.SaveFile(Microsoft.AspNetCore.Http.IFormCollection,System.Int32,System.Int32)"> <member name="M:Performance.Api.Controllers.TemplateController.SaveFile">
<summary> <summary>
保存提取文件 保存提取文件
</summary> </summary>
<param name="form"></param>
<param name="allotId"></param>
<param name="hospitalId"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.TemplateController.ReturnLog(System.Int32,System.String,System.String,System.Int32,System.String)"> <member name="M:Performance.Api.Controllers.TemplateController.ReturnLog(Performance.DtoModels.SignalrLogRequest)">
<summary> <summary>
返回日志 返回日志
</summary> </summary>
<param name="type">1 进度条 2 信息</param> <param name="request"></param>
<param name="tag"></param>
<param name="message"></param>
<param name="level"></param>
<param name="groupName"></param>
</member> </member>
<member name="M:Performance.Api.Controllers.TemplateController.ReturnLog(Performance.EntityModels.log_dbug)"> <member name="M:Performance.Api.Controllers.TemplateController.ReturnLog(Performance.EntityModels.log_dbug)">
<summary> <summary>
......
...@@ -1953,23 +1953,33 @@ ...@@ -1953,23 +1953,33 @@
<member name="P:Performance.DtoModels.ExtractRequest.AllotId"> <member name="P:Performance.DtoModels.ExtractRequest.AllotId">
<summary> <summary>
绩效ID 绩效ID
</summary> </summary>
</member> </member>
<member name="P:Performance.DtoModels.ExtractRequest.HospitalId"> <member name="P:Performance.DtoModels.ExtractRequest.HospitalId">
<summary> <summary>
医院ID 医院ID
</summary> </summary>
</member> </member>
<member name="P:Performance.DtoModels.ExtractRequest.UseScheme"> <member name="P:Performance.DtoModels.ExtractRequest.UseScheme">
<summary> <summary>
使用方案 使用方案
</summary> </summary>
</member> </member>
<member name="P:Performance.DtoModels.ExtractRequest.Email"> <member name="P:Performance.DtoModels.ExtractRequest.Email">
<summary> <summary>
邮箱 邮箱
</summary> </summary>
</member> </member>
<member name="P:Performance.DtoModels.ExtractRequest.GroupName">
<summary>
Signalr分组名称
</summary>
</member>
<member name="P:Performance.DtoModels.ExtractRequest.UserId">
<summary>
用户Id
</summary>
</member>
<member name="P:Performance.DtoModels.GuaranteeRequest.Id"> <member name="P:Performance.DtoModels.GuaranteeRequest.Id">
<summary> </summary> <summary> </summary>
</member> </member>
...@@ -3011,6 +3021,11 @@ ...@@ -3011,6 +3021,11 @@
保底来源科室 保底来源科室
</summary> </summary>
</member> </member>
<member name="P:Performance.DtoModels.HospitalResponse.IsOpenCMIPercent">
<summary>
是否开启科室CMI占比 1 启用 2 禁用
</summary>
</member>
<member name="P:Performance.DtoModels.HospitalResponse.IsOpenNursingDeptAudit"> <member name="P:Performance.DtoModels.HospitalResponse.IsOpenNursingDeptAudit">
<summary> <summary>
是否开启护理部审核 1 启用 2 禁用 是否开启护理部审核 1 启用 2 禁用
......
...@@ -9,17 +9,17 @@ public class ExtractRequest ...@@ -9,17 +9,17 @@ public class ExtractRequest
{ {
/// <summary> /// <summary>
/// 绩效ID /// 绩效ID
/// </summary> /// </summary>
public int AllotId { get; set; } public int AllotId { get; set; }
/// <summary> /// <summary>
/// 医院ID /// 医院ID
/// </summary> /// </summary>
public int HospitalId { get; set; } public int HospitalId { get; set; }
/// <summary> /// <summary>
/// 使用方案 /// 使用方案
/// </summary> /// </summary>
public int UseScheme { get; set; } public int UseScheme { get; set; }
/// <summary> /// <summary>
...@@ -27,9 +27,16 @@ public class ExtractRequest ...@@ -27,9 +27,16 @@ public class ExtractRequest
/// </summary> /// </summary>
public string Email { get; set; } public string Email { get; set; }
/// <summary>
/// Signalr分组名称
/// </summary>
public string GroupName { get; set; } public string GroupName { get; set; }
}
/// <summary>
/// 用户Id
/// </summary>
public int UserId { get; set; }
}
public class ExtractRequestValidator : AbstractValidator<ExtractRequest> public class ExtractRequestValidator : AbstractValidator<ExtractRequest>
{ {
......
using System;
using System.Collections.Generic;
using System.Text;
namespace Performance.DtoModels
{
public class SignalrLogRequest
{
public int Type { get; set; }
public string Tag { get; set; }
public string Message { get; set; }
public int Level { get; set; }
public string GroupName { get; set; }
}
}
using RestSharp;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Performance.Infrastructure
{
public class RestSharpHelper
{
public const string tokenHeader = "Authorization";
public RestClient SetUrl(string baseUrl, string endpoint)
{
var url = Path.Combine(baseUrl, endpoint);
var restClient = new RestClient(url);
return restClient;
}
public RestRequest CreateGetRequest(string tokenHeader = tokenHeader, string token = null, int timeout = -1)
{
var restRequest = new RestRequest(Method.GET);
restRequest.AddHeader(tokenHeader, token);
restRequest.AddHeader("Accept", "application/json");
restRequest.Timeout = timeout;
return restRequest;
}
public RestRequest CreatePostRequest(string payload, string tokenHeader = tokenHeader, string token = null, int timeout = -1)
{
var restRequest = new RestRequest(Method.POST);
restRequest.AddHeader(tokenHeader, token);
restRequest.AddHeader("Accept", "application/json");
restRequest.AddParameter("application/json", payload, ParameterType.RequestBody);
restRequest.Timeout = timeout;
return restRequest;
}
public RestRequest CreateFileRequest(string[] files, Dictionary<string, object> parameter = null, string tokenHeader = tokenHeader, string token = null, int timeout = -1)
{
var restRequest = new RestRequest(Method.POST);
restRequest.AddHeader(tokenHeader, token);
if (files != null && files.Any(t => !string.IsNullOrEmpty(t)))
{
int i = 1;
foreach (var file in files.Where(t => !string.IsNullOrEmpty(t)))
{
restRequest.AddFile(i.ToString(), file);
i++;
}
}
if (parameter != null)
{
foreach (var item in parameter)
{
restRequest.AddParameter(item.Key, item.Value);
}
}
restRequest.Timeout = timeout;
return restRequest;
}
public RestRequest CreatePutRequest(string payload, string tokenHeader = tokenHeader, string token = null, int timeout = -1)
{
var restRequest = new RestRequest(Method.PUT);
restRequest.AddHeader(tokenHeader, token);
restRequest.AddHeader("Accept", "application/json");
restRequest.AddParameter("application/json", payload, ParameterType.RequestBody);
restRequest.Timeout = timeout;
return restRequest;
}
public RestRequest CreateDeleteRequest(string tokenHeader = tokenHeader, string token = null, int timeout = -1)
{
var restRequest = new RestRequest(Method.DELETE);
restRequest.AddHeader(tokenHeader, token);
restRequest.AddHeader("Accept", "application/json");
restRequest.Timeout = timeout;
return restRequest;
}
public IRestResponse GetResponse(RestClient client, RestRequest request)
{
return client.Execute(request);
}
public async Task<IRestResponse> GetResponseAsync(RestClient client, RestRequest request)
{
return await client.ExecuteAsync(request);
}
public DTO GetContent<DTO>(IRestResponse response)
{
var content = response.Content;
DTO dtoObject = JsonHelper.Deserialize<DTO>(content);
return dtoObject;
}
}
}
using Microsoft.AspNetCore.SignalR; using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Performance.DtoModels;
using Performance.DtoModels.AppSettings; using Performance.DtoModels.AppSettings;
using Performance.Infrastructure; using Performance.Infrastructure;
using Performance.Repository; using Performance.Repository;
using System; using System;
using System.Threading.Tasks;
namespace Performance.Services namespace Performance.Services
{ {
...@@ -28,7 +30,7 @@ public class LogManageService : IAutoInjection ...@@ -28,7 +30,7 @@ public class LogManageService : IAutoInjection
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="tag">标签</param> /// <param name="tag">标签</param>
/// <param name="message">内容</param> /// <param name="message">内容</param>
...@@ -70,7 +72,7 @@ public void ExtractLog(string groupName, string tag, string message, int level) ...@@ -70,7 +72,7 @@ public void ExtractLog(string groupName, string tag, string message, int level)
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="allotId"></param> /// <param name="allotId"></param>
/// <param name="groupName"></param> /// <param name="groupName"></param>
...@@ -102,8 +104,20 @@ public void ReturnTheLog(int allotId, string groupName, int type, string tag, ob ...@@ -102,8 +104,20 @@ public void ReturnTheLog(int allotId, string groupName, int type, string tag, ob
logdbug.Add(allotId, tag, content, level, type); logdbug.Add(allotId, tag, content, level, type);
if (!isSingle) if (!isSingle)
{ {
var http = url.ImportFile + $"/template/returnlog?type={type}&tag={tag}&message={content}&level={level}&groupName={groupName}"; var http = new RestSharpHelper();
HttpHelper.HttpPost(http); var importUrl = http.SetUrl(url.ImportFile, "/template/returnlog");
var info = new SignalrLogRequest()
{
Type = type,
Tag = tag,
Message = content,
Level = level,
GroupName = groupName
};
string json = JsonHelper.Serialize(info);
var request = http.CreatePostRequest(json);
Task.Run(() => http.GetResponse(importUrl, request));
} }
} }
catch (Exception ex) catch (Exception ex)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment