You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
2.0 KiB
60 lines
2.0 KiB
2 years ago
|
using Elight.Entity;
|
||
|
using Elight.Entity.SystemModel;
|
||
|
using Elight.Utility;
|
||
|
using Elight.Utility.Code;
|
||
|
using Elight.Utility.logs;
|
||
|
using Microsoft.AspNetCore.Mvc;
|
||
|
using Microsoft.Extensions.Configuration;
|
||
|
using Microsoft.Extensions.Logging;
|
||
|
using Newtonsoft.Json;
|
||
|
using SqlSugar;
|
||
|
using sun.nio.ch;
|
||
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
using System.Security.Claims;
|
||
|
using System.Text;
|
||
|
using System.Threading.Tasks;
|
||
|
|
||
|
namespace Elight.Logic
|
||
|
{
|
||
|
public class WriteSysLog
|
||
|
{
|
||
|
App_Sys_UserModel _userdata = new App_Sys_UserModel();//当前用户
|
||
|
Result ret = new Result();
|
||
|
public WriteSysLog(User user)
|
||
|
{
|
||
|
_userdata = user.Userdata();
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 添加数据库日志信息
|
||
|
/// </summary>
|
||
|
/// <returns></returns>
|
||
|
public void WriteSysLogadd(string operationType, string content, Result result, SqlSugarClient _db=null, string opeCasDepAccCas = null)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
Func_Dossier_LogRecordModel model = new Func_Dossier_LogRecordModel
|
||
|
{
|
||
|
UnitCode = _userdata.unitCode,
|
||
|
OperationType = operationType,
|
||
|
NameEntity = "",
|
||
|
LogContents = result.IsSucceed ? $"{content}成功" : $"{content}失败:{result.Message}",
|
||
|
ParColCreTimTakYeaTri = DateTime.Now.Year.ToString(),
|
||
|
OperationIp = "",
|
||
|
Operation = _userdata.name,
|
||
|
OperatingTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
|
||
|
OperatingManual = _userdata.Id,
|
||
|
OpeCasDepAccCas = opeCasDepAccCas ?? string.Empty
|
||
|
};
|
||
|
var sss= _db.Insertable(model).ExecuteCommand();
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
LogService.WriteLog(ex, "添加数据库日志信息_WriteSysLog_1 发生异常");
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|