忽略
This commit is contained in:
@@ -1,156 +1,156 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Dapper;
|
||||
using Hncore.Infrastructure.Common;
|
||||
using Hncore.Infrastructure.Serializer;
|
||||
using MySql.Data.MySqlClient;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Hncore.Infrastructure.OperationLog
|
||||
{
|
||||
public class OperationLog
|
||||
{
|
||||
/// <summary>
|
||||
/// 物业id
|
||||
/// </summary>
|
||||
[JsonProperty("owner_id")]
|
||||
public int OwnerId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
[JsonProperty("createtime")]
|
||||
public DateTime CreateTime { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// 更新时间
|
||||
/// </summary>
|
||||
[JsonProperty("updatetime")]
|
||||
public DateTime UpdateTime { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// 删除标记
|
||||
/// </summary>
|
||||
[JsonProperty("deletetag")]
|
||||
public int DeleteTag { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 创建人id
|
||||
/// </summary>
|
||||
[JsonProperty("creatorid")]
|
||||
public int CreatorId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新人id
|
||||
/// </summary>
|
||||
[JsonProperty("updatorid")]
|
||||
public int UpdatorId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作目标id
|
||||
/// </summary>
|
||||
[JsonProperty("targetid")]
|
||||
public int TargetId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作人名
|
||||
/// </summary>
|
||||
[JsonProperty("operator")]
|
||||
public string Operator { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作说明
|
||||
/// </summary>
|
||||
[JsonProperty("opdesc")]
|
||||
public string OpDesc { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作前
|
||||
/// </summary>
|
||||
[JsonProperty("beforeop")]
|
||||
public string BeforeOp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作后
|
||||
/// </summary>
|
||||
[JsonProperty("afterop")]
|
||||
public string AfterOp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作对象所在小区编码
|
||||
/// </summary>
|
||||
[JsonProperty("projectcode")]
|
||||
public int ProjectCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 小区名称
|
||||
/// </summary>
|
||||
[JsonProperty("estatename")]
|
||||
public string EstateName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作权限编码
|
||||
/// </summary>
|
||||
[JsonProperty("permissioncode")]
|
||||
public string PermissionCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作权限标签
|
||||
/// </summary>
|
||||
[JsonProperty("permissionlabel")]
|
||||
public string PermissionLabel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作菜单编码
|
||||
/// </summary>
|
||||
[JsonProperty("optype")]
|
||||
public int OpType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作菜单名称
|
||||
/// </summary>
|
||||
[JsonProperty("optypename")]
|
||||
public string OpTypeName { get; set; }
|
||||
|
||||
public void Write()
|
||||
{
|
||||
try
|
||||
{
|
||||
OperationLogStorage.WriteLog(this);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogHelper.Error("写操作日志失败", e);
|
||||
}
|
||||
}
|
||||
public void WriteAsync()
|
||||
{
|
||||
Task.Run(()=> Write());
|
||||
}
|
||||
}
|
||||
|
||||
internal class OperationLogStorage
|
||||
{
|
||||
private static string _devConn =
|
||||
"Server=rm-bp12e1533udh1827azo.mysql.rds.aliyuncs.com;Database=etor_property_test;User=etor_test;Password=etor_test!QAZ2wsx;Convert Zero Datetime=True;";
|
||||
|
||||
private static string _proConn =
|
||||
"Server=rm-bp1z48e1qz15k7q9qo.mysql.rds.aliyuncs.com;Database=etor_property_pro;User=sadmin;Password=!QAZ2wsx;Convert Zero Datetime=True;";
|
||||
|
||||
private static string _insertSql = @"INSERT INTO etor_property_operationlog
|
||||
(
|
||||
owner_id, createtime, updatetime, deletetag, creatorid, updatorid, targetid, operator, opdesc, beforeop, afterop, projectcode, estatename, permissioncode, permissionlabel, optype, optypename
|
||||
)
|
||||
VALUES (@OwnerId,@CreateTime,@UpdateTime,@DeleteTag,@CreatorId,@UpdatorId,@TargetId,@Operator,@OpDesc,@BeforeOp,@AfterOp,@ProjectCode,@EstateName,@PermissionCode,@PermissionLabel,@OpType,@OpTypeName);";
|
||||
|
||||
public static void WriteLog(OperationLog log)
|
||||
{
|
||||
string connString = EnvironmentVariableHelper.IsAspNetCoreProduction ? _proConn : _devConn;
|
||||
|
||||
using (var conn = new MySqlConnection(connString))
|
||||
{
|
||||
conn.Execute(_insertSql, log);
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Dapper;
|
||||
using Hncore.Infrastructure.Common;
|
||||
using Hncore.Infrastructure.Serializer;
|
||||
using MySql.Data.MySqlClient;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Hncore.Infrastructure.OperationLog
|
||||
{
|
||||
public class OperationLog
|
||||
{
|
||||
/// <summary>
|
||||
/// 物业id
|
||||
/// </summary>
|
||||
[JsonProperty("owner_id")]
|
||||
public int OwnerId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
[JsonProperty("createtime")]
|
||||
public DateTime CreateTime { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// 更新时间
|
||||
/// </summary>
|
||||
[JsonProperty("updatetime")]
|
||||
public DateTime UpdateTime { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// 删除标记
|
||||
/// </summary>
|
||||
[JsonProperty("deletetag")]
|
||||
public int DeleteTag { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 创建人id
|
||||
/// </summary>
|
||||
[JsonProperty("creatorid")]
|
||||
public int CreatorId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新人id
|
||||
/// </summary>
|
||||
[JsonProperty("updatorid")]
|
||||
public int UpdatorId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作目标id
|
||||
/// </summary>
|
||||
[JsonProperty("targetid")]
|
||||
public int TargetId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作人名
|
||||
/// </summary>
|
||||
[JsonProperty("operator")]
|
||||
public string Operator { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作说明
|
||||
/// </summary>
|
||||
[JsonProperty("opdesc")]
|
||||
public string OpDesc { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作前
|
||||
/// </summary>
|
||||
[JsonProperty("beforeop")]
|
||||
public string BeforeOp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作后
|
||||
/// </summary>
|
||||
[JsonProperty("afterop")]
|
||||
public string AfterOp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作对象所在小区编码
|
||||
/// </summary>
|
||||
[JsonProperty("projectcode")]
|
||||
public int ProjectCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 小区名称
|
||||
/// </summary>
|
||||
[JsonProperty("estatename")]
|
||||
public string EstateName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作权限编码
|
||||
/// </summary>
|
||||
[JsonProperty("permissioncode")]
|
||||
public string PermissionCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作权限标签
|
||||
/// </summary>
|
||||
[JsonProperty("permissionlabel")]
|
||||
public string PermissionLabel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作菜单编码
|
||||
/// </summary>
|
||||
[JsonProperty("optype")]
|
||||
public int OpType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作菜单名称
|
||||
/// </summary>
|
||||
[JsonProperty("optypename")]
|
||||
public string OpTypeName { get; set; }
|
||||
|
||||
public void Write()
|
||||
{
|
||||
try
|
||||
{
|
||||
OperationLogStorage.WriteLog(this);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogHelper.Error("写操作日志失败", e);
|
||||
}
|
||||
}
|
||||
public void WriteAsync()
|
||||
{
|
||||
Task.Run(()=> Write());
|
||||
}
|
||||
}
|
||||
|
||||
internal class OperationLogStorage
|
||||
{
|
||||
private static string _devConn =
|
||||
"Server=rm-bp12e1533udh1827azo.mysql.rds.aliyuncs.com;Database=etor_property_test;User=etor_test;Password=etor_test!QAZ2wsx;Convert Zero Datetime=True;";
|
||||
|
||||
private static string _proConn =
|
||||
"Server=rm-bp1z48e1qz15k7q9qo.mysql.rds.aliyuncs.com;Database=etor_property_pro;User=sadmin;Password=!QAZ2wsx;Convert Zero Datetime=True;";
|
||||
|
||||
private static string _insertSql = @"INSERT INTO etor_property_operationlog
|
||||
(
|
||||
owner_id, createtime, updatetime, deletetag, creatorid, updatorid, targetid, operator, opdesc, beforeop, afterop, projectcode, estatename, permissioncode, permissionlabel, optype, optypename
|
||||
)
|
||||
VALUES (@OwnerId,@CreateTime,@UpdateTime,@DeleteTag,@CreatorId,@UpdatorId,@TargetId,@Operator,@OpDesc,@BeforeOp,@AfterOp,@ProjectCode,@EstateName,@PermissionCode,@PermissionLabel,@OpType,@OpTypeName);";
|
||||
|
||||
public static void WriteLog(OperationLog log)
|
||||
{
|
||||
string connString = EnvironmentVariableHelper.IsAspNetCoreProduction ? _proConn : _devConn;
|
||||
|
||||
using (var conn = new MySqlConnection(connString))
|
||||
{
|
||||
conn.Execute(_insertSql, log);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user