초기커밋
This commit is contained in:
42
UGQDataAccess/Logs/UgqApiBusinessLogger.cs
Normal file
42
UGQDataAccess/Logs/UgqApiBusinessLogger.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using ServerCommon;
|
||||
using UGQDatabase.Models;
|
||||
using ServerCore; using ServerBase;
|
||||
|
||||
namespace UGQDataAccess.Logs;
|
||||
|
||||
public static class UgqApiBusinessLogger
|
||||
{
|
||||
public static void initBusinessLog()
|
||||
{
|
||||
BusinessLogger.setup(new NLogAppender()
|
||||
, new JsonText()
|
||||
, LogTransToOutputType.TransToMultyLine);
|
||||
|
||||
Log.getLogger().info($"Success ServerLogicBase.onInitBusinessLog()");
|
||||
}
|
||||
|
||||
|
||||
public static ServerErrorCode collectLogs(LogAction logAction, AccountEntity accountEntity, List<ILogInvoker> invokers)
|
||||
{
|
||||
UgqLogAccount ugqLogAccount = new UgqLogAccount(accountEntity);
|
||||
return BusinessLogger.collectLogs(logAction, ugqLogAccount, invokers);
|
||||
}
|
||||
|
||||
public static ServerErrorCode collectLogs(LogAction logAction, string userGuid, List<ILogInvoker> invokers)
|
||||
{
|
||||
UgqLogAccount ugqLogAccount = new UgqLogAccount(userGuid);
|
||||
return BusinessLogger.collectLogs(logAction, ugqLogAccount, invokers);
|
||||
}
|
||||
|
||||
public static ServerErrorCode collectLogs(LogAction logAction, AdminAccountEntity accountEntity, List<ILogInvoker> invokers)
|
||||
{
|
||||
UgqLogAdmin ugqLogAdmin = new UgqLogAdmin(accountEntity);
|
||||
return BusinessLogger.collectLogs(logAction, ugqLogAdmin, invokers);
|
||||
}
|
||||
|
||||
public static ServerErrorCode collectLogs(LogAction logAction, string userGuid, string nickname, List<ILogInvoker> invokers)
|
||||
{
|
||||
UgqLogAccount ugqLogAccount = new UgqLogAccount(userGuid, nickname);
|
||||
return BusinessLogger.collectLogs(logAction, ugqLogAccount, invokers);
|
||||
}
|
||||
}
|
||||
71
UGQDataAccess/Logs/UgqLogAccount.cs
Normal file
71
UGQDataAccess/Logs/UgqLogAccount.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
using Google.Protobuf;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
using ServerCommon;
|
||||
using ServerCommon.BusinessLogDomain;
|
||||
using MetaAssets;
|
||||
|
||||
|
||||
using UGQDatabase.Models;
|
||||
|
||||
|
||||
namespace UGQDataAccess.Logs;
|
||||
|
||||
public class UgqLogAccount : IWithLogActor
|
||||
{
|
||||
string? m_userGuid;
|
||||
string? m_nickname;
|
||||
|
||||
public UgqLogAccount(AccountEntity entity)
|
||||
{
|
||||
m_userGuid = entity.UserGuid;
|
||||
m_nickname = entity.Nickname;
|
||||
}
|
||||
|
||||
public UgqLogAccount(string userGuid)
|
||||
{
|
||||
m_userGuid = userGuid;
|
||||
}
|
||||
|
||||
public UgqLogAccount(string userGuid, string nickname)
|
||||
{
|
||||
m_userGuid = userGuid;
|
||||
m_nickname = nickname;
|
||||
}
|
||||
|
||||
public ILogActor toLogActor()
|
||||
{
|
||||
var log_info = new UgqApiUserActorLog();
|
||||
log_info.initLogInfo(
|
||||
ServerType.UgqApi,
|
||||
m_userGuid ?? string.Empty,
|
||||
m_nickname ?? string.Empty
|
||||
);
|
||||
|
||||
return log_info;
|
||||
}
|
||||
}
|
||||
|
||||
public class UgqLogAdmin : IWithLogActor
|
||||
{
|
||||
string m_username;
|
||||
|
||||
public UgqLogAdmin(AdminAccountEntity entity)
|
||||
{
|
||||
m_username = entity.Username;
|
||||
}
|
||||
|
||||
public ILogActor toLogActor()
|
||||
{
|
||||
var log_info = new UgqApiAdminLog();
|
||||
log_info.initLogInfo(
|
||||
ServerType.UgqApi,
|
||||
m_username
|
||||
);
|
||||
|
||||
return log_info;
|
||||
}
|
||||
}
|
||||
201
UGQDataAccess/Logs/UgqeBusinessLog.cs
Normal file
201
UGQDataAccess/Logs/UgqeBusinessLog.cs
Normal file
@@ -0,0 +1,201 @@
|
||||
using Google.Protobuf;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
using ServerCommon;
|
||||
using ServerCommon.BusinessLogDomain;
|
||||
using MetaAssets;
|
||||
|
||||
|
||||
namespace UGQDataAccess.Logs;
|
||||
|
||||
public class UgqApiLoginBusinessLog : ILogInvokerEx
|
||||
{
|
||||
private UgqApiLoginLogInfo m_info;
|
||||
|
||||
public UgqApiLoginBusinessLog(UgqApiLoginType type) : base(LogDomainType.UgqApi)
|
||||
{
|
||||
m_info = new UgqApiLoginLogInfo(this, type);
|
||||
}
|
||||
|
||||
public override bool hasLog()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void fillup(ref BusinessLog.LogBody body)
|
||||
{
|
||||
body.append(m_info);
|
||||
}
|
||||
}
|
||||
|
||||
public class UgqApiLogoutBusinessLog : ILogInvokerEx
|
||||
{
|
||||
private UgqApiLogoutLogInfo m_info;
|
||||
|
||||
public UgqApiLogoutBusinessLog() : base(LogDomainType.UgqApi)
|
||||
{
|
||||
m_info = new UgqApiLogoutLogInfo(this);
|
||||
}
|
||||
|
||||
public override bool hasLog()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void fillup(ref BusinessLog.LogBody body)
|
||||
{
|
||||
body.append(m_info);
|
||||
}
|
||||
}
|
||||
|
||||
public class UgqApiQuestCraeteBusinessLog : ILogInvokerEx
|
||||
{
|
||||
private UgqApiQuestCraeteLogInfo m_info;
|
||||
|
||||
public UgqApiQuestCraeteBusinessLog(string quest_content_id, string admin_username) : base(LogDomainType.UgqApi)
|
||||
{
|
||||
m_info = new UgqApiQuestCraeteLogInfo(this, quest_content_id, admin_username);
|
||||
}
|
||||
|
||||
public override bool hasLog()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void fillup(ref BusinessLog.LogBody body)
|
||||
{
|
||||
body.append(m_info);
|
||||
}
|
||||
}
|
||||
|
||||
public class UgqApiAddSlotBusinessLog : ILogInvokerEx
|
||||
{
|
||||
private UgqApiAddSlotLogInfo m_info;
|
||||
|
||||
public UgqApiAddSlotBusinessLog(int additional_slots, string admin_username) : base(LogDomainType.UgqApi)
|
||||
{
|
||||
m_info = new UgqApiAddSlotLogInfo(this, additional_slots, admin_username);
|
||||
}
|
||||
|
||||
public override bool hasLog()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void fillup(ref BusinessLog.LogBody body)
|
||||
{
|
||||
body.append(m_info);
|
||||
}
|
||||
}
|
||||
|
||||
public class UgqApiChangeStateBusinessLog : ILogInvokerEx
|
||||
{
|
||||
private UgqApiChangeStateLogInfo m_info;
|
||||
|
||||
public UgqApiChangeStateBusinessLog(string quest_content_id, string from_state, string to_state,
|
||||
long quest_id, long revision, string admin_username) : base(LogDomainType.UgqApi)
|
||||
{
|
||||
m_info = new UgqApiChangeStateLogInfo(this, quest_content_id,
|
||||
from_state, to_state,
|
||||
quest_id, revision, admin_username);
|
||||
}
|
||||
|
||||
public override bool hasLog()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void fillup(ref BusinessLog.LogBody body)
|
||||
{
|
||||
body.append(m_info);
|
||||
}
|
||||
}
|
||||
|
||||
public class UgqApiCreatorPointBusinessLog : ILogInvokerEx
|
||||
{
|
||||
private UgqApiCreatorPointLogInfo m_info;
|
||||
|
||||
public UgqApiCreatorPointBusinessLog(double amount, long questId, long revision, string admin_username,
|
||||
UgqCreatorPointReason reason, string reason_detail) : base(LogDomainType.UgqApi)
|
||||
{
|
||||
m_info = new UgqApiCreatorPointLogInfo(this, amount, questId, revision, admin_username, reason, reason_detail);
|
||||
}
|
||||
|
||||
public override bool hasLog()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void fillup(ref BusinessLog.LogBody body)
|
||||
{
|
||||
body.append(m_info);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class UgqApiAdminLoginBusinessLog : ILogInvokerEx
|
||||
{
|
||||
private UgqApiAdminLoginLogInfo m_info;
|
||||
|
||||
public UgqApiAdminLoginBusinessLog(string username) : base(LogDomainType.UgqApi)
|
||||
{
|
||||
m_info = new UgqApiAdminLoginLogInfo(this, username);
|
||||
}
|
||||
|
||||
public override bool hasLog()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void fillup(ref BusinessLog.LogBody body)
|
||||
{
|
||||
body.append(m_info);
|
||||
}
|
||||
}
|
||||
|
||||
public class UgqApiEmptyLoginBusinessLog : ILogInvokerEx
|
||||
{
|
||||
private UgqApiEmptyLogInfo m_info;
|
||||
|
||||
public UgqApiEmptyLoginBusinessLog() : base(LogDomainType.UgqApi)
|
||||
{
|
||||
m_info = new UgqApiEmptyLogInfo(this);
|
||||
}
|
||||
|
||||
public override bool hasLog()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void fillup(ref BusinessLog.LogBody body)
|
||||
{
|
||||
body.append(m_info);
|
||||
}
|
||||
}
|
||||
|
||||
public class EmptyBusinessWithLogActor : IWithLogActor
|
||||
{
|
||||
public ILogActor toLogActor()
|
||||
{
|
||||
var log_info = new EmptyBusinessLogActor();
|
||||
return log_info;
|
||||
}
|
||||
}
|
||||
|
||||
public class EmptyBusinessLogActor : ILogActor
|
||||
{
|
||||
public DateTime m_date { get; set; } = DateTimeHelper.Current;
|
||||
|
||||
public EmptyBusinessLogActor()
|
||||
{
|
||||
m_date = DateTimeHelper.Current;
|
||||
}
|
||||
|
||||
public EmptyBusinessLogActor(EmptyBusinessLogActor logInfo)
|
||||
{
|
||||
m_date = logInfo.m_date;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user