Browse Source

提交

master
gwbvipvip 6 months ago
parent
commit
a9194ee557
5 changed files with 56 additions and 3 deletions
  1. BIN
     
  2. BIN
     
  3. +2
    -2
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/CheckService/Services/CheckServices.cs
  4. +28
    -0
      BPA.SAAS.Manage.Core/System/BPA_ThirdpartyRequestLog.cs
  5. +26
    -1
      BPA.SAAS.Manage.Web.Core/Handlers/RequestAuditFiltercs.cs

BIN
View File


BIN
View File


+ 2
- 2
BPA.SAAS.Manage.Application/AExternalPlatform/Service/CheckService/Services/CheckServices.cs View File

@@ -12,6 +12,7 @@ using System.Text;
using System.Threading.Tasks;
using BPA.SAAS.KitChenManage.Core;
using BPA.KitChen.GroupMeal.SqlSugar;
using BPA.SAAS.Manage.Core.System;

namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.CheckService.Services
{
@@ -36,8 +37,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.CheckService.Ser
}
}



/// <summary>
/// 检查平key验证
/// </summary>


+ 28
- 0
BPA.SAAS.Manage.Core/System/BPA_ThirdpartyRequestLog.cs View File

@@ -0,0 +1,28 @@
using BPA.SAAS.Manage.Core.Base;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.SAAS.Manage.Core.System
{

/// <summary>
/// 第三方日志
/// </summary>
[SugarTable("bpa_thirdpartyrequestlog")]
public class BPA_ThirdpartyRequestLog : IBaseEntity, IGroupId
{
public string GroupId { get; set; }

public string RequestUrl { get; set; }

public string ReauestMethod { get; set; }

public string ResultParm { get; set; }

public string IP { get; set; }
}
}

+ 26
- 1
BPA.SAAS.Manage.Web.Core/Handlers/RequestAuditFiltercs.cs View File

@@ -1,6 +1,9 @@
using BPA.SAAS.Manage.Application.AExternalPlatform.BaseDto;
using BPA.KitChen.GroupMeal.SqlSugar;
using BPA.SAAS.KitChenManage.Core;
using BPA.SAAS.Manage.Application.AExternalPlatform.BaseDto;
using BPA.SAAS.Manage.Application.AExternalPlatform.Enum;
using BPA.SAAS.Manage.Application.AExternalPlatform.Service.CheckService.Services;
using BPA.SAAS.Manage.Core.System;
using Furion;
using Furion.EventBus;
using Furion.FriendlyException;
@@ -46,6 +49,12 @@ namespace BPA.SAAS.Manage.Web.Core
// 获取来源 Url 地址
var refererUrl = httpRequest.GetRefererUrlAddress();

// 获取控制器、路由信息
var actionDescriptor = context.ActionDescriptor as ControllerActionDescriptor;

// 获取请求的方法
var method = actionDescriptor.MethodInfo;

if (requestUrl.ToUpper().Contains("ExternalPlatform".ToUpper()))
{
// 获取请求参数(写入日志,需序列化成字符串后存储)
@@ -69,6 +78,22 @@ namespace BPA.SAAS.Manage.Web.Core

// 判断是否请求成功,没有异常就是请求成功
var isRequestSucceed = actionContext.Exception == null;
try
{
await SqlSugarDb.Db.Insertable(new BPA_ThirdpartyRequestLog()
{
CreateBy=DateTime.Now.ToString(),
GroupId= CurrentUser.GroupId,
RequestUrl= requestUrl,
ReauestMethod= httpRequest.Method,
ResultParm= returnResult == null ? "" : JsonConvert.SerializeObject(returnResult),
IP= remoteIPv4
}).ExecuteCommandAsync();

}
catch (Exception e)
{
}
}
}
}

Loading…
Cancel
Save