新增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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ namespace WalkingTec.Mvvm.Mvc
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_sharedir == null)
|
||||
/*if (_sharedir == null)
|
||||
{
|
||||
var up = Directory.GetParent(MainDir);
|
||||
var sharedir = up.GetDirectories().Where(x => x.Name.ToLower().EndsWith(".shared")).FirstOrDefault();
|
||||
@@ -148,7 +148,7 @@ namespace WalkingTec.Mvvm.Mvc
|
||||
}
|
||||
|
||||
_sharedir = sharedir.FullName;
|
||||
}
|
||||
}*/
|
||||
return _sharedir;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,13 +19,18 @@ using WalkingTec.Mvvm.Core.Json;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.AspNetCore.Mvc.ViewEngines;
|
||||
using WalkingTec.Mvvm.Core.Extensions;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Internal;
|
||||
using System.Dynamic;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
|
||||
namespace WalkingTec.Mvvm.Mvc.Filters
|
||||
{
|
||||
public class FrameworkFilter : ActionFilterAttribute
|
||||
{
|
||||
private string requestMsg = "";
|
||||
public override void OnActionExecuting(ActionExecutingContext context)
|
||||
{
|
||||
requestMsg = Newtonsoft.Json.JsonConvert.SerializeObject( context.ActionArguments);
|
||||
var ctrl = context.Controller as IBaseController;
|
||||
if (ctrl == null)
|
||||
{
|
||||
@@ -385,6 +390,12 @@ namespace WalkingTec.Mvvm.Mvc.Filters
|
||||
log.ActionUrl = context.HttpContext.Request.Path;
|
||||
log.IP = context.HttpContext.GetRemoteIpAddress();
|
||||
log.Remark = context.Exception?.ToString() ?? string.Empty;
|
||||
log.Request = requestMsg;
|
||||
if (log.ModuleName.StartsWith("HHWMS"))
|
||||
{
|
||||
dynamic reMsg = context.Result as dynamic;
|
||||
log.Result = Newtonsoft.Json.JsonConvert.SerializeObject(reMsg?.Value);
|
||||
}
|
||||
if (string.IsNullOrEmpty(log.Remark) == false && log.Remark.Length > 2000)
|
||||
{
|
||||
log.Remark = log.Remark.Substring(0, 2000);
|
||||
|
||||
@@ -654,7 +654,7 @@ setTimeout(function(){{
|
||||
}})
|
||||
</script>
|
||||
<script type=""text / html"" id=""{ToolBarId}2"" >
|
||||
<div id=""{Id}buttons""style=""text-align:right;margin-right:{lefttoolbarmergin}px"">{toolBarBtnStrBuilder}</div>
|
||||
<div id=""{Id}buttons""style=""margin-right:{lefttoolbarmergin}px"">{toolBarBtnStrBuilder}</div>
|
||||
</script>
|
||||
<!-- Grid 行内按钮 -->
|
||||
<script type=""text/html"" id=""{ToolBarId}"">{rowBtnStrBuilder}</script>
|
||||
|
||||
Reference in new issue
Block a user