新增TCP扩展
This commit is contained in:
1 parent
514d6f5255
commit
f119665d29
26 files changed
+2457
-34
No files matched your search
@@ -58,6 +58,11 @@ namespace WalkingTec.Mvvm.Core
|
||||
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
|
||||
public string TenantCode { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.Request")]
|
||||
public string Request { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.Response")]
|
||||
public string Result { get; set; }
|
||||
public object Clone()
|
||||
{
|
||||
return this.MemberwiseClone();
|
||||
@@ -74,6 +79,8 @@ namespace WalkingTec.Mvvm.Core
|
||||
|-Url:{this.ActionUrl ?? ""}
|
||||
|-{Core.CoreProgram._localizer?["_Admin.Duration"]}:{this.Duration.ToString("F2")+" s"}
|
||||
|-{Core.CoreProgram._localizer?["_Admin.Remark"]}:{this.Remark}
|
||||
|-{Core.CoreProgram._localizer?["_Admin.Request"]}:{this.Request}
|
||||
|-{Core.CoreProgram._localizer?["_Admin.Result"]}:{this.Result}
|
||||
";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.IdentityModel.Tokens.Jwt;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Json;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text.Json;
|
||||
@@ -824,7 +825,7 @@ params string[] groupcode)
|
||||
return isPublic;
|
||||
}
|
||||
|
||||
public void DoLog(string msg, ActionLogTypesEnum logtype = ActionLogTypesEnum.Normal, string moduleName = "", string actionName = "", string ip = "", string url = "", double duration = 0)
|
||||
public void DoLog(string msg, ActionLogTypesEnum logtype = ActionLogTypesEnum.Normal, string moduleName = "", string actionName = "", string ip = "", string url = "", double duration = 0,string request = "", string result = "")
|
||||
{
|
||||
var log = this.Log?.GetActionLog();
|
||||
if (log == null)
|
||||
@@ -838,6 +839,8 @@ params string[] groupcode)
|
||||
log.Duration = duration;
|
||||
log.ModuleName = moduleName;
|
||||
log.ActionName = actionName;
|
||||
log.Request = request;
|
||||
log.Result = result;
|
||||
log.IP = ip;
|
||||
if (string.IsNullOrEmpty(url) && this.HttpContext?.Request != null)
|
||||
{
|
||||
@@ -1167,6 +1170,7 @@ params string[] groupcode)
|
||||
public async Task<ApiResult<T>> CallAPI<T>(string domainName, string url, HttpMethodEnum method, HttpContent content, int? timeout = null, string proxy = null, Dictionary<string, string> headers = null) where T : class
|
||||
{
|
||||
ApiResult<T> rv = new ApiResult<T>();
|
||||
var request = content.ReadAsStringAsync().Result;
|
||||
try
|
||||
{
|
||||
var factory = this.ServiceProvider.GetRequiredService<IHttpClientFactory>();
|
||||
@@ -1183,6 +1187,7 @@ params string[] groupcode)
|
||||
else
|
||||
{
|
||||
client = factory.CreateClient(domainName);
|
||||
client.BaseAddress = new Uri(ConfigInfo.Domains[domainName.ToLower()].Address);
|
||||
}
|
||||
if (headers != null)
|
||||
{
|
||||
@@ -1266,12 +1271,13 @@ params string[] groupcode)
|
||||
}
|
||||
rv.ErrorMsg = responseTxt;
|
||||
}
|
||||
|
||||
this.DoLog("send",ActionLogTypesEnum.Normal, domainName,url,url:url,request:request,result: JsonSerializer.Serialize(rv.Data));
|
||||
return rv;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
rv.ErrorMsg = ex.ToString();
|
||||
this.DoLog("send", ActionLogTypesEnum.Exception, domainName,url, request: request, result: ex.Message);
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user