mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 19:53:27 +08:00
# 2022-04-10
### 1.4.4开源社区版: 无 ### 0.3.5 专业版: 【新增】增加用户操作日志,可记录接口也可记录后台,同时支持本地存储或数据库存储。支持配置文件开启。 【新增】数据库增加用户操作日志表。 【优化】优化反射获取所有Controller 和Action的全局方法,增加缓存设置。 【优化】优化记录IP请求数据的中间件。 【修复】修复ios下用户充值余额的功能不显示的情况。 【修复】修复我的余额面板列表中右侧三角无反应的问题。 【修复】修复代理中心下线人数和订单数量统计错误的问题。#I51OUC
This commit is contained in:
@@ -345,7 +345,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
public AdminUiCallBack GetAllControllerAndActionByAssembly()
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
var data = AdminsControllerPermission.GetAllControllerAndActionByAssembly();
|
||||
var data = AdminsControllerPermission.GetCacheCoreCmsControllerPermission();
|
||||
jm.data = data.OrderBy(u => u.name).ToList();
|
||||
jm.code = 0;
|
||||
jm.msg = "获取成功";
|
||||
|
||||
@@ -0,0 +1,350 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2022/4/10 0:27:47
|
||||
* Description: 暂无
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading.Tasks;
|
||||
using CoreCms.Net.Configuration;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.Entities.Expression;
|
||||
using CoreCms.Net.Model.FromBody;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using CoreCms.Net.Filter;
|
||||
using CoreCms.Net.Loging;
|
||||
using CoreCms.Net.IServices;
|
||||
using CoreCms.Net.Utility.Helper;
|
||||
using CoreCms.Net.Utility.Extensions;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NPOI.HSSF.UserModel;
|
||||
using SqlSugar;
|
||||
|
||||
namespace CoreCms.Net.Web.Admin.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户操作日志
|
||||
///</summary>
|
||||
[Description("用户操作日志")]
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
[RequiredErrorForAdmin]
|
||||
[Authorize]
|
||||
public class SysUserOperationLogController : ControllerBase
|
||||
{
|
||||
private readonly IWebHostEnvironment _webHostEnvironment;
|
||||
private readonly ISysUserOperationLogServices _sysUserOperationLogServices;
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
///</summary>
|
||||
public SysUserOperationLogController(IWebHostEnvironment webHostEnvironment
|
||||
,ISysUserOperationLogServices sysUserOperationLogServices
|
||||
)
|
||||
{
|
||||
_webHostEnvironment = webHostEnvironment;
|
||||
_sysUserOperationLogServices = sysUserOperationLogServices;
|
||||
}
|
||||
|
||||
#region 获取列表============================================================
|
||||
// POST: Api/SysUserOperationLog/GetPageList
|
||||
/// <summary>
|
||||
/// 获取列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("获取列表")]
|
||||
public async Task<AdminUiCallBack> GetPageList()
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
var pageCurrent = Request.Form["page"].FirstOrDefault().ObjectToInt(1);
|
||||
var pageSize = Request.Form["limit"].FirstOrDefault().ObjectToInt(30);
|
||||
var where = PredicateBuilder.True<SysUserOperationLog>();
|
||||
//获取排序字段
|
||||
var orderField = Request.Form["orderField"].FirstOrDefault();
|
||||
|
||||
Expression<Func<SysUserOperationLog, object>> orderEx = orderField switch
|
||||
{
|
||||
"id" => p => p.id,"userName" => p => p.userName,"userNickName" => p => p.userNickName,"userId" => p => p.userId,"ip" => p => p.ip,"apiPath" => p => p.apiPath,"beginTime" => p => p.beginTime,"endTime" => p => p.endTime,"opTime" => p => p.opTime,"requestMethod" => p => p.requestMethod,"requestData" => p => p.requestData,"responseBodyData" => p => p.responseBodyData,"agent" => p => p.agent,"actionName" => p => p.actionName,"actionDescription" => p => p.actionDescription,"controllerName" => p => p.controllerName,"controllerDescription" => p => p.controllerDescription,"statusCode" => p => p.statusCode,"createTime" => p => p.createTime,"dataSources" => p => p.dataSources,
|
||||
_ => p => p.id
|
||||
};
|
||||
|
||||
//设置排序方式
|
||||
var orderDirection = Request.Form["orderDirection"].FirstOrDefault();
|
||||
var orderBy = orderDirection switch
|
||||
{
|
||||
"asc" => OrderByType.Asc,
|
||||
"desc" => OrderByType.Desc,
|
||||
_ => OrderByType.Desc
|
||||
};
|
||||
//查询筛选
|
||||
|
||||
// int
|
||||
var id = Request.Form["id"].FirstOrDefault().ObjectToInt(0);
|
||||
if (id > 0)
|
||||
{
|
||||
where = where.And(p => p.id == id);
|
||||
}
|
||||
//用户登录账号 nvarchar
|
||||
var userName = Request.Form["userName"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(userName))
|
||||
{
|
||||
where = where.And(p => p.userName.Contains(userName));
|
||||
}
|
||||
//用户登录昵称 nvarchar
|
||||
var userNickName = Request.Form["userNickName"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(userNickName))
|
||||
{
|
||||
where = where.And(p => p.userNickName.Contains(userNickName));
|
||||
}
|
||||
//用户序列 nvarchar
|
||||
var userId = Request.Form["userId"].FirstOrDefault().ObjectToInt(0);
|
||||
if (userId > 0)
|
||||
{
|
||||
where = where.And(p => p.id == id);
|
||||
}
|
||||
//IP地址 nvarchar
|
||||
var ip = Request.Form["ip"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(ip))
|
||||
{
|
||||
where = where.And(p => p.ip.Contains(ip));
|
||||
}
|
||||
//请求地址 nvarchar
|
||||
var apiPath = Request.Form["apiPath"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(apiPath))
|
||||
{
|
||||
where = where.And(p => p.apiPath.Contains(apiPath));
|
||||
}
|
||||
//开始时间 datetime
|
||||
var beginTime = Request.Form["beginTime"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(beginTime))
|
||||
{
|
||||
if (beginTime.Contains("到"))
|
||||
{
|
||||
var dts = beginTime.Split("到");
|
||||
var dtStart = dts[0].Trim().ObjectToDate();
|
||||
where = where.And(p => p.beginTime > dtStart);
|
||||
var dtEnd = dts[1].Trim().ObjectToDate();
|
||||
where = where.And(p => p.beginTime < dtEnd);
|
||||
}
|
||||
else
|
||||
{
|
||||
var dt = beginTime.ObjectToDate();
|
||||
where = where.And(p => p.beginTime > dt);
|
||||
}
|
||||
}
|
||||
//结束时间 datetime
|
||||
var endTime = Request.Form["endTime"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(endTime))
|
||||
{
|
||||
if (endTime.Contains("到"))
|
||||
{
|
||||
var dts = endTime.Split("到");
|
||||
var dtStart = dts[0].Trim().ObjectToDate();
|
||||
where = where.And(p => p.endTime > dtStart);
|
||||
var dtEnd = dts[1].Trim().ObjectToDate();
|
||||
where = where.And(p => p.endTime < dtEnd);
|
||||
}
|
||||
else
|
||||
{
|
||||
var dt = endTime.ObjectToDate();
|
||||
where = where.And(p => p.endTime > dt);
|
||||
}
|
||||
}
|
||||
//耗时 nvarchar
|
||||
var opTime = Request.Form["opTime"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(opTime))
|
||||
{
|
||||
where = where.And(p => p.opTime.Contains(opTime));
|
||||
}
|
||||
//请求方式 nvarchar
|
||||
var requestMethod = Request.Form["requestMethod"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(requestMethod))
|
||||
{
|
||||
where = where.And(p => p.requestMethod.Contains(requestMethod));
|
||||
}
|
||||
//请求数据 nvarchar
|
||||
var requestData = Request.Form["requestData"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(requestData))
|
||||
{
|
||||
where = where.And(p => p.requestData.Contains(requestData));
|
||||
}
|
||||
//返回数据 nvarchar
|
||||
var responseBodyData = Request.Form["responseBodyData"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(responseBodyData))
|
||||
{
|
||||
where = where.And(p => p.responseBodyData.Contains(responseBodyData));
|
||||
}
|
||||
//代理渠道 nvarchar
|
||||
var agent = Request.Form["agent"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(agent))
|
||||
{
|
||||
where = where.And(p => p.agent.Contains(agent));
|
||||
}
|
||||
//动作方法名称 nvarchar
|
||||
var actionName = Request.Form["actionName"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(actionName))
|
||||
{
|
||||
where = where.And(p => p.actionName.Contains(actionName));
|
||||
}
|
||||
//动作方法描述 nvarchar
|
||||
var actionDescription = Request.Form["actionDescription"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(actionDescription))
|
||||
{
|
||||
where = where.And(p => p.actionDescription.Contains(actionDescription));
|
||||
}
|
||||
//控制器名称 nvarchar
|
||||
var controllerName = Request.Form["controllerName"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(controllerName))
|
||||
{
|
||||
where = where.And(p => p.controllerName.Contains(controllerName));
|
||||
}
|
||||
//控制器名称 nvarchar
|
||||
var controllerDescription = Request.Form["controllerDescription"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(controllerDescription))
|
||||
{
|
||||
where = where.And(p => p.controllerDescription.Contains(controllerDescription));
|
||||
}
|
||||
//状态码 int
|
||||
var statusCode = Request.Form["statusCode"].FirstOrDefault().ObjectToInt(0);
|
||||
if (statusCode > 0)
|
||||
{
|
||||
where = where.And(p => p.statusCode == statusCode);
|
||||
}
|
||||
//创建时间 datetime
|
||||
var createTime = Request.Form["createTime"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(createTime))
|
||||
{
|
||||
if (createTime.Contains("到"))
|
||||
{
|
||||
var dts = createTime.Split("到");
|
||||
var dtStart = dts[0].Trim().ObjectToDate();
|
||||
where = where.And(p => p.createTime > dtStart);
|
||||
var dtEnd = dts[1].Trim().ObjectToDate();
|
||||
where = where.And(p => p.createTime < dtEnd);
|
||||
}
|
||||
else
|
||||
{
|
||||
var dt = createTime.ObjectToDate();
|
||||
where = where.And(p => p.createTime > dt);
|
||||
}
|
||||
}
|
||||
//数据来源 nvarchar
|
||||
var dataSources = Request.Form["dataSources"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(dataSources))
|
||||
{
|
||||
where = where.And(p => p.dataSources.Contains(dataSources));
|
||||
}
|
||||
//获取数据
|
||||
var list = await _sysUserOperationLogServices.QueryPageAsync(where, orderEx, orderBy, pageCurrent, pageSize, true);
|
||||
//返回数据
|
||||
jm.data = list;
|
||||
jm.code = 0;
|
||||
jm.count = list.TotalCount;
|
||||
jm.msg = "数据调用成功!";
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 首页数据============================================================
|
||||
// POST: Api/SysUserOperationLog/GetIndex
|
||||
/// <summary>
|
||||
/// 首页数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("首页数据")]
|
||||
public AdminUiCallBack GetIndex()
|
||||
{
|
||||
//返回数据
|
||||
var jm = new AdminUiCallBack { code = 0 };
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 删除数据============================================================
|
||||
// POST: Api/SysUserOperationLog/DoDelete/10
|
||||
/// <summary>
|
||||
/// 单选删除
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("单选删除")]
|
||||
public async Task<AdminUiCallBack> DoDelete([FromBody]FMIntId entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var model = await _sysUserOperationLogServices.ExistsAsync(p => p.id == entity.id, true);
|
||||
if (!model)
|
||||
{
|
||||
jm.msg = GlobalConstVars.DataisNo;
|
||||
return jm;
|
||||
}
|
||||
var bl = await _sysUserOperationLogServices.DeleteByIdAsync(entity.id);
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 批量删除============================================================
|
||||
// POST: Api/SysUserOperationLog/DoBatchDelete/10,11,20
|
||||
/// <summary>
|
||||
/// 批量删除
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("批量删除")]
|
||||
public async Task<AdminUiCallBack> DoBatchDelete([FromBody]FMArrayIntIds entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await _sysUserOperationLogServices.DeleteByIdsAsync(entity.id);
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
return jm;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 预览数据============================================================
|
||||
// POST: Api/SysUserOperationLog/GetDetails/10
|
||||
/// <summary>
|
||||
/// 预览数据
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("预览数据")]
|
||||
public async Task<AdminUiCallBack> GetDetails([FromBody]FMIntId entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var model = await _sysUserOperationLogServices.QueryByIdAsync(entity.id, false);
|
||||
if (model == null)
|
||||
{
|
||||
jm.msg = "不存在此信息";
|
||||
return jm;
|
||||
}
|
||||
jm.code = 0;
|
||||
jm.data = model;
|
||||
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -174,7 +174,7 @@ namespace CoreCms.Net.Web.Admin
|
||||
// <20><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD>뷵<EFBFBD><EBB7B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (ע<><EFBFBD><E2BFAA>Ȩ<EFBFBD>ޣ<EFBFBD><DEA3><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4>)
|
||||
app.UseRequestResponseLog();
|
||||
// <20>û<EFBFBD><C3BB><EFBFBD><EFBFBD>ʼ<EFBFBD>¼(<28><><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD><C5B5><EFBFBD><EFBFBD>㣬<EFBFBD><E3A3AC>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><ECB3A3><EFBFBD>ᱨ<EFBFBD><E1B1A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD><EFBFBD><EFBFBD>)(ע<><EFBFBD><E2BFAA>Ȩ<EFBFBD>ޣ<EFBFBD><DEA3><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4>)
|
||||
app.UseRecordAccessLogsMildd();
|
||||
app.UseRecordAccessLogsMildd(GlobalEnumVars.CoreShopSystemCategory.Admin.ToString());
|
||||
// <20><>¼ip<69><70><EFBFBD><EFBFBD> (ע<><EFBFBD><E2BFAA>Ȩ<EFBFBD>ޣ<EFBFBD><DEA3><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4>)
|
||||
app.UseIpLogMildd();
|
||||
// signalr
|
||||
|
||||
@@ -46,8 +46,10 @@
|
||||
},
|
||||
//记录用户方访问数据
|
||||
"RecordAccessLogs": {
|
||||
"Enabled": false,
|
||||
"IgnoreApis": "/api/Home/GetNav,/api/Home/GetIds4Users"
|
||||
"Enabled": true, //是否开启记录操作日志功能。
|
||||
"EnabledFileMode": false, //是否开启记录到文件功能。(影响效率,接口不建议开启)
|
||||
"EnabledDbMode": true, //是否开启记录到数据库模式。(影响效率,接口不建议开启)
|
||||
"IgnoreApis": "/api/tools/getuserinfo,/api/tools/getNavs,/api/CodeGenerator/CodeGenDown" //使用小写逗号分隔
|
||||
},
|
||||
//记录IP请求数据
|
||||
"IPLog": {
|
||||
|
||||
@@ -0,0 +1,207 @@
|
||||
<script type="text/html" template lay-done="layui.data.done(d);">
|
||||
<table class="layui-table layui-form" lay-filter="LAY-app-SysUserOperationLog-detailsForm" id="LAY-app-SysUserOperationLog-detailsForm">
|
||||
<colgroup>
|
||||
<col width="150">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="id">序列</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.id || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="userName">用户登录账号</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.userName || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="userNickName">用户登录昵称</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.userNickName || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="userId">用户序列</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.userId || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="ip">IP地址</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.ip || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="apiPath">请求地址</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.apiPath || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="beginTime">开始时间</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.beginTime || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="endTime">结束时间</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.endTime || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="opTime">耗时</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.opTime || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="requestMethod">请求方式</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.requestMethod || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="requestData">请求数据</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.requestData || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="responseBodyData">返回数据</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.responseBodyData || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="agent">代理渠道</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.agent || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="actionName">动作方法名称</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.actionName || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="actionDescription">动作方法描述</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.actionDescription || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="controllerName">控制器名称</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.controllerName || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="controllerDescription">控制器名称</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.controllerDescription || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="statusCode">状态码</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.statusCode || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="createTime">创建时间</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.createTime || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="dataSources">数据来源</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.dataSources || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</script>
|
||||
<script>
|
||||
var debug = layui.setter.debug;
|
||||
layui.data.done = function (d) {
|
||||
//开启调试情况下获取接口赋值数据
|
||||
if (debug) { console.log(d.params.data); }
|
||||
|
||||
layui.use(['admin', 'form', 'coreHelper'], function () {
|
||||
var $ = layui.$
|
||||
, setter = layui.setter
|
||||
, admin = layui.admin
|
||||
, coreHelper = layui.coreHelper
|
||||
, form = layui.form;
|
||||
form.render(null, 'LAY-app-SysUserOperationLog-detailsForm');
|
||||
});
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,247 @@
|
||||
<title>用户操作日志</title>
|
||||
<!--当前位置开始-->
|
||||
<div class="layui-card layadmin-header">
|
||||
<div class="layui-breadcrumb" lay-filter="breadcrumb">
|
||||
<script type="text/html" template lay-done="layui.data.updateMainBreadcrumb();">
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
<!--当前位置结束-->
|
||||
<style>
|
||||
/* 重写样式 */
|
||||
</style>
|
||||
<script type="text/html" template lay-type="Post" lay-url="Api/SysUserOperationLog/GetIndex" lay-done="layui.data.done(d);">
|
||||
|
||||
</script>
|
||||
<div class="table-body">
|
||||
<table id="LAY-app-SysUserOperationLog-tableBox" lay-filter="LAY-app-SysUserOperationLog-tableBox"></table>
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="LAY-app-SysUserOperationLog-toolbar">
|
||||
<div class="layui-form coreshop-toolbar-search-form">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label" for="userName">用户登录账号</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="userName" placeholder="请输入用户登录账号" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label" for="ip">IP地址</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="ip" placeholder="请输入IP地址" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label" for="beginTime">开始时间</label>
|
||||
<div class="layui-input-inline" style="width: 260px;">
|
||||
<input type="text" name="beginTime" id="searchTime-SysUserOperationLog-beginTime" placeholder="请输入开始时间" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label" for="requestMethod">请求方式</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="requestMethod" placeholder="请输入请求方式" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label" for="statusCode">状态码</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="statusCode" placeholder="请输入状态码" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<button class="layui-btn layui-btn-sm" lay-submit lay-filter="LAY-app-SysUserOperationLog-search"><i class="layui-icon layui-icon-search"></i>筛选</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="LAY-app-SysUserOperationLog-pagebar">
|
||||
<div class="layui-btn-container">
|
||||
<button class="layui-btn layui-btn-sm" lay-event="batchDelete"><i class="layui-icon layui-icon-delete"></i>批量删除</button>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="LAY-app-SysUserOperationLog-tableBox-bar">
|
||||
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看</a>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var indexData;
|
||||
var debug = layui.setter.debug;
|
||||
layui.data.done = function (d) {
|
||||
//开启调试情况下获取接口赋值数据
|
||||
if (debug) { console.log(d); }
|
||||
|
||||
indexData = d.data;
|
||||
layui.use(['index', 'table', 'laydate', 'util', 'coredropdown', 'coreHelper'],
|
||||
function () {
|
||||
var $ = layui.$
|
||||
, admin = layui.admin
|
||||
, table = layui.table
|
||||
, form = layui.form
|
||||
, laydate = layui.laydate
|
||||
, setter = layui.setter
|
||||
, coreHelper = layui.coreHelper
|
||||
, util = layui.util
|
||||
, view = layui.view;
|
||||
|
||||
var searchwhere;
|
||||
//监听搜索
|
||||
form.on('submit(LAY-app-SysUserOperationLog-search)',
|
||||
function (data) {
|
||||
var field = data.field;
|
||||
searchwhere = field;
|
||||
//执行重载
|
||||
table.reloadData('LAY-app-SysUserOperationLog-tableBox', { where: field });
|
||||
});
|
||||
//数据绑定
|
||||
table.render({
|
||||
elem: '#LAY-app-SysUserOperationLog-tableBox',
|
||||
url: layui.setter.apiUrl + 'Api/SysUserOperationLog/GetPageList',
|
||||
method: 'POST',
|
||||
toolbar: '#LAY-app-SysUserOperationLog-toolbar',
|
||||
pagebar: '#LAY-app-SysUserOperationLog-pagebar',
|
||||
className: 'pagebarbox',
|
||||
defaultToolbar: ['filter', 'print', 'exports'],
|
||||
height: 'full-127',//面包屑142px,搜索框4行172,3行137,2行102,1行67
|
||||
page: true,
|
||||
limit: 30,
|
||||
limits: [10, 15, 20, 25, 30, 50, 100, 200],
|
||||
text: { none: '暂无相关数据' },
|
||||
cols: [
|
||||
[
|
||||
{ type: "checkbox", fixed: "left" },
|
||||
{ field: 'id', title: '序列', sort: false, width: 60 },
|
||||
{ field: 'userName', title: '登录账号', sort: false, width: 80 },
|
||||
//{ field: 'userNickName', title: '用户登录昵称', sort: false,width: 105 },
|
||||
//{ field: 'userId', title: '用户序列', sort: false,width: 105 },
|
||||
{ field: 'ip', title: 'IP地址', sort: false, width: 105 },
|
||||
{ field: 'apiPath', title: '请求地址', sort: false, width: 205 },
|
||||
{ field: 'beginTime', title: '开始时间', width: 130, sort: false },
|
||||
{ field: 'endTime', title: '结束时间', width: 130, sort: false },
|
||||
{ field: 'opTime', title: '耗时', sort: false, width: 80 },
|
||||
{ field: 'requestMethod', title: '方式', sort: false, width: 60 },
|
||||
//{ field: 'requestData', title: '请求数据', sort: false,width: 105 },
|
||||
//{ field: 'responseBodyData', title: '返回数据', sort: false,width: 105 },
|
||||
{ field: 'agent', title: '代理渠道', sort: false, width: 105 },
|
||||
{ field: 'actionName', title: '动作方法名称', sort: false, width: 105 },
|
||||
{ field: 'actionDescription', title: '动作方法描述', sort: false, width: 105 },
|
||||
{ field: 'controllerName', title: '控制器名称', sort: false, width: 105 },
|
||||
{ field: 'controllerDescription', title: '控制器名称', sort: false, width: 105 },
|
||||
{ field: 'statusCode', title: '状态码', sort: false, width: 60 },
|
||||
//{ field: 'createTime', title: '创建时间', width: 130, sort: false },
|
||||
{ field: 'dataSources', title: '数据来源', sort: false, width: 105 },
|
||||
{ width: 82, align: 'center', title: '操作', fixed: 'right', toolbar: '#LAY-app-SysUserOperationLog-tableBox-bar' }
|
||||
]
|
||||
]
|
||||
});
|
||||
//监听排序事件
|
||||
table.on('sort(LAY-app-SysUserOperationLog-tableBox)', function (obj) {
|
||||
table.reloadData('LAY-app-SysUserOperationLog-tableBox', {
|
||||
initSort: obj, //记录初始排序,如果不设的话,将无法标记表头的排序状态。
|
||||
where: { //请求参数(注意:这里面的参数可任意定义,并非下面固定的格式)
|
||||
orderField: obj.field, //排序字段
|
||||
orderDirection: obj.type //排序方式
|
||||
}
|
||||
});
|
||||
});
|
||||
//监听行双击事件
|
||||
table.on('rowDouble(LAY-app-SysUserOperationLog-tableBox)', function (obj) {
|
||||
//查看详情
|
||||
doDetails(obj);
|
||||
});
|
||||
//头工具栏事件
|
||||
table.on('pagebar(LAY-app-SysUserOperationLog-tableBox)', function (obj) {
|
||||
var checkStatus = table.checkStatus(obj.config.id);
|
||||
switch (obj.event) {
|
||||
case 'batchDelete':
|
||||
doBatchDelete(checkStatus);
|
||||
break;
|
||||
};
|
||||
});
|
||||
//监听工具条
|
||||
table.on('tool(LAY-app-SysUserOperationLog-tableBox)',
|
||||
function (obj) {
|
||||
if (obj.event === 'detail') {
|
||||
doDetails(obj);
|
||||
} else if (obj.event === 'del') {
|
||||
doDelete(obj);
|
||||
}
|
||||
});
|
||||
//执行预览操作
|
||||
function doDetails(obj) {
|
||||
coreHelper.Post("Api/SysUserOperationLog/GetDetails", { id: obj.data.id }, function (e) {
|
||||
if (e.code === 0) {
|
||||
admin.popup({
|
||||
shadeClose: false,
|
||||
title: '查看详情',
|
||||
area: ['90%', '90%'],
|
||||
id: 'LAY-popup-SysUserOperationLog-details',
|
||||
success: function (layero, index) {
|
||||
view(this.id).render('system/sysuseroperationlog/details', { data: e.data }).done(function () {
|
||||
form.render();
|
||||
});
|
||||
// 禁止弹窗出现滚动条
|
||||
//$(layero).children('.layui-layer-content').css('overflow', 'visible');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
//执行单个删除
|
||||
function doDelete(obj) {
|
||||
coreHelper.Post("Api/SysUserOperationLog/DoDelete", { id: obj.data.id }, function (e) {
|
||||
if (debug) { console.log(e); } //开启调试返回数据
|
||||
table.reloadData('LAY-app-SysUserOperationLog-tableBox');
|
||||
layer.msg(e.msg);
|
||||
});
|
||||
}
|
||||
//执行批量删除
|
||||
function doBatchDelete(checkStatus) {
|
||||
var checkData = checkStatus.data;
|
||||
if (checkData.length === 0) {
|
||||
return layer.msg('请选择要删除的数据');
|
||||
}
|
||||
layer.confirm('确定删除吗?删除后将无法恢复。',
|
||||
function (index) {
|
||||
var delidsStr = [];
|
||||
layui.each(checkData,
|
||||
function (index, item) {
|
||||
delidsStr.push(item.id);
|
||||
});
|
||||
coreHelper.Post("Api/SysUserOperationLog/DoBatchDelete", { id: delidsStr }, function (e) {
|
||||
if (debug) { console.log(e); } //开启调试返回数据
|
||||
table.reloadData('LAY-app-SysUserOperationLog-tableBox');
|
||||
layer.msg(e.msg);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
laydate.render({
|
||||
elem: '#searchTime-SysUserOperationLog-beginTime',
|
||||
type: 'datetime',
|
||||
range: '到',
|
||||
});
|
||||
laydate.render({
|
||||
elem: '#searchTime-SysUserOperationLog-endTime',
|
||||
type: 'datetime',
|
||||
range: '到',
|
||||
});
|
||||
laydate.render({
|
||||
elem: '#searchTime-SysUserOperationLog-createTime',
|
||||
type: 'datetime',
|
||||
range: '到',
|
||||
});
|
||||
|
||||
//监听 表格复选框操作
|
||||
|
||||
//重载form
|
||||
form.render();
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user